-1
所以我试图从数组中创建一个索引来绕过我已有的问号网格。我试图让它输出每列和网格的每一行的数量,但我无法让它正确地绕过网格。有没有人有我如何做到这一点的想法?Java数组索引
import java.util.Scanner;
import java.util.Arrays;
public class H4_Minesweeper {
public static void main(String[] args) {
//Game Description and rules
System.out.println("Minesweeper is a very straightforward game, the rules are simple.");
System.out.println("Uncover a mine (x), and the game ends. Uncover an empty square (o), and you keep playing.");
System.out.println("A question mark (?) will represent tiles you have not uncovered yet.");
System.out.println("Uncover a number, and it tells you how many mines lay hidden in the eight surrounding squares.");
System.out.println("To enter which tile you would like to uncover, please enter the column number, then row number of that tile.");
System.out.println("\n\n");
Scanner userin = new Scanner(System.in);
//Index of the grid
int[] column = {1,2,3,4,5,6,7,8,9};
for (int counter = 0; counter<column.length;counter++){
System.out.print(counter);
}
//9x9 grid output
String[][] board = new String [9][9];
for (int r = 0; r<board.length;r++){
for (int c = 0; c <board.length;c++){
{
}
board [r][c] ="?";
System.out.print("[" + board[r][c] + "]");
}
System.out.println();
}
//User input for column & row
String move = userin.nextLine();
}
}