Added win and loss conditions along with their respective screens

This commit is contained in:
2026-03-06 18:00:19 +01:00
parent eb8834324e
commit 4c21d309e9
5 changed files with 99 additions and 27 deletions
+9 -7
View File
@@ -5,15 +5,17 @@
#define BOARD_HEIGHT 4
#define STARTING_TILES 3
typedef enum { UP = 0, DOWN, LEFT, RIGHT } MOVE_DIRECTION;
typedef enum { UP, DOWN, LEFT, RIGHT } move_direction_t;
typedef enum { PLAYING, WON, LOST } game_status_t;
typedef struct{
int board[BOARD_HEIGHT][BOARD_WIDTH];
int score;
int moves_made;
typedef struct {
int board[BOARD_HEIGHT][BOARD_WIDTH];
game_status_t status;
int score;
int moves_made;
} GameState_t;
void move(GameState_t *state, MOVE_DIRECTION direction);
void move(GameState_t *state, move_direction_t direction);
void reset_board(GameState_t *state);
bool spawn_tile(GameState_t *state);
bool can_move(GameState_t *state);