Project Fairdice |
[Home] [Docs] [Users] [Gaming] [Crypto] [Devel] [Download] [Help] |
[Definition]
GAME_MESSAGE
=
"G " GAME_STR " | P " PROTOCOL_STR
GAME_STR
=
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
(except RAND) happening once.
Stage | Initiator | Description |
---|---|---|
GAME_INIT | Host | Initialise the game. |
GAME_RAND | Server | A player asks to be allowed to play |
GAME_GENR | Varies | When LIMIT is reached, generate the output |
GAME_VERI | Host | Once we decide to announce the output, let clients verify it is fair |
[Definition]
GAME_INIT
=
INIT_OPENING | INIT_OPENED | INIT_MODULO | INIT_LIMIT
INIT_OPENING
=
"opening"
INIT_OPENED
=
"opened"
INIT_MODULO
=
"modulo " MODULO
INIT_LIMIT
=
"limit " (
("time " TIMESTAMP) |
("size " SMALLINT) |
"host"
)
[Sequence]
There is one general sequence.
- host to server : INIT_OPENING
- host to server : INIT_LIMIT
- host to server : INIT_MODULO
- server to host : INIT_OPENED
However step 2 may be repeated if limits on both size
and starting time are required (in which case the game
start as soon as either limit is met).
The host limit means that the host will tell the server
when to start.
[Definition]
GAME_RAND
=
RAND_REQUEST | RAND_RESPONSE
RAND_REQUEST
=
"join request " USER_NAME
RAND_RESPONSE
=
"join respond " JOIN_ANSWER " " USER_NAME
JOIN_ANSWER
=
"yes" | "no"
[Sequence]
There is one valid sequences.
- server to host : RAND_REQUEST
- host to server : RAND_RESPONSE
[Definition]
GAME_GENR
=
GENR_START | GENR_SIZE | GENR_OUTCOME
GENR_START
=
"start"
GENR_SIZE
=
"size " GAME_SIZE
GENR_OUTCOME
=
"outcome " OUTCOME
[Sequence]
There are two valid sequences.
- host to server : GENR_START
- server to host : GENR_SIZE
- server to host : GENR_OUTCOME
or
- server to host : GENR_SIZE
- server to host : GENR_OUTCOME
Depending on whether the game not allowing any new
players was initiated by the host, or by a time or
size limit.
[Definition]
GAME_VERI
=
VERI_ANNOUNCE | VERI_FINISH | VERI_CLOSING | VERI_CLOSED
VERI_ANNOUNCE
=
"announce"
VERI_FINISH
=
"finish " ( "fair" | ("fail " DISPLAY_STR) | ("fraud " DISPLAY_STR) )
VERI_CLOSING
=
"closing"
VERI_CLOSED
=
"closed"
[Sequence]
There is one valid sequence.
- host to server : VERI_ANNOUNCE
- server to host : VERI_FINISH
- server to host : VERI_CLOSING
- host to server : 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.
VERI_FINISH can, thus, also be sent out of order.