#ifndef WEB_MATCH_H #define WEB_MATCH_H #include "match.h" enum player_type { PT_USER, PT_COMP }; struct match_state { int id; 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_player { char *name; enum player_type type; }; struct match_opts { struct match_opts_player *players; int num_players, size_players; 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_new(); void match_opts_add_player(enum player_type type, char *name); void match_opts_remove_player(int pn); 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