【发布时间】:2014-06-15 13:06:52
【问题描述】:
private Piece[][] board;
public cboard(){
this.board = new Piece[8][8];
}
public boolean isEmpty(int x, int y){
boolean empty= true;
if (board[x][y] != null){
empty= false;
}
return empty;
}
public void placePiece(Piece, int x, int y){
if(isEmpty(x, y)){
board[x][y] = piece;
}
}
}
这会为碎片创建一个数组吗? 该函数必须检查该位置是否为空
【问题讨论】: