Files
snake2025/snake.h
2025-05-20 13:04:52 +02:00

35 lines
503 B
C

#ifndef SNAKE_H
#define SNAKE_H
struct GridStruct;
typedef struct Position
{
int x;
int y;
struct Position *next;
} Position;
typedef enum
{
TOP,
BOTTOM,
LEFT,
RIGHT
} Direction;
struct SnakeStruct
{
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 */