summaryrefslogtreecommitdiff
path: root/web/web_match.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/web_match.c')
-rw-r--r--web/web_match.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/web/web_match.c b/web/web_match.c
new file mode 100644
index 0000000..47bc6e6
--- /dev/null
+++ b/web/web_match.c
@@ -0,0 +1,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;
+}