Skip to content

Commit

Permalink
Max and min were switched, it's a lot smarter now
Browse files Browse the repository at this point in the history
  • Loading branch information
john committed Apr 30, 2016
1 parent b702042 commit 31ac736
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/controller/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -160,7 +158,7 @@ public int getMinimaxScore(Color color, Board b, int depth, boolean inJumpSequen
ArrayList<Integer> moveScores = new ArrayList<Integer>();

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 */
Expand Down Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/controller/GameConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 31ac736

Please sign in to comment.