FORMAT: 1A
The coinched API allows to communicate with a coinched server to play the coinche card game.
Desired properties:
- Calling twice the same page should not cause error
- Ideally, calling twice the same web page should return the same thing
Player refinement:
- Anonymous players, UUID generated on /join
- Named player, name is chosen on /join, no registration
- Registrated players, use password?
These methods can be called without a player ID.
Returns an help message with the available API endpoints.
- Response 404 (applicatiion/json)
Attempt to join a new game. Will block until a party is found.
-
Response 200 (application/json)
{ "player_id": 123456, "player_pos": 2 }
These methods require a Player ID. Use /join
to get one.
Wait for the next event.
-
Response 200 (application/json)
{ "id": 1, "event": 0 }
Leave the game. The playerID becomes invalid after this call.
-
Response 200 (application/json)
"ok"
Returns the cards in hand for the given player, as a 32-bitset.
-
Response 200 (application/json)
3
Returns the scores for both teams.
-
Response 200 (application/json)
[0, 0]
These methods require a Player ID. They are only available during auction.
Pass one's turn during auction.
-
Response 200 (application/json)
{ "id": 0, "event": { "type": "FromPlayer", "pos": 1, "event": { "type": "Passed" } } }
Coinche (or sur-coinche) the current contract.
-
Response 200 (application/json)
{ "id": 1, "event": { "type": "FromPlayer", "pos": 1, "event": { "type": "Coinched" } } }
These methods require a Player ID. They are only available during card play, after auction.
Returns the current trick.
-
Response 200 (application/json)
{ "first": 1, "winner": 2, "cards": [ "None", "None", "None", "None" ] }
Returns the last complete trick.
-
Response 200 (application/json)
{ "first": 1, "winner": 2, "cards": [ "None", "None", "None", "None" ] }
-
Request (application/json)
{ "target": "80", "suit": 1 }
-
Response 200 (application/json)
{ "id": 1, "event": { "type": "FromPlayer", "pos": 1, "event": { "type": "Bidded", "target": "80", "suit": 1 } } }
-
Request (application/json)
{ "card": 64 }
-
Response 200 (application/json)
{ "id": 2, "event": { "type": "FromPlayer", "pos": 1, "event": { "type": "CardPlayed", "card": 64 } } }