add general ai

This commit is contained in:
2025-04-16 19:21:47 +02:00
parent 78d48fafc6
commit 923ace22f1
10 changed files with 87 additions and 51 deletions

View File

@@ -43,7 +43,7 @@ public class EmptyGameDispatcher extends GameDispatcher {
}
@Override
public void onPlayerTurn(Color color) {
public void onPlayerTurn(Color color, boolean undone) {
}
@Override

View File

@@ -7,7 +7,7 @@ import chess.model.Move;
public abstract class GameAdaptator implements GameListener {
@Override
public void onPlayerTurn(Color color) {}
public void onPlayerTurn(Color color, boolean undone) {}
@Override
public void onWin(Color color) {}

View File

@@ -29,8 +29,8 @@ public class GameDispatcher implements GameListener {
}
@Override
public void onPlayerTurn(Color color) {
asyncForEachCall((l) -> l.onPlayerTurn(color));
public void onPlayerTurn(Color color, boolean undone) {
asyncForEachCall((l) -> l.onPlayerTurn(color, undone));
}
@Override

View File

@@ -56,8 +56,9 @@ public interface GameListener {
/**
* Invoked when it's the player turn
* @param color the color of the player who should play
* @param undone true if it's a result of an undo command
*/
void onPlayerTurn(Color color);
void onPlayerTurn(Color color, boolean undone);
/**
* Invoked when a pawn should be promoted