add move preconditions

This commit is contained in:
2025-04-04 20:57:20 +02:00
parent 7b07423175
commit 63a1e261e8
2 changed files with 10 additions and 2 deletions

View File

@@ -8,6 +8,10 @@ public class CastlingCommand extends PlayerCommand{
@Override
public CommandResult execute(Game game, OutputSystem outputSystem) {
// we must promote the pending pawn before
if (game.pawnShouldBePromoted())
return CommandResult.NotAllowed;
return CommandResult.NotAllowed;
}

View File

@@ -8,6 +8,10 @@ public class GrandCastlingCommand extends PlayerCommand {
@Override
public CommandResult execute(Game game, OutputSystem outputSystem) {
// we must promote the pending pawn before
if (game.pawnShouldBePromoted())
return CommandResult.NotAllowed;
return CommandResult.NotAllowed;
}