Mosaic
|
Extended Game Functions. More...
Go to the source code of this file.
Enumerations | |
enum | neighbourhood { FULL , ORTHO , FULL_EXCLUDE , ORTHO_EXCLUDE } |
The different kind of neighbourhood. More... | |
Functions | |
Extended Functions | |
game | game_new_ext (uint nb_rows, uint nb_cols, constraint *constraints, color *colors, bool wrapping, neighbourhood neigh) |
Creates a new game with extended options and initializes it. More... | |
game | game_new_empty_ext (uint nb_rows, uint nb_cols, bool wrapping, neighbourhood neigh) |
Creates a new empty game with extended options. More... | |
uint | game_nb_rows (cgame g) |
Gets the number of rows (or height). More... | |
uint | game_nb_cols (cgame g) |
Gets the number of columns (or width). More... | |
bool | game_is_wrapping (cgame g) |
Checks if the game has the wrapping option. More... | |
neighbourhood | game_get_neighbourhood (cgame g) |
Gets the neighbourhood option. More... | |
void | game_undo (game g) |
Undoes the last move. More... | |
void | game_redo (game g) |
Redoes the last move. More... | |
Extended Game Functions.
See Mosaic for further details.
enum neighbourhood |
The different kind of neighbourhood.
neighbourhood game_get_neighbourhood | ( | cgame | g | ) |
Gets the neighbourhood option.
g
is a valid pointer toward a cgame structure bool game_is_wrapping | ( | cgame | g | ) |
Checks if the game has the wrapping option.
g
is a valid pointer toward a cgame structure Gets the number of columns (or width).
g | the game |
g
is a valid pointer toward a cgame structure Gets the number of rows (or height).
g | the game |
g
is a valid pointer toward a cgame structure game game_new_empty_ext | ( | uint | nb_rows, |
uint | nb_cols, | ||
bool | wrapping, | ||
neighbourhood | neigh | ||
) |
Creates a new empty game with extended options.
All squares are initialized with empty squares.
nb_rows | number of rows in game |
nb_cols | number of columns in game |
wrapping | wrapping option |
neigh | neighbourhood option |
game game_new_ext | ( | uint | nb_rows, |
uint | nb_cols, | ||
constraint * | constraints, | ||
color * | colors, | ||
bool | wrapping, | ||
neighbourhood | neigh | ||
) |
Creates a new game with extended options and initializes it.
nb_rows | number of rows in game |
nb_cols | number of columns in game |
constraints | an array describing the initial constraint of each square using row-major storage (of size nb_rows*nb_cols) |
colors | an array describing the initial color of each square using row-major storage (of size nb_rows*nb_cols) or NULL to set all colors as EMPTY |
wrapping | wrapping option |
neigh | neighbourhood option |
constraints
must be an initialized array of default size squared colors
must be an initialized array of default size squared or NULL void game_redo | ( | game | g | ) |
Redoes the last move.
Searches in the history the last cancelled move (by calling game_undo), and replays it. If there are no more moves to be replayed, this function does nothing. After playing a new move with game_play_move, it is no longer possible to redo an old cancelled move.
g | the game |
g
is a valid pointer toward a cgame structure void game_undo | ( | game | g | ) |
Undoes the last move.
Searches in the history the last move played (by calling game_play_move or game_redo), and restores the state of the game before that move. If no moves have been played, this function does nothing. The game_restart function clears the history.
g | the game |
g
is a valid pointer toward a cgame structure