Files
3DChess/app/src/main/java/chess/ai/AI.java
fl.du.pr Grens 97950403a5
All checks were successful
Linux arm64 / Build (push) Successful in 33s
class documentation - a shitload of it
2025-05-18 20:08:22 +02:00

42 lines
864 B
Java

package chess.ai;
import java.util.List;
import chess.ai.actions.AIAction;
import chess.ai.actions.AIActions;
import chess.controller.CommandExecutor;
import chess.controller.event.GameAdapter;
import chess.model.Color;
import chess.model.Coordinate;
import chess.model.Piece;
/**
* Abstract class, used to code bots.
*/
public abstract class AI extends GameAdapter implements AIActions {
protected final CommandExecutor commandExecutor;
protected final Color color;
public AI(CommandExecutor commandExecutor, Color color) {
this.commandExecutor = commandExecutor;
this.color = color;
}
protected abstract void play();
@Override
public void onPlayerTurn(Color color, boolean undone) {
if (this.color != color || undone)
return;
play();
}
@Override
public CommandExecutor getCommandExecutor() {
return this.commandExecutor;
}
}