-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChessBoard.java
More file actions
29 lines (23 loc) · 759 Bytes
/
ChessBoard.java
File metadata and controls
29 lines (23 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class ChessBoard {
private ChessNode[][] my_board;
public ChessBoard(){
newGame();
}
public void newGame(){
my_board = new ChessNode[8][8];
for (int r = 0; r < 8; r++){
for (int c = 0; c < 8; c++){
my_board[r][c] = new ChessNode();
}
}
newGameBlack(); //sets up black pieces
newGameWhite(); //sets up white pieces
}
//Sets up the top portion of the board (rows 0 and 1) to black pieces.
private newGameBlack(){
my_board[0][0] = my_board[0][8] = new Rook(black);
my_board[0][1] = my_board[0][7] = new Knight(black);
my_board[0][2] = my_board[0][6] = new Bishop(black);
my_board[0][3] = new
}
}