-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Alejandro U. Alvarez edited this page Apr 11, 2017
·
11 revisions
In order to write a player that can be executed by uabc, you will need to:
- Listen for some input on
STDIN
(e.g. the server starting the game, the opponent making a move) - Record the state of that move (so you have a representation of the board)
- Respond with output on
STDOUT
(e.g. your move)
The uabc client will send you one of the following:
Command | Expects response | Description |
---|---|---|
init |
No | The server is telling you to start the game - choose any board and move that you want |
waiting |
No | The server is telling you that the other player is not ready yet. |
move |
Yes | Move request, since you can answer directly to an opponent move, this is usually not necessary |
opponent x,y;x,y |
Yes | Sent after an opponent move, it contains their move data in the form board.x, board.y; move.x, move.y . After receiving this you can directly answer with your move |
The only possible response at any given time is a move. If you answer out of place you will lose the game.
x,y;x,y
- Where the first coordinates are the board, and the second are the move (board.x, board.y; move.x, move.y
)
The following is a sample game from the point of view of player 1 (the input/output identifiers were added for clarity)
[input] init
[input] waiting
[input] opponent 0,0;2,2
[output] 2,2;2,0
[input] opponent 2,0;2,0
[output] 2,0;2,1
[input] opponent 2,1;2,1
[output] 2,1;0,1
[input] opponent 0,1;1,0
[output] 1,0;1,1
[input] opponent 1,1;0,1
[output] 0,1;0,2
[input] opponent 0,2;1,2
[output] 1,2;1,1
[input] opponent 1,1;1,2
[output] 1,2;1,2
[input] opponent 1,2;2,1
[output] 2,1;1,2
[input] opponent 1,2;1,0
[output] 1,0;2,1
[input] opponent 2,1;2,0
[output] 2,0;1,2
[input] opponent 1,2;2,2
[output] 2,2;1,0
[input] opponent 1,0;1,0
[output] 1,0;2,2
[input] opponent 2,2;1,1
[output] 1,1;2,2
[input] opponent 2,2;1,2
[output] 1,2;0,0
[input] opponent 0,0;0,1
[output] 0,1;0,1
[input] opponent 0,1;1,2
[output] 1,2;0,1
[input] opponent 0,1;2,2
[output] 2,2;0,1
[input] opponent 0,1;2,1
[output] 2,1;1,1
[input] opponent 1,1;0,2
[output] 0,2;1,1
[input] opponent 1,1;1,1
[output] 1,1;2,0
[input] opponent 2,0;1,1
[output] 1,1;0,0
[input] opponent 0,0;1,2
[output] 1,2;0,2
[input] opponent 0,2;1,0
[output] 1,0;0,1
[input] opponent 0,1;2,0
[output] 2,0;0,1
[input] opponent 0,0;1,1
[output] 1,1;2,1