Good, I'm making a game board (a simple sink the fleet), and to define the boxes I'm using a multidimensional array (x, y). The idea is to initially assign values to these boxes depending on the content (toilet = 0 boat = 1), it seems too gross to assign the values one by one, especially in order to complicate the type of exercise in the future, so I it happens to use a 'For' loop to assign them, should I cover with a 'for' all the boxes and then open secondary loops for the boxes in which there is a ship?
package HundirFlota;
class MyDesk {
int [][] barcosvivos;
public MyDesk(){
this.barcosvivos = new int[5][5];}
public MyDesk (int enemydesk[][]){
this.barcosvivos = new int [5][5];}
}
//Boats life: 0-Water, 1-Life Position,
/*
* [0][0][0][0][0]
[1][0][1][1][1]
[1][0][0][0][0]
[1][0][0][0][0]
[0][0][0][0][0]
*/
The question is what would be the cleanest way to do it. Greetings