Battleships

Developer Challenge

Beat us at a game of Battleships and you could find yourself working with the best Rails developers in the country.

Use your Rails ability to build a game that you're able to play against our server. We will judge you on your coding ability and style. (Don't forget to write tests.)

Instructions

  1. Read API documentation below
  2. Build a web based game interface that can be played or play itself against our server. Be creative
  3. Win a game and we'll provide the next set of instructions.

API reference

Our API is based on a JSON interface over HTTP using POST requests. All responses and requests should be made in JSON encoded strings.

InterfaceDescription
POST /registerUse this action to register and start a new game
POST /nukeUse this action to launch your salvos at us

Status Messages

200 OK - All requests respond with this

400 BAD REQUEST - If your request is malformed

Making Requests

Requests to the server are made in JSON

POST /register
json: { "name":"Your name", "email":"email@example.com" }

POST /register

Use this action to register and start a new game.

nameYour name
emailYour email address

POST /nuke

Use this action to launch your salvos at us.

idid of the game being played
xx target coordinate
yy target coordinate

Responses

Responses from the server are also sent as JSON encoded strings.

The server will respond to a request to /register with a game id and the first salvo coordinates of the game. Thats right, we always go first.

Example response:

{ "id":, "x":, "y": }

Possible keys for responses

idReturned upon registration
xx coordinate of fired salvo
yy coordinate of fired salvo
statusCan be hit or miss
sunkName of the craft which was sunk
game_statusReturned with "lost" when the game is lost
errorIf something went wrong, this will contain the error message
prizeOnce you have sunk all the enemy ships, this will contain your prize

General Information

The game is played on a 10x10 board with the following ships:

1 x Carrier (5 long)
1 x Battleship (4 long)
1 x Destroyer (3 long)
2 x Submarines (2 long)
2 x Patrol Boats (1 long)