public abstract class GtpClientBase
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
m_name |
Constructor and Description |
---|
GtpClientBase() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Close output connection.
|
java.lang.String |
getCommandBoardsize(int size)
Get command for setting the board size.
|
java.lang.String |
getCommandClearBoard(int size)
Get command for starting a new game.
|
java.lang.String |
getCommandGenmove(GoColor color)
Get command for generating a move.
|
java.lang.String |
getCommandPlay(Move move)
Get command for playing a move.
|
double |
getCpuTime()
Send cputime command and convert the result to double.
|
java.lang.String |
getLabel()
Get program name or "Unknown Program" if unknown.
|
java.lang.String |
getName()
Get program name.
|
int |
getProtocolVersion()
Get protocol version.
|
java.util.ArrayList<java.lang.String> |
getSupportedCommands()
Get the supported commands.
|
boolean |
isCpuTimeSupported()
Check if cputime command is supported.
|
boolean |
isGenmoveSupported()
Check if a genmove command is supported.
|
boolean |
isInterruptSupported()
Check if interrupting a command is supported.
|
boolean |
isProgramDead()
Is the program in a state, that all subsequent commands will fail.
|
boolean |
isSupported(java.lang.String command)
Check if a command is supported.
|
void |
queryInterruptSupport()
Query if interrupting is supported.
|
void |
queryName()
Queries the name.
|
void |
queryProtocolVersion()
Query the protocol version.
|
void |
querySupportedCommands()
Query the supported commands.
|
java.lang.String |
queryVersion()
Queries the program version.
|
abstract java.lang.String |
send(java.lang.String command)
Send a command.
|
void |
sendBoardsize(int size)
Send command for setting the board size.
|
void |
sendClearBoard(int size)
Send command for staring a new game.
|
abstract void |
sendComment(java.lang.String comment)
Send comment.
|
void |
sendInterrupt()
Interrupt current command.
|
void |
sendPlay(Move move)
Send command for playing a move.
|
void |
setLowerCase()
Enable lower case mode for play commands.
|
abstract void |
waitForExit()
Wait until the process of the program exits.
|
public abstract void close()
public java.lang.String getCommandBoardsize(int size)
public java.lang.String getCommandClearBoard(int size)
public java.lang.String getCommandGenmove(GoColor color)
color
- GoColor::BLACK or GoColor::WHITEpublic java.lang.String getCommandPlay(Move move)
public double getCpuTime() throws GtpError
GtpError
- if command fails or does not return a floating point
number.public java.lang.String getLabel()
public java.lang.String getName()
public int getProtocolVersion()
public java.util.ArrayList<java.lang.String> getSupportedCommands()
public boolean isProgramDead()
public boolean isSupported(java.lang.String command)
public boolean isCpuTimeSupported()
public boolean isGenmoveSupported()
public boolean isInterruptSupported()
public void queryInterruptSupport()
isInterruptSupported()
public void queryName()
getName()
public void queryProtocolVersion()
getProtocolVersion()
public void querySupportedCommands() throws GtpError
GtpError
getSupportedCommands()
,
isSupported(java.lang.String)
public java.lang.String queryVersion()
public abstract java.lang.String send(java.lang.String command) throws GtpError
GtpError
- containing the response if the command fails.public abstract void sendComment(java.lang.String comment)
comment
- comment line (must start with '#').public void sendBoardsize(int size) throws GtpError
GtpError
getCommandBoardsize(int)
public void sendClearBoard(int size) throws GtpError
GtpError
getCommandClearBoard(int)
public void sendPlay(Move move) throws GtpError
GtpError
public void sendInterrupt() throws GtpError
GtpError
- if interrupting commands is not supported.isInterruptSupported()
public void setLowerCase()
public abstract void waitForExit()