-
Notifications
You must be signed in to change notification settings - Fork 4
API Documentation for Players
Selects a Player at the given location (represented by a latitude/longitude pair).
If the game is not in progress or finished, then the The Player's state is changed from UNINITIALIZED to READY. If the game is in progress, then the Player's state is changed from UNINITIALIZED to ACTIVE.
The Player should not have already been selected or else an error will be returned.
See the possible names for a Player.
POST
/player/{player_name}
| Field | Value(s) |
|---|---|
| Content-Type | application/json |
{
"latitude" : 12345.54321,
"longitude" : 54321.12345
}
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Selected Player successfully |
400 Bad Request |
The request body was incorrectly formed |
404 Not Found |
The given name was invalid |
409 Conflict |
The Player has already been selected |
500 Internal Server Error |
The server crapped itself |
{
}
Deselects the given player, allowing it to be selectable by another team.
The Player's state is changed from any other state to UNINITIALIZED. The Player have already been selected.
See the possible names for a Player.
The Player's location will be reset to (0.0, 0.0).
DELETE
/player/{player_name}
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Deselected Player successfully |
400 Bad Request |
The Player has not been selected |
404 Not Found |
The given name was invalid |
500 Internal Server Error |
The server crapped itself |
{
}
Returns the current location of the Player as a latitude/longitude pair.
See the possible names for a Player.
If a player is at the location (0.0, 0.0), they are in theUNINITIALIZED state.
GET
/player/{player_name}/location
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Retrieved Player's location successfully |
404 Not Found |
The given name was invalid |
500 Internal Server Error |
The server crapped itself |
{
"latitude" : 135.79,
"longitude" : 246.80
}
Returns a list of all Players' names and locations, as latitude/longitude pairs.
If a player is at the location (0.0, 0.0), they are in theUNINITIALIZED state.
GET
/player/locations
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Retrieved all Players' locations successfully |
500 Internal Server Error |
The server crapped itself |
[
{
"name" : "Pacman",
"location" : {
"latitude" : 999.999,
"longitude" : 888.888
}
},
{
"name" : "Blinky",
"location" : {
"latitude" : 777.777,
"longitude" : 666.666
}
},
{
"name" : "Inky",
"location" : {
"latitude" : 555.555,
"longitude" : 444.444
}
},
{
"name" : "Pinky",
"location" : {
"latitude" : 333.333,
"longitude" : 222.222
}
}
{
"name" : "Clyde",
"location" : {
"latitude" : 111.111,
"longitude" : 222.222
}
}
]
Returns the current state of the Player.
See the possible names for a Player.
See the possible states for a Player.
GET
/player/{player_name}/state
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Retrieved Player's state successfully |
404 Not Found |
The given name was invalid |
500 Internal Server Error |
The server crapped itself |
{
"state" : "UNINITIALIZED"
}
Returns a list of all Players' names and states.
See the possible names for a Player.
See the possible states for a Player.
GET
/player/states
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Retrieved states of all Players successfully |
500 Internal Server Error |
The server crapped itself |
[
{
"name" : "Pacman",
"state" : "ACTIVE"
},
{
"name" : "Blinky",
"state" : "CAPTURED"
},
{
"name" : "Inky",
"state" : "ACTIVE"
},
{
"name" : "Pinky",
"state" : "ACTIVE"
}
{
"name" : "Clyde",
"state" : "CAPTURED"
}
]
Returns a list of all Players' details (i.e. name, state, location).
See the possible names for a Player.
See the possible states for a Player.
GET
/player/details
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Retrieved details of all Players successfully |
500 Internal Server Error |
The server crapped itself |
[
{
"name" : "Pacman",
"state" : "POWERUP",
"location" : {
"latitude" : 999.999,
"longitude" : 888.888
}
},
{
"name" : "Blinky",
"state" : "UNINITIALIZED",
"location" : {
"latitude" : 0.0,
"longitude" : 0.0
}
},
{
"name" : "Inky",
"state" : "CAPTURED",
"location" : {
"latitude" : 555.555,
"longitude" : 444.444
}
},
{
"name" : "Pinky",
"state" : "ACTIVE",
"location" : {
"latitude" : 333.333,
"longitude" : 222.222
}
}
{
"name" : "Clyde",
"state" : "ACTIVE",
"location" : {
"latitude" : 111.111,
"longitude" : 222.222
}
}
]
Updates the location of a Player to a new latitude/longitude pair.
Updating Pacman's location while the game state is IN_PROGRESS and the Pacman is in the ACTIVE state will eat any Pacdots and Powerdots within a set distance (0.0005°; 40 metres; length of a mid-sized building) of the new location. If a Powerdot is eaten, the Pacman will be placed in the POWERUP state for a set period of time (60 seconds).
See the possible names for a Player.
The Player must be not be unselected (i.e. UNINITIALIZED).
This operation is idempotent (i.e. a Player may be set to the same location they are currently at).
PUT
/player/{player_name}/location
| Field | Value(s) |
|---|---|
| Content-Type | application/json |
{
"latitude" : 12345.54321,
"longitude" : 54321.12345
}
| HTTP Status Code | Meanings |
|---|---|
200 OK |
Changed Player's location successfully |
400 Bad Request |
Request body was incorrectly formed |
404 Not Found |
The given name was invalid |
409 Conflict |
The Player has not been selected/initialized yet |
500 Internal Server Error |
The server crapped itself |
{
}