Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed minor bug causing AI to needlessly give jumps away to user. Now
plays more aggressively.
  • Loading branch information
mef11025 committed May 3, 2016
1 parent 8151371 commit b5f626f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/model/Board.java
Expand Up @@ -397,9 +397,9 @@ public class Board {
public int pieceDifferentialHeuristic(Color color) {
int blackHeuristic = blackPieces + blackKings;
int whiteHeuristic = whitePieces + whiteKings;
return - (color == Color.BLACK ?
return (color == Color.BLACK ?
(blackHeuristic - whiteHeuristic) :

This comment has been minimized.

Copy link
@Aaron

Aaron May 3, 2016

Collaborator

delete subtraction for the case when your color is black as well

(whiteHeuristic - blackHeuristic));
(whiteHeuristic));
}

public Location samuelMapping(int k) {
Expand Down
3 changes: 1 addition & 2 deletions src/player/ComputerPlayer.java
Expand Up @@ -94,11 +94,10 @@ public class ComputerPlayer extends Player {
if (depth == 0) {
return b.getHeuristic(otherColor);
}

This comment has been minimized.

Copy link
@Aaron

Aaron May 3, 2016

Collaborator

newline remove

if (inJumpSequence) {
/* 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 */
if (boardFrontier.isEmpty()) {
return getMinimaxScore(otherColor, b, depth-1, inJumpSequence);
Expand Down

0 comments on commit b5f626f

Please sign in to comment.