From 7038797ff279b9f3ce7d196d86f45f6e579a39fe Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 8 Jun 2016 21:01:18 +0200 Subject: [PATCH 1/6] specs en --- src/arenas/connectFour/doc-en.html | 98 +++++++++++++++++++----------- src/arenas/connectFour/doc-fr.html | 4 +- 2 files changed, 66 insertions(+), 36 deletions(-) diff --git a/src/arenas/connectFour/doc-en.html b/src/arenas/connectFour/doc-en.html index 27c1c55..2dfcc60 100644 --- a/src/arenas/connectFour/doc-en.html +++ b/src/arenas/connectFour/doc-en.html @@ -1,37 +1,46 @@ -

Functioning of duels for battle four

-

Your program does not have to manage a whole part of noughts and crosses, just one lap

-

Connect four's wire rack

+

Functioning of duels for connect four

+

The board

-

-

Request Arena -> your bot

-

The arbitrator program (the arena) build a request with POST parameters as follow :

+

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":"connectFour","players":2,"board":"","player-index":0}
+

Explanation of each parameters:

+ +

Your bot should return his name JSON format:

+
+  {"name":"botName"}
+  
- - - - - - - - - - - - -
namevalue
game - String, always "connectFour".
- Can be usefull if you use the same URL for play to others games. -
match_id -String. Match the following regular expression : ^[0-9]+-(1|2)$
-The first number (digits before the hyphen) identified the game.
-The number after the hyphen indicates whether you are the first or second bot in the order to play.
-It will serve you if your AI makes statistics on games. -
youyour symbol in the grid
gridString, representing an array in JSON format. this is the wire.
- the first seven values are the bottom horizontal line.
- Exemple:
+

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":"9916","action":"play-turn","game":"connectFour","players":2,"board":[["","","","","","",""],["","","","","","",""],["","","","","","",""],["","","","","","",""],["","","","","","",""],["","","","","","",""]],"you":"X","player-index":0}
+
    +
  • game-id String identifying the party.
  • +
  • action String identifying the phase, play-turn now, you have to play.
  • +
  • game String identifying the game. Always "tictactoe".
  • +
  • players Int indicating the number of players in the game, still 2 on connect Four.
  • +
  • board The map, i'll explain it at next chapter
  • +
  • you String, Your bot's character on the grid
  • +
  • player-index Int The order of your bot in turns. The first player is 0, second is 2.
  • +
+

The map

+

It is represented by a sub-array, on the "board" parameter.
Exemple:

   [["","","","X","0","",""],
    ["","","","X","","",""],
@@ -40,9 +49,30 @@ It will serve you if your AI makes statistics on games.
    ["","","","","","",""],
    ["","","","","","",""]]
   
+

Visually, the connect 4 's plate is reversed. The line with index zero (top in the above excerpt) represents the bottom line.

+

Your bot response

-
+

JSON format, Only one digit that indicate column you want to play. 0 to 6.

+
+{"play":"3"}
+
+

For play in column three.
-

what return your bot

-

only one char: 0,1,2,3,4,5 or 6 that indicates the column you want to play

+Obviously the arena respects Newton's laws and place your pawn in the first free space of the column ( starting at index 0 )

+ + +

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.

diff --git a/src/arenas/connectFour/doc-fr.html b/src/arenas/connectFour/doc-fr.html index b186055..4f3f71d 100644 --- a/src/arenas/connectFour/doc-fr.html +++ b/src/arenas/connectFour/doc-fr.html @@ -4,7 +4,7 @@
  • largeur: 7 cases
  • hauteur: 6 cases
  • -

    +

    Communications entre l'arène et votre bot

    Pour communiquer, l'arène (le serveur hébergeant botsarena) fait des requetes http(s) de type POST vers les bots. Le message est dans le corps de la requête au format JSON.

    @@ -42,7 +42,7 @@

    la map

    Elle est contenue dans le champs board du message JSON.C'est un tableau à deux dimmensions au format JSON vous indiquant l'état de la grille.
    - Exemple:
    + Exemple:

       [["","","","X","0","",""],
        ["","","","X","","",""],
    
    From 32b5bb58ef248e5272b0e00e1cf59c09f83bdec8 Mon Sep 17 00:00:00 2001
    From: gnieark 
    Date: Wed, 8 Jun 2016 21:02:39 +0200
    Subject: [PATCH 2/6] specs en
    
    ---
     src/arenas/connectFour/doc-en.html | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/arenas/connectFour/doc-en.html b/src/arenas/connectFour/doc-en.html
    index 2dfcc60..9002ee6 100644
    --- a/src/arenas/connectFour/doc-en.html
    +++ b/src/arenas/connectFour/doc-en.html
    @@ -33,7 +33,7 @@
        
    • game-id String identifying the party.
    • action String identifying the phase, play-turn now, you have to play.
    • -
    • game String identifying the game. Always "tictactoe".
    • +
    • game String identifying the game. Always "connectFour".
    • players Int indicating the number of players in the game, still 2 on connect Four.
    • board The map, i'll explain it at next chapter
    • you String, Your bot's character on the grid
    • From 86625e9ab4d5dba4f563a3b39875517cc0353a65 Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 8 Jun 2016 21:07:29 +0200 Subject: [PATCH 3/6] specs en --- src/arenas/connectFour/doc-en.html | 10 +++++----- src/arenas/tictactoe/doc-en.html | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/arenas/connectFour/doc-en.html b/src/arenas/connectFour/doc-en.html index 9002ee6..73497e4 100644 --- a/src/arenas/connectFour/doc-en.html +++ b/src/arenas/connectFour/doc-en.html @@ -62,14 +62,14 @@ Obviously the arena respects Newton's laws and place your pawn in the first free

      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 .

      +

      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: -

      • You add to your bot headers than allow for CORS field.
      • +

        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:

        +
        • You add to your bot headers that allow cross POST queries.
        • More simple, you download the page (right click, save target as) and put it in your bot VHOST time tests. All the code (html, css and javascript) is included in the page without external resource, in order that it can be easily downloaded and used.
        • -
        • You use a web browser that supports JavaScript and allows cross domain queries. It seems possible . +
        • You use a web browser that supports JavaScript and allows cross domain queries. It seems possible .

        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

        diff --git a/src/arenas/tictactoe/doc-en.html b/src/arenas/tictactoe/doc-en.html index 55a9bcd..d7e0552 100644 --- a/src/arenas/tictactoe/doc-en.html +++ b/src/arenas/tictactoe/doc-en.html @@ -3,7 +3,7 @@ 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

        @@ -170,14 +170,14 @@ 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 .

    +

    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: -

    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

    +

    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: From 9d5aded97d5df57ad1b48b62a6cd6aac9be79988 Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 8 Jun 2016 21:11:13 +0200 Subject: [PATCH 6/6] acheteumeuleu --- src/arenas/connectFour/doc-en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/connectFour/doc-en.html b/src/arenas/connectFour/doc-en.html index 9c2531f..e5cc429 100644 --- a/src/arenas/connectFour/doc-en.html +++ b/src/arenas/connectFour/doc-en.html @@ -7,7 +7,7 @@

    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

    +

    Your bot responds with a JSON array.

    Message initating the game

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