code_snippets/c_projects/tiktaktoe/include/gamelogic.h
xavi 447fe75713 seperated .c and .h file for game logic
TODO: implement ncurses things
2026-01-05 09:34:31 -08:00

37 lines
685 B
C

#ifndef GAMELOGIC_H
#define GAMELOGIC_H
#include <stdio.h>
#include <stdint.h>
#include <ncurses.h>
#define N 3
#define ROWS N
#define COLS N
#define DIAGS 2
#define TOTAL_SQUARES ROWS*COLS
#define DOF 2
typedef enum{OPEN, X, O} squarestate;
enum turn {X_TURN, O_TURN};
typedef struct position_t{
uint8_t row;
uint8_t col;
}position_t;
enum turn currturn;
// point tracker. make any of these = N and win
int8_t pts[ROWS+COLS+DIAGS];
int round_counter;
position_t cpos;
squarestate boardstate[ROWS * COLS];
void print_boardstate();
void init_gamestate();
int is_game_over();
void add_point();
void update_boardstate();
void update_gamestate(char input);
void main_loop();
#endif