From 102b269a94ea441c05c2acbd50574e530d0aaa68 Mon Sep 17 00:00:00 2001 From: aah13002 Date: Tue, 3 May 2016 14:27:54 -0400 Subject: [PATCH] Swapped min and max. Even I can't beat it now. --- src/player/ComputerPlayer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/player/ComputerPlayer.java b/src/player/ComputerPlayer.java index b2de44c..89d1ee4 100644 --- a/src/player/ComputerPlayer.java +++ b/src/player/ComputerPlayer.java @@ -100,6 +100,7 @@ public class ComputerPlayer extends Player { boardFrontier = b.generateJumpFrontierForPiece(b.getLastPieceMoved()); /* If we can't jump anymore, get out of the jump sequence */ if (boardFrontier.isEmpty()) { + inJumpSequence = false; return getMinimaxScore(otherColor, b, depth-1, inJumpSequence); } } else { @@ -127,12 +128,12 @@ public class ComputerPlayer extends Player { } if (color == GameConstants.THUNK_COLOR) { - // Maximize - return Collections.max(moveScores); + // Minimize over the opponent's scores + return Collections.min(moveScores); } else { - // Minimize - return Collections.min(moveScores); + // Assume the opponent maximizes their score. + return Collections.max(moveScores); } }