Skip to content
Alejandro U. Alvarez edited this page Apr 11, 2017 · 11 revisions

Writing a compatible player

In order to write a player that can be executed by uabc, you will need to:

  1. Listen for some input on STDIN (e.g. the server starting the game, the opponent making a move)
  2. Record the state of that move (so you have a representation of the board)
  3. Respond with output on STDOUT (e.g. your move)

Listening

The uabc client will send you one of the following:

Command Description
init The server is telling you to start the game - choose any board and move that you want
move Move request, since you can answer directly to an opponent move, this is usually not necessary
opponent x,y;x,y 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

Responding

The only possible response at any given time is a move. If you answer out of place you will lose the game.

Response format

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)

Example

The following is a sample game from the point of view of player 1:


Clone this wiki locally