From 31ac736e16199bdb37b3d57464c1283083791046 Mon Sep 17 00:00:00 2001 From: jwb11006 Date: Sat, 30 Apr 2016 16:45:45 -0400 Subject: [PATCH] Max and min were switched, it's a lot smarter now --- src/controller/Game.java | 8 +++----- src/controller/GameConstants.java | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/controller/Game.java b/src/controller/Game.java index 85a2a39..b8bb51e 100755 --- a/src/controller/Game.java +++ b/src/controller/Game.java @@ -2,8 +2,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.LinkedList; -import java.util.Queue; import model.Board; import model.Color; @@ -160,7 +158,7 @@ public int getMinimaxScore(Color color, Board b, int depth, boolean inJumpSequen ArrayList moveScores = new ArrayList(); if (inJumpSequence) { - /* Generate the frontier only for the piece that just moves */ + /* Generate the frontier only for the piece that just moved */ boardFrontier = b.generateJumpFrontierForPiece(b.getLastPieceMoved()); /* If we can't jump anymore, get out of the jump sequence */ @@ -196,11 +194,11 @@ public int getMinimaxScore(Color color, Board b, int depth, boolean inJumpSequen if (color == GameConstants.THUNK_COLOR) { // Maximize - return Collections.max(moveScores); + return Collections.min(moveScores); } else { // Minimize - return Collections.min(moveScores); + return Collections.max(moveScores); } } diff --git a/src/controller/GameConstants.java b/src/controller/GameConstants.java index 989e7fe..d4f3895 100644 --- a/src/controller/GameConstants.java +++ b/src/controller/GameConstants.java @@ -8,5 +8,5 @@ public class GameConstants { public static final Color THUNK_COLOR = Color.WHITE; public static final Color USER_COLOR = Color.BLACK; public static final int MAX_PASSIVE_MOVES = 50; - public static final int MAX_SEARCH_DEPTH = 5; + public static final int MAX_SEARCH_DEPTH = 4; }