Text shows up when check and checkmate ends game totally or when this

capture
This commit is contained in:
jefei 2025-05-18 00:41:58 +02:00
parent de3721d00c
commit 15827da582
2 changed files with 7 additions and 5 deletions

View File

@ -806,5 +806,4 @@ public String getWinnerText() {
if (isCheckmate(false)) return "White Wins by Checkmate!"; if (isCheckmate(false)) return "White Wins by Checkmate!";
return ""; return "";
} }
//hi
} }

View File

@ -60,9 +60,12 @@ public class Game extends Thread {
} }
private void aiPlayerTurn() { private void aiPlayerTurn() {
if (board.isGameOver()) return; if (isAITurn() && !board.isCheckmateFlag()) {
if(isAITurn()) { Move bestMove = aiPlayer.computeBestMove(new Board(board));
board.playMove(aiPlayer.computeBestMove(new Board(board))); if (bestMove != null) {
board.selectPiece(bestMove.getMovedPiece().getX(), bestMove.getMovedPiece().getY());
board.userTouch(bestMove.getToX(), bestMove.getToY());
}
} }
} }