![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Snake
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: snake.h
- Revision:
- 1:10330bce85cb
- Child:
- 2:4947d6a82971
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/snake.h Fri Oct 23 16:18:39 2020 -0400 @@ -0,0 +1,28 @@ +#define SNAKE_MAX_LENGTH 50 + +// Structure for holding detailed information about the snake +typedef struct{ + int speed; + int speed_up_duration; + bool go_through_wall; +} Status; + +// Structure of coordinates in the map +typedef struct{ + int x; + int y; +} Coordinate; + +// Snake Structure +typedef struct { + int head_x, head_y, head_px, head_py; // Location of the head of the snake + int length; // length of the snake + Coordinate locations[SNAKE_MAX_LENGTH]; // Snake body locations + Status snake_status; // Stauts of the snake + int score; //Current score of the snake +} Snake; + +// Initialize a snake structure +// You want to assign initial values to each of the variables defined above +// in the snake structure. +void snake_init (Snake * snake); \ No newline at end of file