Specifications Tic Tac Toe

Functioning of duels for noughts and crosses

Do not trust the animated GIF of the site's home page.
It's the illustration of the overall operation of the arena, but it is wrong : the tictactoe only needs to send 10 variables to the bots.
The choice was therefore made to pass them by GET parameters and not by POST as shown in the animation.

requests from BotsArena to your bot

To talk, botsarena (the server hosting botsarena) execute a POST request on your bot's http(s) server with the json as body

Your bot responds with a JSON array

Message initating the game

BotsArena sends:
{"game-id":"1126","action":"init","game":"tictactoe","players":2,"board":"","player-index":0}

Explanation of each parameters:

Your bot should return his name JSON format:

  {"name":"botName"}
  

The arena currently does not check this response, the init step was included to ensure compatibility with Bolosseum . If your bot returns a blank page at this step (action = init), it will work.

Message asking you to play (only one turn)

The Arena sends as example the following message:

{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"","0-1":"","0-2":"","1-0":"","1-1":"","1-2":"","2-0":"","2-1":"","2-2":""},"you":"X","player-index":0}

The map

It is represented by a sub-array. The index corresponds to x-y coordinates of the box. x and y are between 0 and 2. Vaues can be:

Exemple de partie

{"game-id":"1126","action":"init","game":"tictactoe","players":2,"board":"","player-index":0}
{"name":"moul-tictactoe"}
{"game-id":"1126","action":"init","game":"tictactoe","players":2,"board":"","player-index":1}
{"name":"moul-tictactoe"}
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"","0-1":"","0-2":"","1-0":"","1-1":"","1-2":"","2-0":"","2-1":"","2-2":""},"you":"X","player-index":0}
{"play":"0-1"}
Player 1 played at 0-1 new grid is:
X
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"","0-1":"X","0-2":"","1-0":"","1-1":"","1-2":"","2-0":"","2-1":"","2-2":""},"you":"O","player-index":1}
{"play":"1-1"}
Player 2 played at 1-1 new grid is
X
O
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"","0-1":"X","0-2":"","1-0":"","1-1":"O","1-2":"","2-0":"","2-1":"","2-2":""},"you":"X","player-index":0}
{"play":"0-0"}
Player 1 played at 0-0 new grid is
X X
O
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"X","0-1":"X","0-2":"","1-0":"","1-1":"O","1-2":"","2-0":"","2-1":"","2-2":""},"you":"O","player-index":1}
{"play":"0-2"}
Player 2 played at 0-2 new grid is
X X O
O
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"X","0-1":"X","0-2":"O","1-0":"","1-1":"O","1-2":"","2-0":"","2-1":"","2-2":""},"you":"X","player-index":0}
{"play":"2-0"}
Player 1 played at 2-0 new grid is
X X O
O
X
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"X","0-1":"X","0-2":"O","1-0":"","1-1":"O","1-2":"","2-0":"X","2-1":"","2-2":""},"you":"O","player-index":1}
{"play":"1-0"}
Player 2 played at 1-0 new grid is
X X O
O O
X
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"X","0-1":"X","0-2":"O","1-0":"O","1-1":"O","1-2":"","2-0":"X","2-1":"","2-2":""},"you":"X","player-index":0}
{"play":"1-2"}
Player 1 played at 1-2 new grid is
X X O
O O X
X
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"X","0-1":"X","0-2":"O","1-0":"O","1-1":"O","1-2":"X","2-0":"X","2-1":"","2-2":""},"you":"O","player-index":1}
{"play":"2-1"}
Player 2 played at 2-1 new grid is
X X O
O O X
X O
{"game-id":"1126","action":"play-turn","game":"tictactoe","players":2,"board":{"0-0":"X","0-1":"X","0-2":"O","1-0":"O","1-1":"O","1-2":"X","2-0":"X","2-1":"O","2-2":""},"you":"X","player-index":0}
{"play":"2-2"}
Player 1 played at 2-2 new grid is
X X O
O O X
X O X

DRAW

Tools for developing and testing your bot

To help you on how to manage communications between the bot and the arena, please take a look in the source PHP stupidIA .

Script Botsarena

This small html + javascript page will allow you to test and debug on your bot.
It will allow you to test your boot via its URL, against himself, a human or stupidIA.
Once ready, Express Sign your bot in the arena.

By default, browsers do not allow javascript to make Cross domain queries. It is a browser security. So there are three options:

This problem does not arise at the arena once your bot will be registered. Because in that case, it is the requests to the bot, not a browser.

Bolosseum

You will find command line tools to test and debug your bot on github project Bolosseum of @moul.

Bringing your bot in this arena

The registration form your bot is on the site's home page.