29 lines
426 B
C
29 lines
426 B
C
#ifndef SNAKE_H
|
|
#define SNAKE_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "segment.h"
|
|
#include "field.h"
|
|
|
|
enum dirn {
|
|
UP = 0,
|
|
DOWN,
|
|
RIGHT,
|
|
LEFT
|
|
};
|
|
|
|
typedef struct snake_T {
|
|
Segment **n;
|
|
size_t len;
|
|
} Snake;
|
|
|
|
Snake *new_snake(size_t, int, int);
|
|
void delete_snake(Snake *);
|
|
|
|
void snake_forward(Snake *, int);
|
|
void snake_print(Snake *);
|
|
int snake_eat(Snake *, Field *);
|
|
int snake_collide(Snake *, int, int);
|
|
|
|
#endif
|