public class UCIClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
UCIClient.State
Possible engine states
|
Constructor and Description |
---|
UCIClient(java.lang.Process service,
Board start,
Game game)
Instantiates a new client object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthor()
Returns the current engine author name.
|
int |
getBestMove()
Returns the last received best move.
|
Board |
getBoard()
Returns a board representation of the current game state.
|
java.lang.String |
getName()
Returns the current engine name.
|
int |
getPonderMove()
Returns the last received ponder move.
|
java.lang.Process |
getService()
Returns the engine process associated with this client.
|
UCIClient.State |
getState()
Returns the current engine state.
|
boolean |
hasTimeLimit()
Returns if the current engine is not thinking in infinite mode.
|
boolean |
isDebugOn()
Returns the current engine debug mode.
|
boolean |
isPondering()
Returns true if the engine is in a pondering state.
|
boolean |
isReady()
Returns true whenever the engine is ready to receive new commands.
|
boolean |
isRunning()
Returns if the engine process is running.
|
boolean |
isThinking()
Returns true if the engine is in a thinking state.
|
boolean |
isUCIReady()
This method returns true whenever the engine is ready to receive
commands in UCI mode.
|
java.lang.String |
receive()
Receives and evaluates the next engine-to-client command.
|
void |
send(java.lang.String message)
Evaluates and sends a single client-to-engine command.
|
public UCIClient(java.lang.Process service, Board start, Game game)
service
- An engine processstart
- Start board positiongame
- A game objectpublic java.lang.Process getService()
public Board getBoard()
public UCIClient.State getState()
public int getBestMove()
Game.NULL_MOVE
if no move has been received yetpublic int getPonderMove()
Game.NULL_MOVE
if no move has been received yetpublic java.lang.String getName()
public java.lang.String getAuthor()
public boolean isDebugOn()
true
if debug is onpublic boolean hasTimeLimit()
false
when a 'stop' command is
sent to the engine or a 'bestmove' command is received. If the
engine is not thinking this method always returns true
.false
if infinite mode is onpublic boolean isThinking()
THINKING
.true
if the engine is thinkingpublic boolean isPondering()
PONDERING
.true
if the engine is thinkingpublic boolean isRunning()
STOPPED
.true
if the engine process is runningpublic boolean isReady()
false
when an 'isready' command
is sent to the engine, and is reset to true
after a
'readyok' message is received. When the engine state is
STOPPED
this method always returns false
.true
if the engine is readypublic boolean isUCIReady()
false
when
an 'uci' command is sent to the engine, and is reset to true
after a 'uciok' message is received. When the engine state is
STOPPED
this method always returns false
.true
if the engine supports the UCI protocol
and is ready to receive commandspublic void send(java.lang.String message) throws java.lang.Exception
message
- command stringjava.lang.Exception
- if the evaluation did not succeedpublic java.lang.String receive() throws java.lang.Exception
java.lang.Exception
- if the evaluation did not succeed