cordle/include/game.h
2025-10-06 14:58:25 +01:00

40 lines
925 B
C

/* game.h - Game logic and state */
#ifndef GAME_H
#define GAME_H
#define MAX_FILENAME 256
#define MAX_MESSAGE 256
#define MAX_WORDS 10000
#define WORD_LENGTH 5
#define MAX_GUESSES 6
/* Letter status constants */
#define STATUS_UNUSED 0
#define STATUS_ABSENT 1
#define STATUS_PRESENT 2
#define STATUS_CORRECT 3
/* Game state structure */
typedef struct {
char words[MAX_WORDS][WORD_LENGTH + 1];
int word_count;
char target_word[WORD_LENGTH + 1];
char guesses[MAX_GUESSES][WORD_LENGTH + 1];
int guess_colors[MAX_GUESSES][WORD_LENGTH];
int guess_count;
char current_guess[WORD_LENGTH + 1];
int current_guess_length;
int game_over;
int won;
int letter_status[26];
} GameState;
/* Function declarations */
void init_game(GameState* game);
int make_guess(GameState* game, const char* guess);
void check_guess(GameState* game, const char* guess, int* colors);
#endif /* GAME_H */