refactor dumb ai castling

This commit is contained in:
2025-04-16 19:25:04 +02:00
parent 923ace22f1
commit bee5e613bb

View File

@@ -35,20 +35,12 @@ public class DumbAI extends AI {
return; return;
} }
case Small: { case Small:
int randomMove = this.random.nextInt(moves.size() + 1);
if (randomMove != moves.size())
break;
this.commandExecutor.executeCommand(new CastlingCommand(false));
return;
}
case Big: { case Big: {
int randomMove = this.random.nextInt(moves.size() + 1); int randomMove = this.random.nextInt(moves.size() + 1);
if (randomMove != moves.size()) if (randomMove != moves.size())
break; break;
this.commandExecutor.executeCommand(new CastlingCommand(true)); this.commandExecutor.executeCommand(new CastlingCommand(castlings == CastlingResult.Big));
return; return;
} }