Your wokwi code and your posted code are different.
Your code sets up the game board, then erases it, then repeats.
One way to eliminate "not enough space" is to not allow attempts at placing ships closer than their length.
Why do you not look at your IDE error report?
Sketch uses 8650 bytes (28%) of program storage space. Maximum is 30720 bytes.
Global variables use 484 bytes (23%) of dynamic memory, leaving 1564 bytes for local variables. Maximum is 2048 bytes.
What is your question?