|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectknockabout.search.AlphaBetaSearchAlgorithm
A real-time implementation of expected alpha-beta, with iterative deepening, move ordering and stochastic cut-off
Field Summary | |
static int |
READY
The search operation is ready to start |
static int |
SEARCHING
An active search operation is in progress |
static int |
STOPPING
The signal for the search thread to stop and go back to READY |
Constructor Summary | |
AlphaBetaSearchAlgorithm()
|
Method Summary | |
int |
getAverageBranchingFactor()
Average branching factor. |
float |
getBestMoveUtility()
|
Heuristic |
getHeuristic()
|
GameState |
getInitialState()
|
int |
getMaxDepth()
|
int |
getNumberOfExploredNodes()
Number of min nodes + number of max nodes explored |
protected float |
max(float alpha,
float beta)
Note that this function will leave the board in the same configuration as the it was when the function was called, because the inverse move is always applied after each move tried. |
protected float |
min(float alpha,
float beta)
See max() |
void |
run()
What is done by the search thread is in there: an implementation of iterative deepening |
Move |
search()
Perform the real-time search operation This method will take [timeLimitMillis] millisecond to complete & return |
void |
setHeuristic(Heuristic heuristic)
The heuristic function to evaluate the utility of non terminal nodes |
void |
setInitialState(GameState initialState)
The initial state of the game |
protected void |
setMaxDepth(int i)
The depth for which minmax stops expending and begin to use its heuristic instead |
protected float |
stochMax(float alpha,
float beta)
In the case of a stochastic node, average the possibilities A cut-off is sometimes possible too since the utility is bounded |
protected float |
stochMin(float alpha,
float beta)
See stochMax() |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int READY
public static final int SEARCHING
public static final int STOPPING
Constructor Detail |
public AlphaBetaSearchAlgorithm()
Method Detail |
public GameState getInitialState()
getInitialState
in interface SearchAlgorithm
public void setInitialState(GameState initialState)
SearchAlgorithm
setInitialState
in interface SearchAlgorithm
initialState
- public Move search()
search
in interface SearchAlgorithm
public void run()
run
in interface java.lang.Runnable
protected float max(float alpha, float beta)
protected float stochMax(float alpha, float beta)
protected float min(float alpha, float beta)
protected float stochMin(float alpha, float beta)
public int getMaxDepth()
getMaxDepth
in interface SearchAlgorithm
protected void setMaxDepth(int i)
i
- public Heuristic getHeuristic()
getHeuristic
in interface SearchAlgorithm
public void setHeuristic(Heuristic heuristic)
setHeuristic
in interface SearchAlgorithm
heuristic
- public float getBestMoveUtility()
getBestMoveUtility
in interface SearchAlgorithm
public int getNumberOfExploredNodes()
getNumberOfExploredNodes
in interface SearchAlgorithm
public int getAverageBranchingFactor()
getAverageBranchingFactor
in interface SearchAlgorithm
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |