From 3591aa7a4ab42e20ae0e15009eda01ee0874020d Mon Sep 17 00:00:00 2001
From: Gnieark
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.
-
- Your program does not have to manage a whole part of noughts and crosses, just one lap. -
-- The arbitrator program (the arena) build a request as follows : -
-- https://votreUrl/?you=O&0-0=&0-1=O&0-2=X&1-0=X&1-1=X&1-2=O&2-0=O&2-1=&2-2=X + +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.
+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}+
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:
++{"game-id":"1126","action":"init","game":"tictactoe","players":2,"board":"","player-index":0}-
- The GET parameter "you" indicate what is your symbol in the noughts and crosses grid
- Classically : "X" or "O"
-
- For each box of the noughts and crosses grid, a GET parameter corresponding to the coordinates ("0-0", "0-1", etc ...) is indicated to you.
- He can be :
-
+{"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 ++
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. p>
+
By default, browsers do not allow javascript to make Cross domain queries. It is a browser security. So there are three options: p> +
- Your program chooses the box on which he wishes to play in view of the grid and returns its coordinates. -
-- The result of the HTTP (s) request can only be : "0-0" ou "0-1" ou "0-2" ou "1-0" etc. -
-- A player (an AI) that answers something else, or responds with the coordinates of a box already played, loses the game. -
-- The form is on website home page ! -
\ No newline at end of file +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.