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
55
56
57
58
59
60
61
62
|
#ifndef WEB_MATCH_H
#define WEB_MATCH_H
#include "match.h"
enum match_mode {
M_FIRST = 1,
M_PVC = M_FIRST,
M_P,
M_PVP,
M_CVC,
M_PVPVP,
M_PVCVCVC,
M_LAST = M_PVCVCVC
};
enum player_type {
PT_USER,
PT_COMP
};
struct match_state {
int id;
enum match_mode mode;
struct leg **legs;
enum player_type *player_types;
int *comp_undone;
int num_players, size_players;
int active_player;
int num_darts;
};
struct match_opts {
enum match_mode mode;
enum player_type p1_type, p2_type;
char *p1_name, *p2_name;
int start_pts;
int throws_first;
};
extern struct match_state *state;
extern struct match_opts *match_opts;
void match_new();
void match_add_player(int start_pts, enum player_type type, char *name);
void free_state();
void match_opts_free();
struct leg *state_active_leg();
int match_num_players();
int match_winning_player();
bool match_is_over();
int match_prev_player();
int match_next_player();
int match_prev_throw_player();
bool match_player_is_comp(int pn);
bool match_first_user_has_thrown();
#endif
|