You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1008 B

package Game.ChessObj;
public class ChessBoard {
private ChessFigure[][] board;
public ChessBoard() {
board = new ChessFigure[8][8];
initBoard();
}
protected void initBoard() {
ChessFigure.Type[] order = {
ChessFigure.Type.CASTLE, ChessFigure.Type.KNIGHT, ChessFigure.Type.BISHOP, ChessFigure.Type.QUEEN, ChessFigure.Type.KING, ChessFigure.Type.BISHOP, ChessFigure.Type.KNIGHT, ChessFigure.Type.CASTLE
};
for (int i = 0; i < board.length; i++) {
//sets all pawns
board[i][1] = new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.BLACK);
board[i][6] = new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE);
//sets all others
board[i][0] = new ChessFigure(order[i], ChessFigure.Team.BLACK);
board[i][7] = new ChessFigure(order[i], ChessFigure.Team.WHITE);
}
}
public ChessFigure[][] getBoard() {
return this.board;
}
}