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.
{"game-id":"1126","action":"init","game":"connectfour","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.
The Arena sends as example the following message:
{"game-id":"9916","action":"play-turn","game":"connectfour","players":2,"board":[["","","","","","",""],["","","","","","",""],["","","","","","",""],["","","","","","",""],["","","","","","",""],["","","","","","",""]],"you":"X","player-index":0}
It is represented by a sub-array, on the "board" parameter.
Exemple:
[["","","","X","0","",""], ["","","","X","","",""], ["","","","","","",""], ["","","","","","",""], ["","","","","","",""], ["","","","","","",""]]
Visually, the connect 4 's plate is reversed. The line with index zero (top in the above excerpt) represents the bottom line.
JSON format, Only one digit that indicate column you want to play. 0 to 6.
{"play":"3"}
For play in column three.
Obviously the arena respects Newton's laws and place your pawn in the first free space of the column ( starting at index 0 )
To help you on how to manage communications between the bot and the arena, please take a look in the source PHP stupidIA .
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.
You will find command line tools to test and debug your bot on github project Bolosseum of @moul.
The registration form your bot is on the site's home page.