Files
3DChess/app/src/main/java/chess/ai/actions/AIAction.java
Persson-dev 90daf662ea
All checks were successful
Linux arm64 / Build (push) Successful in 36s
add CommanderSender (Fixes #9)
2025-05-17 16:48:04 +02:00

34 lines
775 B
Java

package chess.ai.actions;
import chess.controller.CommandExecutor;
import chess.controller.CommandSender;
import chess.controller.commands.UndoCommand;
public abstract class AIAction implements CommandSender {
private final CommandExecutor commandExecutor;
public AIAction(CommandExecutor commandExecutor) {
this.commandExecutor = commandExecutor;
}
@Override
public CommandExecutor getCommandExecutor() {
return this.commandExecutor;
}
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);
}