Files
3DChess/app/src/main/java/chess/ai/DumbAI.java
Persson-dev 810a0f2159
All checks were successful
Linux arm64 / Build (push) Successful in 41s
feat: add ai castling (Fixes #4)
2025-05-06 17:15:55 +02:00

28 lines
543 B
Java

package chess.ai;
import java.util.List;
import java.util.Random;
import chess.ai.actions.AIAction;
import chess.controller.CommandExecutor;
import chess.model.Color;
public class DumbAI extends AI {
private final Random random = new Random();
public DumbAI(CommandExecutor commandExecutor, Color color) {
super(commandExecutor, color);
}
@Override
protected void play() {
List<AIAction> actions = getAllowedActions();
int randomAction = this.random.nextInt(actions.size());
actions.get(randomAction).applyAction();
}
}