public class Detroid extends Object implements ControllerEngine, TunableEngine
HASH_OPTION_NAME, OWN_BOOK_OPTION_NAME, START_POSITION, THREADS_OPTION_NAME
Constructor and Description |
---|
Detroid()
Instantiates the chess engine object.
|
Modifier and Type | Method and Description |
---|---|
void |
blackForfeit()
Sets the game state to unspecified white victory.
|
String |
convertPACNToSAN(String move)
Converts a move legal in the current position from Pure Algebraic Coordinate Notation to Standard Algebraic Notation.
|
String |
convertSANToPACN(String move)
Converts a move legal in the current position from Standard Algebraic Notation to Pure Algebraic Coordinate Notation.
|
void |
drawByAgreement()
Sets the game state to draw by agreement from both parties.
|
double |
eval(Map<String,Double> gradientCache)
Statically evaluates the current position and records the gradient of the evaluation function w.r.t.
|
String |
getAuthor()
Returns the name of the author of the engine.
|
DebugInformation |
getDebugInfo()
Returns an observable object containing information that is not related to the game but can help detecting bugs in debug mode.
|
GameState |
getGameState()
Returns the current game state as labelled by
GameState . |
short |
getHashLoadPermill()
Returns the load factor of the hash tables in permills.
|
List<String> |
getLegalMoves()
Returns a list of all legal moves in the current position in Pure Algebraic Coordinate Notation.
|
List<String> |
getMoveHistory()
Returns a list of all past moves made on the board in Pure Algebraic Coordinate Notation in chronological order.
|
String |
getName()
Returns the name of the engine.
|
Map<Option<?>,Object> |
getOptions()
Returns the options the engine offers and their values.
|
EngineParameters |
getParameters()
Returns the parameters which are used by the engine to control search, evaluation, and other aspects of game play.
|
SearchInformation |
getSearchInfo()
Returns an observable object containing information about the results and statistics of the ongoing/last search.
|
String |
getStartPosition()
Returns the starting position of the current game in Forsyth-Edwards Notation.
|
void |
init()
Initialises the engine; e.g.
|
boolean |
isInit()
Returns whether the method
init has already been called on the instance. |
boolean |
isQuiet()
Determines whether the current position is quiet, i.e.
|
boolean |
isWhitesTurn()
Returns whether it's white's turn.
|
void |
newGame()
Resets the game.
|
void |
notifyParametersChanged()
Notifies the engine that the parameters have changed and that if it uses cached values, it should reload them.
|
long |
perft(int depth)
Runs a perft to the specified depth in the current position and returns the number of leaf nodes counted while traversing the tree.
|
boolean |
play(String pacn)
Prompts the engine to make the move defined in Pure Algebraic Coordinate Notation.
|
void |
ponderHit()
Signals to the engine that the move it was pondering on was actually played and it should keep searching in normal mode.
|
void |
quit()
Signals the engine that it should clean up and free the resources it has been using.
|
SearchResults |
search(Set<String> searchMoves,
Boolean ponder,
Long whiteTime,
Long blackTime,
Long whiteIncrement,
Long blackIncrement,
Integer movesToGo,
Integer depth,
Long nodes,
Integer mateDistance,
Long searchTime,
Boolean infinite)
Prompts the engine to start searching the current position according to the specified parameters.
|
void |
setControllerMode(boolean on)
Sets whether the engine should run in controller mode.
|
void |
setDebugMode(boolean on)
Notifies the engine whether it should keep updating the
DebugInformation instance exposed by
the getDebugInfo method with debug information strings. |
void |
setDeterministicEvaluationMode(boolean on)
Sets whether the engine should support deterministic static evaluation without the use of hash tables or any other mechanisms that
introduce non-determinism.
|
void |
setEvent(String event)
Sets the event at which the game is taking place.
|
boolean |
setGame(String pgn)
Parses the Portable Game Notation string and sets its internal data structure tracking the state of the game accordingly.
|
<T> boolean |
setOption(Option<T> setting,
T value)
Sets an option defined by the engine to the specified value.
|
void |
setPlayers(String whitePlayer,
String blackPlayer)
Sets the names of the players.
|
boolean |
setPosition(String fen)
Sends the current position to the engine.
|
void |
setSite(String site)
Sets the site where the game is taking place.
|
void |
stop()
Prompts the engine to stop searching and return the best move found up until that point.
|
String |
toFEN()
Returns a Forsyth-Edwards Notation string representing the current position.
|
String |
toPGN()
Returns a Portable Game Notation string representing the state of the game.
|
String |
unplayLastMove()
Takes back the last move and returns it in Pure Algebraic Coordinate Notation.
|
void |
whiteForfeit()
Sets the game state to unspecified black victory.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
divide
isGradientDefined
close, setHashSizeOption, setOption, setOwnBookOption, setPosition, setThreadsOption
public void init() throws Exception
UCIEngine
public boolean isInit()
UCIEngine
init
has already been called on the instance.public String getName()
UCIEngine
public String getAuthor()
UCIEngine
public Map<Option<?>,Object> getOptions()
UCIEngine
getOptions
in interface UCIEngine
public <T> boolean setOption(Option<T> setting, T value)
UCIEngine
setOption
in interface UCIEngine
T
- The type of the value the option holds.setting
- The UCI option to set.value
- The value to which the option should be set.public void setDebugMode(boolean on)
UCIEngine
DebugInformation
instance exposed by
the getDebugInfo
method with debug information strings.setDebugMode
in interface UCIEngine
on
- Whether the engine should run in debug mode.public void newGame()
UCIEngine
public boolean setPosition(String fen)
UCIEngine
setPosition
in interface UCIEngine
fen
- The current position in FEN.public boolean play(String pacn)
UCIEngine
public SearchResults search(Set<String> searchMoves, Boolean ponder, Long whiteTime, Long blackTime, Long whiteIncrement, Long blackIncrement, Integer movesToGo, Integer depth, Long nodes, Integer mateDistance, Long searchTime, Boolean infinite)
UCIEngine
search
in interface UCIEngine
searchMoves
- A set of the moves to search at the root node in pure algebraic coordinate notation.ponder
- Whether the engine should search in pondering mode.whiteTime
- The time left on the clock for white in ms.blackTime
- The time left on the clock for black in ms.whiteIncrement
- Increment per move in ms.blackIncrement
- Increment per move in ms.movesToGo
- The number of moves until the next time control.depth
- The depth to which the position should be searched. If it is 0, the engine should return the score determined by the
quiescence search or if it is not implemented, the static evaluation score.nodes
- The maximum number of nodes that should be searched.mateDistance
- Search for a mate in x.searchTime
- Search exactly this number of ms.infinite
- Whether the position should be searched infinitely.public void stop()
UCIEngine
search
method to terminate within a few milliseconds
at most. If the engine is not searching at the time of the call, it should be ignored. It should block until the search is finished.public void ponderHit()
UCIEngine
public SearchInformation getSearchInfo()
UCIEngine
getSearchInfo
in interface UCIEngine
public short getHashLoadPermill()
UCIEngine
getHashLoadPermill
in interface UCIEngine
public DebugInformation getDebugInfo()
UCIEngine
getDebugInfo
in interface UCIEngine
public void quit()
UCIEngine
public boolean isWhitesTurn()
ControllerEngine
isWhitesTurn
in interface ControllerEngine
public String getStartPosition()
ControllerEngine
getStartPosition
in interface ControllerEngine
public GameState getGameState()
ControllerEngine
GameState
.getGameState
in interface ControllerEngine
public List<String> getMoveHistory()
ControllerEngine
getMoveHistory
in interface ControllerEngine
public List<String> getLegalMoves()
ControllerEngine
getLegalMoves
in interface ControllerEngine
public boolean isQuiet()
ControllerEngine
isQuiet
in interface ControllerEngine
public boolean setGame(String pgn)
ControllerEngine
setGame
in interface ControllerEngine
pgn
- A PGN string representation of a chess game.public void setPlayers(String whitePlayer, String blackPlayer)
ControllerEngine
setPlayers
in interface ControllerEngine
whitePlayer
- The name of the white player.blackPlayer
- The name of the black player.public void setEvent(String event)
ControllerEngine
setEvent
in interface ControllerEngine
event
- The event at which the game is taking place.public void setSite(String site)
ControllerEngine
setSite
in interface ControllerEngine
site
- The site where the game is taking place.public void setControllerMode(boolean on)
ControllerEngine
setControllerMode
in interface ControllerEngine
on
- Whether the engine should run in controller mode.public void drawByAgreement()
ControllerEngine
drawByAgreement
in interface ControllerEngine
public void whiteForfeit()
ControllerEngine
whiteForfeit
in interface ControllerEngine
public void blackForfeit()
ControllerEngine
blackForfeit
in interface ControllerEngine
public String unplayLastMove()
ControllerEngine
unplayLastMove
in interface ControllerEngine
public String convertPACNToSAN(String move)
ControllerEngine
convertPACNToSAN
in interface ControllerEngine
move
- The move in PACN.public String convertSANToPACN(String move)
ControllerEngine
convertSANToPACN
in interface ControllerEngine
move
- The move in SAN.public String toPGN()
ControllerEngine
toPGN
in interface ControllerEngine
public String toFEN()
ControllerEngine
toFEN
in interface ControllerEngine
public long perft(int depth)
ControllerEngine
perft
in interface ControllerEngine
depth
- The depth at which the leaf nodes are to be counted.public EngineParameters getParameters()
TunableEngine
getParameters
in interface TunableEngine
public void notifyParametersChanged()
TunableEngine
notifyParametersChanged
in interface TunableEngine
public void setDeterministicEvaluationMode(boolean on)
TunableEngine
setDeterministicEvaluationMode
in interface TunableEngine
on
- Whether the engine should support deterministic evaluation mode.public double eval(Map<String,Double> gradientCache)
TunableEngine
eval
in interface TunableEngine
gradientCache
- A map for recording the partial derivatives of the objective evaluation function (where a positive output means
white is in the lead and negative output means black is in the lead) with respect to the static evaluation parameters. The key
should be the name of the parameter and the value should be the derivative. It can be null if the calculation of the gradient is not
needed or if TunableEngine.isGradientDefined()
returns false.Copyright © 2020. All rights reserved.