ai.alphabeta
Class AlphaBeta
java.lang.Object
|
+--ai.alphabeta.AlphaBeta
- All Implemented Interfaces:
- GameInterface
- public class AlphaBeta
- extends java.lang.Object
- implements GameInterface
A class for alpha-beta searching.
Will return the best move for given situation and player, as
calculated by the alpha-beta search algorithm with given search
depth.
- Version:
- $Revision: 1.0.1, 2003-09-18 $
- Author:
- Peter Larsson
Method Summary |
static java.lang.Object |
getBestMove(NodeModel node,
int player,
int alpha,
int beta,
int depth)
Returns the best move for given situation and player, as
calculated by the alpha-beta search algorithm with given search
depth. |
static java.lang.Object |
search(NodeModel node,
int player,
int alpha,
int beta,
int depth,
boolean first)
Returns the best move for given situation and player, as
calculated by the alpha-beta search algorithm with given search
depth. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AlphaBeta
public AlphaBeta(int player)
AlphaBeta
public AlphaBeta(int player,
int depth)
getBestMove
public static java.lang.Object getBestMove(NodeModel node,
int player,
int alpha,
int beta,
int depth)
- Returns the best move for given situation and player, as
calculated by the alpha-beta search algorithm with given search
depth.
- Parameters:
node
- The Node Model for the Gameplayer
- player in turnalpha
- best score for black (maximizer) along the path to state
beta
- best score for white (minimizer) along the path to state
depth
- maximum recursion depth- Returns:
- Returns the bestMove or null if no move is found
search
public static java.lang.Object search(NodeModel node,
int player,
int alpha,
int beta,
int depth,
boolean first)
- Returns the best move for given situation and player, as
calculated by the alpha-beta search algorithm with given search
depth.
- Parameters:
node
- The Node Model for the Gameplayer
- player in turnalpha
- best score for black (maximizer) along the path to state
beta
- best score for white (minimizer) along the path to state
depth
- maximum recursion depthfirst
- use false
to return the score for the best move
instead of the move itself- Returns:
- Returns the bestMove or null if no move is found