About
Give potential team members a chance to demonstrate their abilities while having fun.
Quickrun
Clone the repository, and run bundle install. You will need to have redis running in order for the server to work.
$ ruby sinserv.rb.
Watch a simulated game by running. This will play a mock game against the server.
ruby client2.rb
API Overview
Our API is based on a JSON interface over HTTP using POST requests. All responses and requests should be made in JSON encoded strings.
API Reference
Interface Description
POST /register Use this action to register and start a new game
POST /nuke Use 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" }
Register yourself and start a game by POSTing to http://battle.platform45.com/register
/register
JSON Body
name Your name
email Your email address
/nuke
JSON Body
id id of the game being played
x x target coordinate
y y 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":<id>, "x":<x>, "y":<y> }
Possible keys for responses
id : Returned upon registration
x : x coordinate of fired salvo
y : y coordinate of fired salvo
status : Can be hit or miss
sunk : Name of the craft which was sunk
game_status : Returned with "lost" when the game is lost
error : If something went wrong, this will contain the error message
prize : Once 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)
Once all ships are sunk, you will be rewarded with "The Prize", that prize being an email address to which you can mail your CV.
Installing
Clone the repository, and run bundle install
.
Once the required gems are installed, you can start the server by running ruby sinserv.rb
. You will need to have
redis running in order for the server to work.
You can watch a simulated game by running ruby client2.rb
. This will play a mock game against the server.
Testing Nukeit
Run rake test
to run the test suite.
Nukeit requires redis to be running on a standard port.