add simulators for testing
This commit is contained in:
27
app/src/main/java/chess/simulator/Simulator.java
Normal file
27
app/src/main/java/chess/simulator/Simulator.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package chess.simulator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import chess.controller.CommandExecutor;
|
||||
import chess.controller.commands.MoveCommand;
|
||||
import chess.controller.event.GameAdaptator;
|
||||
import chess.model.Move;
|
||||
|
||||
public abstract class Simulator extends GameAdaptator{
|
||||
|
||||
protected final CommandExecutor commandExecutor;
|
||||
|
||||
public Simulator(CommandExecutor commandExecutor) {
|
||||
this.commandExecutor = commandExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGameStart() {
|
||||
for (Move move : getMoves()) {
|
||||
this.commandExecutor.executeCommand(new MoveCommand(move));
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract List<Move> getMoves();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user