Comments on class board

This commit is contained in:
gabrielshiraishi 2025-04-17 09:11:37 +02:00
parent b104c47b6f
commit 92797f59c3
1 changed files with 7 additions and 7 deletions

View File

@ -55,23 +55,23 @@ public class Board {
board.get(y).set(x, piece); board.get(y).set(x, piece);
} }
public void populateBoard() { public void populateBoard() {//populates the board
for (int x = 0; x < this.width;x++) { for (int x = 0; x < this.width;x++) {
for (int y = 0; y < this.height; y++) { for (int y = 0; y < this.height; y++) {
if (y ==1 || y == 6) { if (y ==1 || y == 6) {
if (y == 1) { if (y == 1) {
this.setPiece(x,y,PieceType.Pawn,false); this.setPiece(x,y,PieceType.Pawn,false);//Place the pawns
} }
else if (y == 6) {this.setPiece(x,y,PieceType.Pawn,true);} else if (y == 6) {this.setPiece(x,y,PieceType.Pawn,true);}
} }
if (y == 0) { if (y == 0) {
boolean col = false; boolean col = false;
if (x == 0 || x == 7) { if (x == 0 || x == 7) {
this.setPiece(x,y,PieceType.Rook,col); this.setPiece(x,y,PieceType.Rook,col);//Places the rooks
} else if (x == 1 || x == 6) {this.setPiece(x,y,PieceType.Knight,col);} } else if (x == 1 || x == 6) {this.setPiece(x,y,PieceType.Knight,col);}// Place the Knights
else if (x == 2 || x == 5) {this.setPiece(x,y,PieceType.Bishop,col);} else if (x == 2 || x == 5) {this.setPiece(x,y,PieceType.Bishop,col);}// Place the Bishops
else if (x == 3) {this.setPiece(x,y,PieceType.Queen,col);} else if (x == 3) {this.setPiece(x,y,PieceType.Queen,col);}// Places the queen
else if (x == 4) {this.setPiece(x,y,PieceType.King,col);} else if (x == 4) {this.setPiece(x,y,PieceType.King,col);}// Places the King
} else if (y == 7) { } else if (y == 7) {
boolean col = true; boolean col = true;
if (x == 0 || x == 7) { if (x == 0 || x == 7) {