Project Fairdice |
[Home] [Docs] [Users] [Gaming] [Crypto] [Devel] [Download] [Help] |
[Definition]
GAME_MESSAGE
=
"G " GAME_STR " | P " PROTOCOL_STR
GAME_STR
=
LINK_ID " ^ " GAME_ID
;
this identifies the particular game instance being played
PROTOCOL_STR
=
GAME_INIT | GAME_RAND | GAME_GENR | GAME_VERI
;
these stages must be played in order, each sequence
happening once.
Stage | Initiator | Description |
---|---|---|
GAME_INIT | User | Initialise the game. |
GAME_RAND | Client | The client decides to play and provides their random input |
GAME_GENR | Client | Once the server has everyone's input, generate the output |
GAME_VERI | Client | Once the server announces the output, verify it is fair |
[Definition]
GAME_INIT
=
INIT_REQUEST | INIT_RESPONSE | INIT_MODULO
INIT_REQUEST
=
"join request"
INIT_RESPONSE
=
"join respond " JOIN_ANSWER
INIT_MODULO
=
"modulo " MODULO
JOIN_ANSWER
=
"yes" | "no"
[Sequence]
There are two valid sequences.
- user to client : INIT_REQUEST
- client to user : INIT_RESPONSE (negative)
or
- client to user : INIT_REQUEST
- client to user : INIT_RESPONSE (positive)
- client to user : INIT_MODULO
[Definition]
GAME_RAND
=
RAND_ID
RAND_ID
=
"id " PLAYER_ID
[Sequence]
There is one valid sequences.
- client to user: RAND_ID
[Definition]
GAME_GENR
=
GENR_SIZE
GENR_SIZE
=
"size " GAME_SIZE
[Sequence]
There is one valid sequence.
- client to user : GENR_SIZE
[Definition]
GAME_VERI
=
VERI_OUTCOME | VERI_FINISH | VERI_CLOSING | VERI_CLOSED
VERI_OUTCOME
=
"outcome " OUTCOME
VERI_FINISH
=
"finish " ( "fair" | ("fail " DISPLAY_STR) | ("fraud " DISPLAY_STR) )
VERI_CLOSING
=
"closing"
VERI_CLOSED
=
"closed"
[Sequence]
There is one valid sequence.
- client to user : VERI_OUTCOME
- client to user : VERI_FINISH
- client to user : VERI_CLOSING
- client to user : VERI_CLOSED
however be aware:
Either side can send VERI_CLOSING at any stage of a game.
If it is sent before stage VERI, it cancels the game, triggering
a VERI_FINISH (fail) being sent to everyone.