diff --git a/src/arenas/Battleship/doc-en.html b/src/arenas/Battleship/doc-en.html index 0c26435..545cb32 100644 --- a/src/arenas/Battleship/doc-en.html +++ b/src/arenas/Battleship/doc-en.html @@ -1,173 +1,62 @@ -

- Battleship is played in two stages : -

+

Fonctionnement de la bataille navale

+

Elle se joue en deux phases

-

- At each turn, the arena made HTTP(s) queries containing POST parameters, to your bots.
- They must respond to the specifications below. -

-

Descriptif des paramètres envoyés par l'arène

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescription
game - String, will always "Battleship".
- Can be used if your url is used for several 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. -
act - Can take two values :
-
    -
  • "init" : We start the game, you must place your ships
  • -
  • "fight" : You send a shot
  • -
-
opponent - String identifying your opponent.
- So you can grow up delirium by developping an algorithm that adapts depending on the opponent and the history of fighting with it. -
widthInteger, between 1 and 100, inclusive, indicates the width of the map.
heightInteger, between 1 and 100, inclusive, indicates the height of the map.
ship1Integer, between 0 and 10, inclusive, indicates the number of boats with length of 1 box to set.
ship2Integer, between 0 and 10, inclusive, indicates the number of boats with length of 2 box to set.
......
ship6Integer, between 0 and 10, inclusive, indicates the number of boats with length of 6 box to set.
your_strikes -

- String, representing an array in JSON format.
- This parameter is only sent when the game is in shooting phase (act=fight).
- It tells you the shots you've already made and their results.
- In the first round of play, it is an empty array. -

-

- [ ] -

-

- In the second round of game, it contains the previous shot and the result : -

-

- [{"target":"2,0","result":""}] -

-

- In the third round of play, the two previous shots : -

-

- [{"target":"2,0","result":"hit"},{"target":"5,1","result":"hit"}] -

-

- Each shot is a sub array for which : -

-
    -
  • The index target indicates the coordinates of the target shooting x,y
  • -
  • - result may be : -
      -
    • Empty "" means that the shot did not hit anything
    • -
    • "hit" An enemy ship has been hit
    • -
    • "hit and sunk" An enemy ship was hit and sunk
    • -
    -
  • -
-
his_strikesSame except that this is the shot of the opponent.
-

What must return your bot

-

During initialization of the game

-

- Lors de l'initialisation d'une partie StupidIA VS StupidsIA, l'arène a envoyé au bot les parametres POST suivants : - During initialization of part StupidIA VS StupidIA, the arena send to your bot the following parameters in POST : -

-
-    game=Battleship&match_id=828-1&act=init&opponent=stupidIA&width=10&height=10&ship1=0&ship2=1&ship3=2&ship4=1&ship5=1&ship6=0
-
-

- Or, more readable : -

-
-    [game] => Battleship
-    [match_id] => 828-1
-    [act] => init
-    [opponent] => stupidIA
-    [width] => 10
-    [height] => 10
-    [ship1] => 0
-    [ship2] => 1
-    [ship3] => 2
-    [ship4] => 1
-    [ship5] => 1
-    [ship6] => 0
-
-

- The HTTP page that must generate your bot contains the position of ships. -

-

- You return a character string that is a JSON array with as many records as ships.
- Each ship is defined by the coordinates of its ends. -

+

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.

+

Votre bot répond par un array au format JSON.

+

Message d'initialisation de votre partie

+ l'arène envoie le message suivant: +
{"game-id":1609,"game":"battleship","action":"init","players":2,"player-index":0,"board":{"opponent":"stupidIA","width":"10","height":"10","ship1":"0","ship2":"1","ship3":"2","ship4":"1","ship5":"1","ship6":"0"}}
+

Si on décompose le tableau pour l'expliquer:

+ +

Votre bot doit retourner le nom de votre bot et le placement de vos bateaux au format JSON:

+
+  {"name":"gnieark","boats":["4,2-4,6","3,3-3,0","2,3-2,1","7,9-5,9","6,8-6,7"]}
+  
+ -

Placement example of 5 boats with respective sizes 5, 4, 3, 3, 2 boxes :

+

Exemple de placement de 5 bateaux tailles respectives 5, 4, 3, 3, 2 cases :

     ["3,3-3,7","2,1-2,4","0,1-0,3","7,3-7,1","8,8-7,8"]
 

- Of course if your boat overlap, or if their number and length does not match the demand of the arena, you lose the game. + Bien évidemment si vos bateaux se chevauchent, ou si leur nombre et leur longueur ne correspond pas à la demande de l'arène, vous perdez la partie.

- The order of the boats does not matter.
- Similarly, for a boat, the order of its points does not matter either. + L'ordre des bateaux n'a pas d'importance.
+ De la même manière, pour un bateau, l'ordre de ses points n'importe pas non plus.

- Seen on the grid, the example above would be : + Vu sur la grille, l'exemple précédent donnerait :

@@ -314,65 +203,70 @@
-

During the fight

-

- Examples of parameters sent by the arena. -

-

First round (your_strikes and his_strikes are empty)

-
-    [game] => Battleship
-    [match_id] => 834-1
-    [act] => fight
-    [opponent] => stupidIA
-    [width] => 10
-    [height] => 10
-    [ship1] => 0
-    [ship2] => 1
-    [ship3] => 2
-    [ship4] => 1
-    [ship5] => 1
-    [ship6] => 0
-    [your_strikes] => []
-    [his_strikes] => []
-
-

Second round

-
-    [game] => Battleship
-    [match_id] => 834-1
-    [act] => fight
-    [opponent] => stupidIA
-    [width] => 10
-    [height] => 10
-    [ship1] => 0
-    [ship2] => 1
-    [ship3] => 2
-    [ship4] => 1
-    [ship5] => 1
-    [ship6] => 0
-    [your_strikes] => [{"target":"4,6","result":""}]
-    [his_strikes] => [{"target":"7,8","result":""}]
-
-

Third round

-
-    [game] => Battleship
-    [match_id] => 834-1
-    [act] => fight
-    [opponent] => stupidIA
-    [width] => 10
-    [height] => 10
-    [ship1] => 0
-    [ship2] => 1
-    [ship3] => 2
-    [ship4] => 1
-    [ship5] => 1
-    [ship6] => 0
-    [your_strikes] => [{"target":"4,6","result":""},{"target":"3,9","result":"hit"}]
-    [his_strikes] => [{"target":"7,8","result":""},{"target":"7,8","result":""}]
-
-

You simply need to return the address of the box where you want to shoot in the form of x,y

-
-    6,9
-
-

- To shoot on the coordinates x=6 y=9 -

\ No newline at end of file + +

Message vous demandant de jouer (seulement un tour)

+

L'arène vous envoie par exemple le message suivant:

+
{"game":"Battleship","game-id":1615,"action":"play-turn","player-index":1,"board":{"opponent":"stupidIA","width":"10","height":"10","ship1":"0","ship2":"1","ship3":"2","ship4":"1","ship5":"1","ship6":"0","your_strikes":[{"target":"4,3","result":""},{"target":"9,8","result":""}],"his_strikes":[{"target":"2,2","result":""},{"target":"0,6","result":""},{"target":"7,0","result":""}]}}
+ +

la map

+

Elle est représentée par les éléments d'écrits à l'étape précédente et par deux sous tableaux your_strikes et his strikes

+ +

your_strikes et his_strikes

+ +

Chaîne de caractères représentant un array au format JSON.
+ Ce parametre n'est envoyé que lors de la phase de tirs du jeu (act=fight).
+ Il vous indique les tirs que vous avez déjà effectués et leur résultats.
+ Lors du premier tour de jeu, il représente un array vide: +

+
[ ]
+

+ Lors du deuxième tour de jeu, il contient le tir précédent et son résultat : +

+
[{"target":"2,0","result":""}]
+

+ Lors du troisième tour de jeu, les deux tirs précédents : +

+
[{"target":"2,0","result":"hit"},{"target":"5,1","result":"hit"}]
+

+ Chaque tir est un sous array pour lesquels: +

+ + +

Réponse de votre bot

+

Il doit répondre par les coordonnées de la case dans laquelle il souhaite effectuer un tir.

+
{"play":"1,8"}
+

x,y

+

Outils pour développer et tester votre bot

+ +

Script Botsarena en cours de développement

+

Faire entrer votre bot dans cette arène

+

Le formulaire d'inscription de votre bot est sur la page d'accueil du site.

\ No newline at end of file