Skip to content

Commit

Permalink
Swapped min and max. Even I can't beat it now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron committed May 3, 2016
1 parent 9d53eac commit 102b269
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/player/ComputerPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private int getMinimaxScore(Color color, Board b, int depth, boolean inJumpSeque
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 {
Expand Down Expand Up @@ -127,12 +128,12 @@ private int getMinimaxScore(Color color, Board b, int depth, boolean inJumpSeque
}

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);
}

}
Expand Down

0 comments on commit 102b269

Please sign in to comment.