All MoveGenerators default to 1 move lookahead.

Made MoveGenerators protected for unit testing.
Added unit test for some analysis of MoveGenerator speeds.
Fixed MDP to consider all states where #turns = maxTurns terminal.
This commit is contained in:
Woody Folsom
2012-05-01 22:24:02 -04:00
parent 924780baaf
commit 3ba0db6ebd
12 changed files with 162 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ import model.SearchResult;
public class AlphaBetaMoveGenerator implements MoveGenerator {
private static final int DEFAULT_RECURSIVE_PLAYS = 1;
private int lookahead = DEFAULT_RECURSIVE_PLAYS;
private final BoardScorer scorer = new BoardScorer();
private final ValidMoveGenerator validMoveGenerator = new ValidMoveGenerator();
@@ -18,10 +18,10 @@ public class AlphaBetaMoveGenerator implements MoveGenerator {
public Move genMove(Board board, boolean asHuman) {
if (!asHuman) {
return getMaxValue(board, asHuman, DEFAULT_RECURSIVE_PLAYS * 2,
return getMaxValue(board, asHuman, lookahead * 2,
Integer.MIN_VALUE, Integer.MAX_VALUE).move;
} else {
return getMinValue(board, asHuman, DEFAULT_RECURSIVE_PLAYS * 2,
return getMinValue(board, asHuman, lookahead * 2,
Integer.MIN_VALUE, Integer.MAX_VALUE).move;
}
}
@@ -114,4 +114,9 @@ public class AlphaBetaMoveGenerator implements MoveGenerator {
return bestResult;
}
@Override
public boolean setLookahead(int lookahead) {
this.lookahead = lookahead;
return true;
}
}