Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j3k0/ganomede-substract-game
Ganomede simple demo "rules" service
https://github.com/j3k0/ganomede-substract-game
Last synced: 22 days ago
JSON representation
Ganomede simple demo "rules" service
- Host: GitHub
- URL: https://github.com/j3k0/ganomede-substract-game
- Owner: j3k0
- Created: 2015-02-06T15:59:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-07T18:00:40.000Z (over 9 years ago)
- Last Synced: 2024-04-14T16:10:56.025Z (7 months ago)
- Language: CoffeeScript
- Size: 146 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Rules API
---------This is a protocol to implement by "rules" services.
Rules services use no storage, they should be pure compute services.
# Game
A game has the following fields:
* `id`
* `players`: Array of players username
* `turn`: username of the next player
* `status`: one of
* `active`
* `gameover`
* `inactive`
* `gameData`:
* `total`: remaining stones
* `nMoves`: number of moves# Moves
* `moveData`:
* `number`: 21Will substract 21 to the number of remaining stones. Should be less that the total.
# /substract-game/v1/games [POST]
+ Parameters
+ type (string) ... Type of gameGenerate an initial game state.
## body (application/json)
{
"id": "string",
"players": [ "some_username" ]
}## response [200] OK
{
"id": "string",
"players": [ "some_username" ],
"turn": "some_username",
"status": "active",
"gameData": {
"total": 121,
"nMoves": 0
}
}## /substract-game/v1/moves [POST]
+ Parameters
+ type (string) ... Type of game## body (application/json)
{
"id": "string",
"players": [ "some_username", "other_username" ],
"turn": "some_username",
"status": "active",
"gameData": {
"total": 121,
"nMoves": 0
},
"moveData": {
"number": 21
}
}## response [200] OK
{
"id": "string",
"players": [ "some_username", "other_username" ],
"turn": "other_username",
"status": "active",
"gameData": {
"total": 100,
"nMoves": 1
},
"moveResult" {
}
}## response [400] Bad Request
{
"code": "InvalidNumber"
}If a number > total was selected.