-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.cge
More file actions
54 lines (46 loc) · 1.22 KB
/
events.cge
File metadata and controls
54 lines (46 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name tic_tac_toe_simple
version 0.4
// The 'mark' command can be sent to the server to mark a field with the player's sign.
command mark {
row: int,
column: int
}
// The 'start' event is sent to all players when the game starts.
event start {
// A map of player IDs mapped to their respective signs.
signs: map<sign>,
}
// The 'board' event is sent to all players when the board changes.
event board {
// The board as rows of columns.
board: list<list<field>>
}
// The 'invalid_action' event notifies the player that their action was not allowed.
event invalid_action {
// A message containing details on what the player did wrong.
message: string
}
// The 'turn' event is sent to all players when it is the next player's turn.
event turn {
// The sign of the player whose turn it is now.
sign: sign
}
// The 'game_over' event is sent to all players when it's a tie or a player has won.
event game_over {
// Whether it's a tie.
tie: bool,
// The sign of the winner.
winner_sign: sign,
// The three fields which form a row.
winning_row: list<field>
}
// The two possible signs which can be placed on the board.
enum sign {
none, x, o
}
// One of the nine fields on the board.
type field {
row: int,
column: int,
sign: sign
}