Quelques modifications mineures
This commit is contained in:
@ -210,8 +210,21 @@ public class Board {
|
||||
}
|
||||
}
|
||||
}
|
||||
boardValue = getBoardValue();
|
||||
|
||||
|
||||
if (numberOfBlackPieces == 0) {
|
||||
boardValue = BLACK_WINS;
|
||||
} else if (numberOfWhitePieces == 0){
|
||||
boardValue = WHITE_WINS;
|
||||
} else if (!Rules.isThereALegalMovesForPlayer(this)) {
|
||||
if (currentPlayer==Piece.WHITE) {
|
||||
boardValue = WHITE_WINS;
|
||||
} else {
|
||||
boardValue = BLACK_WINS;
|
||||
}
|
||||
} else {
|
||||
boardValue = getBoardValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -493,6 +506,7 @@ public class Board {
|
||||
}
|
||||
|
||||
private void evaluateNewBoardValue (Move move) throws NotAValidSquare {
|
||||
|
||||
if (move.isCaptureMove()) {
|
||||
if (move.getCapturedPiece().getColor()==Piece.BLACK) {
|
||||
numberOfBlackPieces--;
|
||||
@ -508,7 +522,7 @@ public class Board {
|
||||
boardValue = numberOfBlackPieces - numberOfWhitePieces;
|
||||
}
|
||||
}
|
||||
if (Rules.isThereALegalMovesForPlayer(this)) {
|
||||
if (!Rules.isThereALegalMovesForPlayer(this)) {
|
||||
if (currentPlayer==Piece.WHITE) {
|
||||
boardValue = WHITE_WINS;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user