Haunted-Mirror
The game that is 2017-18's project for UE projet Techno
game.h
Go to the documentation of this file.
1 #ifndef _GAME_H_
2 #define _GAME_H_
3 #include <stdbool.h>
4 
64 typedef enum content_e {EMPTY, MIRROR, ANTIMIRROR, VAMPIRE, GHOST, ZOMBIE} content;
65 
66 #define NB_POSSIBLE_FILLINGS 6
67 
72 typedef enum direction_e {N,S,E,W} direction;
73 
74 #define NB_DIR 4
75 
76 
81 typedef struct game_s* game;
82 
90 typedef const struct game_s* cgame;
91 
92 
99 
106 game new_game();
107 
120 game setup_new_game(int *labels[NB_DIR], content * board,
121  int required_nb_ghosts, int required_nb_vampires, int required_nb_zombies);
122 
123 
132 void add_mirror(game game, int dir, int col, int line);
133 
142 void set_required_nb_seen(game game, direction side, int pos, int value);
143 
144 
152 void set_required_nb_monsters(game game, content monster, int value);
153 
159 game copy_game (cgame g_src);
160 
161 
166 void delete_game (game g);
167 
175 int required_nb_seen(cgame game, direction side, int pos);
176 
185 content get_content(cgame game, int col, int line);
186 
194 int required_nb_monsters(cgame game, content monster);
195 
201 bool is_game_over (cgame g);
202 
207 void restart_game(game g);
208 
209 
221 bool add_monster(game game, content monster, int col, int line);
222 
223 
232 int current_nb_seen(cgame game, direction side, int pos);
233 
234 
242 int current_nb_monsters(cgame game, content monster);
243 
244 
245 
247 
248 
249 #endif // _GAME_H_
content get_content(cgame game, int col, int line)
get the content of a square in the board
game setup_new_game(int *labels[NB_DIR], content *board, int required_nb_ghosts, int required_nb_vampires, int required_nb_zombies)
creates a game from a board description. It uses a given board possibly with its mirrors, and a list of labels.
content_e
possible contents of a square on the board. MIRROR stands for a mirror at +45 degrees (/)...
Definition: game.h:64
bool add_monster(game game, content monster, int col, int line)
adds a monster on the game board. Can also be used to remove any monster by adding EMPTY...
struct game_s * game
The structure pointer that stores the game.
Definition: game.h:81
void add_mirror(game game, int dir, int col, int line)
adds a mirror on the game board
game copy_game(cgame g_src)
Clone the game g_src.
void set_required_nb_monsters(game game, content monster, int value)
modifies the aimed number of a given monster on the board
int required_nb_monsters(cgame game, content monster)
indicates the aimed number of a given monster on the board
void delete_game(game g)
Destroy the game and free allocated memory.
enum direction_e direction
the fourth cardinal directions
direction_e
the fourth cardinal directions
Definition: game.h:72
bool is_game_over(cgame g)
Test if the game is over (that is the grid is filled according to the requirements).
enum content_e content
possible contents of a square on the board. MIRROR stands for a mirror at +45 degrees (/)...
void restart_game(game g)
Restart a game by cleaning monsters from the board.
int current_nb_monsters(cgame game, content monster)
counts the current number of monsters of a given type
int required_nb_seen(cgame game, direction side, int pos)
return the label on the side of the board
void set_required_nb_seen(game game, direction side, int pos, int value)
sets the label of a game
const struct game_s * cgame
The structure constant pointer that stores the game That means that it is not possible to modify the ...
Definition: game.h:90
game new_game()
creates an empty game with all squares set to empty, all labels and the number of required monsters s...
int current_nb_seen(cgame game, direction side, int pos)
says how many monsters can be seen on the current game board