Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIME
The default time per move for a search
|
static int |
MAX_DEPTH
The maximum depth allowed for a search
|
static int |
MIN_DEPTH
The minimum depth allowed for a search
|
Constructor and Description |
---|
Negamax()
Initializes a new
Negamax object. |
Modifier and Type | Method and Description |
---|---|
void |
abortComputation()
Aborts the current search
|
int |
computeBestMove(Game game)
Computes a best move for the current position of a game.
|
int |
computeBestScore(Game game)
Computes a best move for the current position of a game and
returns its score.
|
protected void |
finalize()
Destructor for this
Negamax instance. |
int |
getContempt()
Returns current the comptempt factor of the engine.
|
int |
getDepth()
Returns the maximum depth allowed for the search
|
int |
getInfinity()
Returns the current infinity score of the engine.
|
long |
getMoveTime()
Returns the maximum time allowed for a move computation
in milliseconds
|
void |
newMatch()
Tells the engine that the next positions are going to be from
a different match.
|
void |
setCache(Cache cache)
Sets the transposition table to use.
|
void |
setContempt(int score)
Sets the contempt factor.
|
void |
setDepth(int depth)
Sets the maximum depth for subsequent computations
|
void |
setInfinity(int score)
Sets the infinity score.
|
void |
setLeaves(Leaves leaves)
Sets the endgames database to use.
|
void |
setMoveTime(long delay)
Sets the maximum time allowed for subsequent computations
|
public static final long DEFAULT_TIME
public static final int MAX_DEPTH
public static final int MIN_DEPTH
public int getDepth()
public long getMoveTime()
getMoveTime
in interface Engine
public int getContempt()
getContempt
in interface Engine
public int getInfinity()
getInfinity
in interface Engine
public void setDepth(int depth)
public void setMoveTime(long delay)
setMoveTime
in interface Engine
delay
- The new time value in milliseconds as a
positive number greater than zeropublic void setContempt(int score)
setContempt
in interface Engine
score
- Score for draw positionsEngine.setInfinity(int)
public void setInfinity(int score)
setInfinity
in interface Engine
score
- Infinite value as apositive integerpublic void setCache(Cache cache)
cache
- A cache object or null
to disable
the transposition tablepublic void setLeaves(Leaves leaves)
leaves
- A leaves object or null
to disable
the use of precomputed endgamespublic void newMatch()
public void abortComputation()
abortComputation
in interface Engine
Engine.computeBestMove(Game)
public int computeBestScore(Game game)
game
- The game for which a score must be computedpublic int computeBestMove(Game game)
Note that the search is performed on the provided game object, thus, the game object will change during the computation and its capacity may be increased. The provided game object must not be manipulated while a computation is ongoing.
computeBestMove
in interface Engine
game
- The game for which a best move must be computedGame.NULL_MOVE
if the game already endedprotected void finalize() throws java.lang.Throwable
Negamax
instance. Aborts the current
computation, if any, and gracefully finalizes this object.finalize
in class java.lang.Object
java.lang.Throwable