Skip to content

API Documentation for Administration (Game State)

Jeffrey Leung edited this page Feb 2, 2019 · 2 revisions

Reset Game

Description

Resets the players, pacdots, and game state. No pacdots may be eaten.

All players are set to the state UNINITIALIZED and the location (0.0, 0.0). All pacdots are set to be uneaten. The game state is set to INITIALIZING.

The game state previous to this request must not be INITIALIZING.

See the possible game states.

Request

Method

PUT

Mapping

/admin/gamestate

JSON body

{
	"state" : "INITIALIZING"
}

Response

Codes

HTTP Status Code Meanings
200 OK Reset the game successfully
409 Conflict The game state is already INITIALIZING
500 Internal Server Error The server crapped itself

Example cURL call

Start Game

Description

Starts the game. May be used from a paused state to continue the game.

All players currently in the state READY are set to the state ACTIVE. The game state is set to IN_PROGRESS.

The game state previous to this request must be INITIALIZING or PAUSED.

See the possible game states.

Request

Method

PUT

Mapping

/admin/gamestate

JSON body

{
	"state" : "IN_PROGRESS"
}

Response

Codes

HTTP Status Code Meanings
200 OK Started the game successfully
409 Conflict The game state is neither INITIALIZING nor PAUSED
500 Internal Server Error The server crapped itself

Example cURL call

Pause Game

Description

Pauses the game. No players will be able to tag each other, and no pacdots can be eaten.

No player states will be changed. The game state is set to PAUSED.

The game state previous to this request must be INITIALIZING or PAUSED.

See the possible game states.

Request

Method

PUT

Mapping

/admin/gamestate

JSON body

{
	"state" : "PAUSED"
}

Response

Codes

HTTP Status Code Meanings
200 OK Paused the game successfully
409 Conflict The game state is not IN_PROGRESS
500 Internal Server Error The server crapped itself

Example cURL call

Set Winner to Pacman

Description

Sets the winner to Pacman. No players can be tagged, and no pacdots can be eaten.

No player states will be changed. The game state is set to FINISHED_PACMAN_WIN.

The game state previous to this request must be IN_PROGRESS.

See the possible game states.

Request

Method

PUT

Mapping

/admin/gamestate

JSON body

{
	"state" : "FINISHED_PACMAN_WIN"
}

Response

Codes

HTTP Status Code Meanings
200 OK Set the winner as Pacman successfully
409 Conflict The game state is not IN_PROGRESS
500 Internal Server Error The server crapped itself

Example cURL call

Set Winner to Ghosts

Description

Sets the winner to the Ghosts. No players can be tagged, and no pacdots can be eaten.

No player states will be changed. The game state is set to FINISHED_GHOSTS_WIN.

The game state previous to this request must be IN_PROGRESS.

See the possible game states.

Request

Method

PUT

Mapping

/admin/gamestate

JSON body

{
	"state" : "FINISHED_GHOSTS_WIN"
}

Response

Codes

HTTP Status Code Meanings
200 OK Set the winner as Pacman successfully
409 Conflict The game state is not IN_PROGRESS
500 Internal Server Error The server crapped itself

Example cURL call