feat: add ai castling (Fixes #4)
All checks were successful
Linux arm64 / Build (push) Successful in 41s
All checks were successful
Linux arm64 / Build (push) Successful in 41s
This commit is contained in:
33
app/src/main/java/chess/ai/actions/AIAction.java
Normal file
33
app/src/main/java/chess/ai/actions/AIAction.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package chess.ai.actions;
|
||||
|
||||
import chess.controller.Command;
|
||||
import chess.controller.CommandExecutor;
|
||||
import chess.controller.Command.CommandResult;
|
||||
import chess.controller.commands.UndoCommand;
|
||||
|
||||
public abstract class AIAction {
|
||||
|
||||
private final CommandExecutor commandExecutor;
|
||||
|
||||
public AIAction(CommandExecutor commandExecutor) {
|
||||
this.commandExecutor = commandExecutor;
|
||||
}
|
||||
|
||||
protected CommandResult sendCommand(Command cmd, CommandExecutor commandExecutor) {
|
||||
return commandExecutor.executeCommand(cmd);
|
||||
}
|
||||
|
||||
public void undoAction(CommandExecutor commandExecutor) {
|
||||
sendCommand(new UndoCommand(), commandExecutor);
|
||||
}
|
||||
|
||||
public void undoAction() {
|
||||
undoAction(this.commandExecutor);
|
||||
}
|
||||
|
||||
public void applyAction() {
|
||||
applyAction(this.commandExecutor);
|
||||
}
|
||||
|
||||
public abstract void applyAction(CommandExecutor commandExecutor);
|
||||
}
|
||||
Reference in New Issue
Block a user