32 lines
369 B
C
32 lines
369 B
C
#ifndef SNAKE_H
|
|
#define SNAKE_H
|
|
|
|
struct GridStruct;
|
|
|
|
#define SNAKE_SIZE 4
|
|
|
|
typedef struct
|
|
{
|
|
int x;
|
|
int y;
|
|
} Coord;
|
|
|
|
typedef enum
|
|
{
|
|
TOP,
|
|
BOTTOM,
|
|
LEFT,
|
|
RIGHT
|
|
} Direction;
|
|
|
|
struct SnakeStruct
|
|
{
|
|
Coord pos[SNAKE_SIZE];
|
|
Direction dir;
|
|
};
|
|
|
|
typedef struct SnakeStruct Snake;
|
|
|
|
void crawl(Snake *snake, struct GridStruct *g);
|
|
|
|
#endif /* SNAKE_H */ |