Game state is now preserved in a file

This commit is contained in:
2026-03-06 19:03:55 +01:00
parent 4c21d309e9
commit 016b1eafb5
5 changed files with 27 additions and 6 deletions
+5
View File
@@ -176,6 +176,11 @@ void reset_board(GameState_t *state) {
state->board[y][x] = (rand() % 10 == 0) ? 4 : 2; // 10% chance to spawn a 4
tile_count++;
}
FILE *f = fopen("save.dat", "wb");
if (f) {
fwrite(state, sizeof(GameState_t), 1, f);
fclose(f);
}
}
bool spawn_tile(GameState_t *state) {