en passant rule

This commit is contained in:
2025-04-05 19:20:41 +02:00
parent 2ec7be27ca
commit d94f7d733b
9 changed files with 108 additions and 38 deletions

View File

@@ -4,6 +4,7 @@ import java.util.EmptyStackException;
import java.util.Stack;
import chess.controller.PlayerCommand;
import chess.controller.commands.MoveCommand;
import chess.model.visitor.PawnIdentifier;
public class Game {
@@ -99,4 +100,14 @@ public class Game {
}
}
public void updateLastMove() {
if (this.movesHistory.isEmpty())
return;
PlayerCommand last = this.movesHistory.getLast();
if (last instanceof MoveCommand move) {
this.board.setLastMove(move.getMove());
}
}
}