Additional comment board

This commit is contained in:
lrave 2025-05-06 14:16:22 +02:00
parent b7c1e9b497
commit 2c410e4eb7
1 changed files with 5 additions and 5 deletions

View File

@ -29,28 +29,28 @@ public class Board {
return height;
}
// new piece on the board at x,y
// new piece on the board at x,y (More specifically changes the empty cell of coordinates x,y with a new chess piece)
public void setPiece(boolean isWhite, PieceType type, int x, int y) {
board[x][y] = new Piece(x, y, type, isWhite);
}
public boolean isTurnWhite() {
if (turnNumber % 2 == 0) { // even turns including 0 are white's ones
if (turnNumber % 2 == 0) { // even turns including 0 are white's ones (% calculates the reminder of the euclidean division)
return true;
} else { // same reasoning, odd turns are black's ones
return false;
}
}
public int getTurnNumber() { // these classes change the turn and the increment one solves a problem of infinite loop
return turnNumber;
public int getTurnNumber() { // this class enables to obtain the current turn number while increment adds 1 to this value for each turn
return turnNumber; // Necessarly in two functions to get rid of an infinite loop ****WHY****
}
public void incrementTurn() {
turnNumber++;
}
// set up the chess board taking it as a matrix
// set up the classic chess board taking it as a matrix and putting each corresponding starting piece at its place 0,0 is the top left spot of the board
public void populateBoard() {
// Black
setPiece(false, PieceType.Rook, 0, 0);