fix console promote
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user