Can anyone explain how it actually works? ive been carefully checking every single step with my note and all written down, and it does work fine, but why is the spot 4 all the time?when i init it with 0, it doesnt make sense to me...
Random rand = new Random();
int[][] map = new int[row][column];
int spot = 0;
int i=0;
int j=0;
/*ignore this part
for(i = 0; i<map.length; i++){
for(j = 0; j<map[i].length; j++) {
map[i][j] = rand.nextInt(2);
}
System.out.println();
}*/
System.out.println();
for(i =0; i<map.length; i++){
for(j =0; j<map[i].length; j++){
if(map[i][j] == 1){
while(spot<4){
map[i][j] = 5;
spot++;
}
}
System.out.print(map[i][j]+" ");
}
System.out.print(spot);
System.out.println();
}
System.out.println();
}
