A simple BATTLESHIP version

Clone this repo:

Branches

  1. 67d9973 chore: minor changes by Dw · 9 years ago master
  2. 433e35e doc: reformatting documentation by Dw · 9 years ago
  3. 02c16db chore: minor changes by Dw · 9 years ago
  4. a079fb1 refacto: from let if to if-let by Dw · 9 years ago
  5. 1d59202 refacto: renaming variables and functions by Dw · 9 years ago
______       _   _   _           _     _
| ___ \     | | | | | |         | |   (_)
| |_/ / __ _| |_| |_| | ___  ___| |__  _ _ __
| ___ \/ _` | __| __| |/ _ \/ __| '_ \| | '_ \
| |_/ / (_| | |_| |_| |  __/\__ \ | | | | |_) |
\____/ \__,_|\__|\__|_|\___||___/_| |_|_| .__/
                                        | |      ______ ______ ______
                                        |_|     |______|______|______|

Battleship

What it is about?

This game targets all developers, no matter the language they use. The idea behind is to make each developer write small programs and get challenged against other developers.

Game principle

It's a contest game. To win, players must shoot as much enemies as they can. NB: They are not shooting each others !!!

How to play

To play this game you must know about:

Game architecture

The Battleship game is based on a REST client-server architecture. The server side is already developed and hosts the game logic. It is available at this url: http://battleship.dwlo.cloudbees.net. So all your requests will address that server.

The REST API

This part is at your charge. You have to code your own REST client using the following APIs:

Start a new game play

This request is made once per game play and shared with other players as game identifier.

  1. Method : POST

  2. URI : /games

  3. RESPONSE :

    {
        "game-id": "32060218-5c1b-4b00-8b11-be49b1479c89"
    }
    

Fire on the enemy

  1. Method : PUT

  2. URI : /games/game-id/players/player-id/fire

  3. RESPONSE :

    {
        "fire-status": "success|failure",
        "game-status": "running|over",
        "score": {
            "D": 1,
            "L": 1
        }
    }
    

Show the battleship plan

  1. Method : GET

  2. URI : /games/game-id/battlefield

  3. RESPONSE :

    -|-|-|-|-
    -|D|-|-|-
    -|-|-|L|-
    -|-|-|-|-
    -|-|-|-|-
    

CLIENTS

BASH REST client (Default implementation)

This is a sample to quickly test the game and write your own client. Once done you can share your implementation and send me a pull request. Find the BASH REST client here How to play ? Fetch the repository, go to the bin directory and execute the battleship-client