pvjc26/du4/game.h
mk570rp 10cc177646 a4:
git commit -m a4
git commit -m a4:
2026-05-10 19:30:35 +00:00

38 lines
595 B
C

#ifndef GAME_H
#define GAME_H
#define FOOD_COUNT 3
#define END_CONTINUE 0
#define END_WALL 1
#define END_SNAKE 2
#define END_FOOD 3
struct snake {
int x;
int y;
struct snake* next;
};
struct state {
int width;
int height;
struct snake* snake;
int sx;
int sy;
int foodx[FOOD_COUNT];
int foody[FOOD_COUNT];
};
struct snake* add_snake(struct snake* snake, int x, int y);
struct snake* remove_snake(struct snake* snake);
int is_snake(struct snake* snake, int x, int y);
void free_snake(struct snake* sn);
int step_state(struct state* state);
#endif