Super IA (#5)

Reviewed-on: #5
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
This commit was merged in pull request #5.
This commit is contained in:
2025-04-30 18:28:01 +00:00
committed by Simon Pribylski
parent ecb0fdc623
commit 3b38e0da1f
26 changed files with 814 additions and 179 deletions

View File

@@ -37,7 +37,6 @@ public class MoveCommand extends PlayerCommand {
return result;
case Moved:
outputSystem.onMove(this.move);
game.saveTraitPiecesPos();
return result;
@@ -53,7 +52,7 @@ public class MoveCommand extends PlayerCommand {
final ChessBoard board = game.getBoard();
// we must promote the pending pawn before
if (board.pawnShouldBePromoted())
if (game.pawnShouldBePromoted())
return CommandResult.NotAllowed;
Piece piece = board.pieceAt(move.getStart());
@@ -76,11 +75,14 @@ public class MoveCommand extends PlayerCommand {
}
if (tryPromote(game, outputSystem)) {
outputSystem.onMove(this.move);
return CommandResult.ActionNeeded;
}
board.setLastMove(this.move);
outputSystem.onMove(this.move);
return CommandResult.Moved;
}