refactor draw

This commit is contained in:
2025-04-13 15:58:26 +02:00
parent b336784a5d
commit 8b8eb428e5
2 changed files with 31 additions and 11 deletions

View File

@@ -59,11 +59,7 @@ public class CommandExecutor {
}
private void switchPlayerTurn() {
if(this.game.switchPlayerTurn()) {
this.dispatcher.onDraw();
this.dispatcher.onGameEnd();
return;
}
this.game.switchPlayerTurn();
this.dispatcher.onPlayerTurn(this.game.getPlayerTurn());
}
@@ -75,6 +71,9 @@ public class CommandExecutor {
GameStatus gameStatus = this.game.checkGameStatus();
switch (gameStatus) {
case Draw:
this.dispatcher.onDraw();
return true;
case Check:
this.dispatcher.onKingInCheck();
return false;