fix console promote

This commit is contained in:
2025-04-15 18:31:09 +02:00
parent 1a038a3de1
commit ae0e76a452
5 changed files with 108 additions and 59 deletions

View File

@@ -6,11 +6,15 @@ import chess.controller.CommandExecutor;
import chess.controller.commands.MoveCommand;
import chess.controller.event.GameAdaptator;
import chess.model.Move;
import common.Signal0;
public abstract class Simulator extends GameAdaptator{
public abstract class Simulator extends GameAdaptator {
protected final CommandExecutor commandExecutor;
public final Signal0 onComplete = new Signal0();
private int currentMove = 0;
public Simulator(CommandExecutor commandExecutor) {
this.commandExecutor = commandExecutor;
}
@@ -22,6 +26,14 @@ public abstract class Simulator extends GameAdaptator{
}
}
@Override
public void onMove(Move move) {
currentMove++;
if (currentMove == getMoves().size()) {
onComplete.emit();
}
}
protected abstract List<Move> getMoves();
}