Rendu tp6

This commit is contained in:
2025-05-20 13:04:52 +02:00
parent 48c0bd0f96
commit f36b376137
5 changed files with 151 additions and 47 deletions

13
snake.h
View File

@@ -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 */