summaryrefslogtreecommitdiff
path: root/web/web_match.c
blob: 47bc6e654834c16ba69494e035340bd0433887ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "web_match.h"

#include <stddef.h>
#include <stdlib.h>

struct match_state *state;

void free_state()
{
	state->legs[1]->n_visits += state->boat_undone; // avoid memory leak
	leg_free(state->legs[0]);
	leg_free(state->legs[1]);
	free(state);
	state = NULL;
}

bool is_match_over()
{
	return state->legs[0]->rem <= 0 || state->legs[1]->rem <= 0;
}