Skip to content

Commit

Permalink
du frist move by random only when ai level is set to weak.
Browse files Browse the repository at this point in the history
  • Loading branch information
ferenc-hechler committed Dec 2, 2017
1 parent d90272a commit 3ea6730
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public void setAILevel(int aiLevel) {
public void setWeak(boolean weak) {
this.weak = weak;
}
protected boolean getWeak() {
return this.weak;
}

/* (non-Javadoc)
* @see de.hechler.aigames.ai.IGame#restartGame()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public DoMoveResult<ConnectFourMove> doAIMove() {
@Override
public ConnectFourMove calcAIMove() {
int best;
if (field.getCountMoves() == 0) {
if (getWeak() && (field.getCountMoves() == 0)) {
// first move by random
best = RandUtils.randomInt(7) + 1;
}
Expand Down

0 comments on commit 3ea6730

Please sign in to comment.