From bf7e53adc6919d11af38c149f84d869cb1ebba75 Mon Sep 17 00:00:00 2001 From: ken_ruster Date: Tue, 14 Nov 2023 12:44:50 +0800 Subject: [PATCH] Fix bug with current turn in save --- src/main/java/chessmaster/ChessMaster.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/chessmaster/ChessMaster.java b/src/main/java/chessmaster/ChessMaster.java index cdacf1b7f..4d50c6a5a 100644 --- a/src/main/java/chessmaster/ChessMaster.java +++ b/src/main/java/chessmaster/ChessMaster.java @@ -62,10 +62,11 @@ private Color getCurrentTurnColor(Human human, CPU cpu, Color playerColor) throw int noHumanMoves = human.getMovesLength(); int noCPUMoves = cpu.getMovesLength(); - if (noHumanMoves == noCPUMoves) { + if (noHumanMoves == noCPUMoves && playerColor.isWhite() + || noHumanMoves < noCPUMoves && playerColor.isBlack()) { return playerColor; } else if (noHumanMoves > noCPUMoves && playerColor.isWhite() - || noHumanMoves < noCPUMoves && playerColor.isBlack()) { + || noHumanMoves == noCPUMoves && playerColor.isBlack()) { return playerColor.getOppositeColour(); }