refactor draw
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user