Skip to content

Commit

Permalink
Fixed minor bug causing AI to needlessly give jumps away to user. Now
Browse files Browse the repository at this point in the history
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
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ public boolean isPromotionLocation(Location location) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ private int getMinimaxScore(Color color, Board b, int depth, boolean inJumpSeque
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.