summaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
new file mode 100644
index 0000000..f591781
--- /dev/null
+++ b/src/game.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+
+#include "game.h"
+#include "player.h"
+
+struct game *
+new_game(void)
+{
+ struct game *g;
+
+ g = malloc(sizeof(*g));
+ if (g == NULL) {
+ return NULL;
+ }
+
+ g->players[0] = new_player();
+ g->players[1] = new_player();
+
+ return g;
+}
+
+void
+free_game(struct game *g)
+{
+ free_player(g->players[0]);
+ free_player(g->players[1]);
+
+ free(g);
+}