-
Notifications
You must be signed in to change notification settings - Fork 0
roach client docs
How you write your AI is up to you, but in order for roach-client to play games with it, you must implement a basic text-based interface. roach-client will run your AI as a script/executable indicated by a path argument, and your AI must accept input via stdin and provide output via stdout. To make moves on your AI's behalf, the roach-client uses a simple protocol:
- Whenever it's your AI's turn to move, roach-client will send a
GameString
(followed by a newline) to your program's stdin - roach-client will then wait for a
MoveString
(followed by a newline) on your program's stdout
Since each GameString
represents the state of an entire game, this protocol can (and should!) be considered stateless. In other words, for any input, your AI should evaluate that GameString
and simply provide the best next turn for whatever player is indicated. Of course, you can maintain state within your AI to help with performance, but be aware that at any time the next GameString
may represent a completely different game.
For example:
Base;InProgress;Black[1]
bG1
Base;InProgress;Black[2];bG1;wS1 /bG1
bG2 bG1-
Base;InProgress;Black[3];bG1;wS1 /bG1;bG2 bG1-;wG1 -wS1
bQ \bG2
Base;InProgress;White[1];bS1
wG1 -bS1
Here, the first three GameStrings
represent a single game in progress, where the AI is playing for black. However, the fourth GameString
is for a new game where the AI is white.