Rendu tp6
This commit is contained in:
13
snake.h
13
snake.h
@@ -3,13 +3,12 @@
|
||||
|
||||
struct GridStruct;
|
||||
|
||||
#define SNAKE_SIZE 4
|
||||
|
||||
typedef struct
|
||||
typedef struct Position
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} Coord;
|
||||
struct Position *next;
|
||||
} Position;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -21,12 +20,16 @@ typedef enum
|
||||
|
||||
struct SnakeStruct
|
||||
{
|
||||
Coord pos[SNAKE_SIZE];
|
||||
Position *segments_list;
|
||||
int size;
|
||||
Direction dir;
|
||||
};
|
||||
|
||||
typedef struct SnakeStruct Snake;
|
||||
|
||||
Snake *new_snake(void);
|
||||
void add_segment(Snake *snake, int x, int y);
|
||||
void free_snake(Snake *snake);
|
||||
void crawl(Snake *snake, struct GridStruct *g);
|
||||
|
||||
#endif /* SNAKE_H */
|
||||
Reference in New Issue
Block a user