everything is on the chess plate except the pawns
This commit is contained in:
parent
3fe51e6652
commit
3cd2b5a83c
|
|
@ -44,33 +44,34 @@ public class Board {
|
||||||
|
|
||||||
public void populateBoard() {
|
public void populateBoard() {
|
||||||
|
|
||||||
board[0][0] = new Piece(false, PieceType.Rook, 0, 0);
|
|
||||||
/*
|
|
||||||
// Place Rooks
|
// Place Rooks
|
||||||
board[0][0] = new Rook(PieceColor.BLACK, new Position(0, 0));
|
board[0][0] = new Piece(false, PieceType.Rook, 0, 0); //color, piece , x -> , y |
|
||||||
board[0][7] = new Rook(PieceColor.BLACK, new Position(0, 7));
|
board[0][7] = new Piece(true, PieceType.Rook, 0, 7);
|
||||||
board[7][0] = new Rook(PieceColor.WHITE, new Position(7, 0));
|
board[7][0] = new Piece(false, PieceType.Rook, 7, 0);
|
||||||
board[7][7] = new Rook(PieceColor.WHITE, new Position(7, 7));
|
board[7][7] = new Piece(true, PieceType.Rook, 7, 7);
|
||||||
|
|
||||||
// Place Knights
|
// Place Knights
|
||||||
board[0][1] = new Knight(PieceColor.BLACK, new Position(0, 1));
|
board[1][0] = new Piece(false, PieceType.King, 1, 0);
|
||||||
board[0][6] = new Knight(PieceColor.BLACK, new Position(0, 6));
|
board[1][7] = new Piece(true, PieceType.King, 1, 7);
|
||||||
board[7][1] = new Knight(PieceColor.WHITE, new Position(7, 1));
|
board[6][0] = new Piece(false, PieceType.King, 6, 0);
|
||||||
board[7][6] = new Knight(PieceColor.WHITE, new Position(7, 6));
|
board[6][7] = new Piece(true, PieceType.King, 6, 7);
|
||||||
// Place Bishops
|
// Place Bishops
|
||||||
board[0][2] = new Bishop(PieceColor.BLACK, new Position(0, 2));
|
board[2][0] = new Piece(false, PieceType.Bishop, 2, 0);
|
||||||
board[0][5] = new Bishop(PieceColor.BLACK, new Position(0, 5));
|
board[2][7] = new Piece(true, PieceType.Bishop, 2, 7);
|
||||||
board[7][2] = new Bishop(PieceColor.WHITE, new Position(7, 2));
|
board[5][0] = new Piece(false, PieceType.Bishop, 5, 0);
|
||||||
board[7][5] = new Bishop(PieceColor.WHITE, new Position(7, 5));
|
board[5][7] = new Piece(true, PieceType.Bishop, 5, 7);
|
||||||
// Place Queens
|
// Place Queens
|
||||||
board[0][3] = new Queen(PieceColor.BLACK, new Position(0, 3));
|
board[4][0] = new Piece(false, PieceType.Queen, 4, 0);
|
||||||
board[7][3] = new Queen(PieceColor.WHITE, new Position(7, 3));
|
board[4][7] = new Piece(true, PieceType.Queen, 4, 7);
|
||||||
// Place Kings
|
// Place Kings
|
||||||
board[0][4] = new King(PieceColor.BLACK, new Position(0, 4));
|
board[3][0] = new Piece(false, PieceType.King, 3, 0);
|
||||||
board[7][4] = new King(PieceColor.WHITE, new Position(7, 4));
|
board[3][7] = new Piece(true, PieceType.King, 3, 7);
|
||||||
// Place Pawns
|
// Place Pawns
|
||||||
|
/*
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
board[1][i] = new Pawn(PieceColor.BLACK, new Position(1, i));
|
board[1][i] = new Piece(false, PieceType.Pawn, 1, i);
|
||||||
board[6][i] = new Pawn(PieceColor.WHITE, new Position(6, i));
|
board[6][i] = new Piece(true, PieceType.Pawn, 6, i);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +88,13 @@ public class Board {
|
||||||
|
|
||||||
public ArrayList<Piece> getPieces() {
|
public ArrayList<Piece> getPieces() {
|
||||||
ArrayList<Piece> pieces = new ArrayList<>();
|
ArrayList<Piece> pieces = new ArrayList<>();
|
||||||
//TODO
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
if (board[i][j] != null) {
|
||||||
|
pieces.add(board[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return pieces;
|
return pieces;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue