Skip to content

Commit

Permalink
Improve heuristic function
Browse files Browse the repository at this point in the history
Now looks for number of threats as well as runs. For example a 3 in a
row may be free on one side or both. If a slot is spare both sides then
this is double the threats.
  • Loading branch information
Ben Thurley committed May 5, 2017
1 parent bb9aa08 commit 9cfb604
Show file tree
Hide file tree
Showing 3 changed files with 247 additions and 191 deletions.
11 changes: 9 additions & 2 deletions src/main/java/bot/FieldScore.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ public final class FieldScore
{
private final int score;
private final boolean hasWinner;
private final int winner;

public FieldScore(int score, boolean hasWinner)
public FieldScore(int score, int winner)
{
this.score = score;
this.hasWinner = hasWinner;
this.winner = winner;
this.hasWinner = (winner != 0);
}

public int getScore()
Expand All @@ -26,4 +28,9 @@ public boolean hasWinner()
{
return hasWinner;
}

public int getWinner()
{
return winner;
}
}
Loading

0 comments on commit 9cfb604

Please sign in to comment.