Unity3d小遊戲:

2D矩陣

The following grid shows the state a 2D arraay:
OO

XO

XX
This grid is created with the following code: This grid is created with the following code:
public class q137 {
 public static void main(String[] args) 
 {
  char[][]grid=new char[3][3];
  grid[1][1]='X';
  grid[0][0]='O';
  grid[2][1]='X';
  grid[0][1]='O';
  grid[2][2]='X';
  grid[1][2]='O';
 }
}

Which line of code,when inserted in place of //line n1 ,adds an X into the grid so that the grid contains three conseutive X's?



這道題目考的是2D陣列,題目要求要'X'連成三格,由此可知要在grid[2][0]填入'X'

留言