73typedef enum { HERE, UP, DOWN, LEFT, RIGHT, UP_LEFT, UP_RIGHT, DOWN_LEFT, DOWN_RIGHT }
direction;
78typedef struct game_s*
game;
85typedef const struct game_s*
cgame;
status
Definition: game.h:63
@ SATISFIED
Definition: game.h:66
@ ERROR
Definition: game.h:64
@ UNSATISFIED
Definition: game.h:65
bool game_won(cgame g)
Checks if the game is won.
bool game_equal(cgame g1, cgame g2)
Tests if two games are equal.
game game_copy(cgame g)
Duplicates a game.
color game_get_color(cgame g, uint i, uint j)
Gets the color of a given square.
color
Definition: game.h:24
@ WHITE
Definition: game.h:26
@ EMPTY
Definition: game.h:25
@ BLACK
Definition: game.h:27
void game_restart(game g)
Restarts a game.
void game_play_move(game g, uint i, uint j, color c)
Plays a move in a given square.
game game_new(constraint *constraints, color *colors)
Creates a new game with default size and initializes it.
struct game_s * game
The structure pointer that stores the game state.
Definition: game.h:78
bool game_get_next_square(cgame g, uint i, uint j, direction dir, uint *pi_next, uint *pj_next)
Gets the coordinate of the next square in a given direction.
constraint game_get_constraint(cgame g, uint i, uint j)
Gets the constraint of a given square.
unsigned int uint
Standard unsigned integer type.
Definition: game.h:16
direction
All possible directions in the game grid to explore the neighbourhood of a given square.
Definition: game.h:73
const struct game_s * cgame
The structure constant pointer that stores the game state.
Definition: game.h:85
constraint
Definition: game.h:41
@ MIN_CONSTRAINT
Definition: game.h:43
@ UNCONSTRAINED
Definition: game.h:42
@ MAX_CONSTRAINT
Definition: game.h:44
int game_nb_neighbors(cgame g, uint i, uint j, color c)
Returns the number of neighbors of the same color.
void game_set_color(game g, uint i, uint j, color c)
Sets the color of a given square.
void game_delete(game g)
Deletes the game and frees the allocated memory.
status game_get_status(cgame g, uint i, uint j)
Gets the square status.
game game_new_empty(void)
Creates a new empty game with defaut size.
void game_set_constraint(game g, uint i, uint j, constraint n)
Sets the constraint of a given square.