#ifndef GRID_H #define GRID_H #include struct SnakeStruct; struct GridStruct { char **grid; int nbl; int nbc; }; typedef struct GridStruct Grid; typedef enum { WALL = 'w', EMPTY = ' ', FRUIT = 'f', SNAKE = 's', SNAKEHEAD = 'S', BOOST = 'b' } Element; Grid *allocate_grid(int n, int m); void free_grid(Grid *g); void debug_grid(Grid *g); int compute_size(Grid *g, int w, int h); void draw_grid(Grid *g); void place_snake(Grid *g, struct SnakeStruct *snake); Element move_snake(struct SnakeStruct *snake, Grid *g); int count_nb_lines(FILE *stream); int count_fruits(FILE *stream, Grid *g); void copy(const char *src, char *dst); int is_snake_connected(struct SnakeStruct *snake); void read_snake_from_grid(Grid *g, struct SnakeStruct *snake); #endif /* GRID_H */