Trying to Create a Battleship Program with Java -
public class battleshipgrid { public static final int out_of_bounds = -1; // values used in 2d grid public static final int empty = 0; public static final int ship = 1; public static final int hit = 2; public static final int miss = 3;
i need create nested loop allows each element of 10 x 10 battleship grid set value empty (so 0). how do this?
how store grid? if it's multidimensional array, work:
for (int = 0; < 10; i++) (int j = 0; j < 10; j++) grid[i][j] = empty;
i suggest use enum values way.
Comments
Post a Comment