tao lao
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
snake.h@2:4947d6a82971, 2020-10-23 (annotated)
- Committer:
- DCchico
- Date:
- Fri Oct 23 16:30:18 2020 -0400
- Revision:
- 2:4947d6a82971
- Parent:
- 1:10330bce85cb
shell
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DCchico | 2:4947d6a82971 | 1 | // Copyright 2020 Georgia Tech. All rights reserved. |
DCchico | 2:4947d6a82971 | 2 | // The materials provided by the instructor in this course are for |
DCchico | 2:4947d6a82971 | 3 | // the use of the students currently enrolled in the course. |
DCchico | 2:4947d6a82971 | 4 | // Copyrighted course materials may not be further disseminated. |
DCchico | 2:4947d6a82971 | 5 | // This file must not be made publicly available anywhere. |
DCchico | 1:10330bce85cb | 6 | |
DCchico | 2:4947d6a82971 | 7 | #define SNAKE_MAX_LENGTH 50 |
DCchico | 1:10330bce85cb | 8 | |
DCchico | 1:10330bce85cb | 9 | // Structure of coordinates in the map |
DCchico | 1:10330bce85cb | 10 | typedef struct{ |
DCchico | 1:10330bce85cb | 11 | int x; |
DCchico | 1:10330bce85cb | 12 | int y; |
DCchico | 1:10330bce85cb | 13 | } Coordinate; |
DCchico | 1:10330bce85cb | 14 | |
DCchico | 1:10330bce85cb | 15 | // Snake Structure |
DCchico | 1:10330bce85cb | 16 | typedef struct { |
DCchico | 1:10330bce85cb | 17 | int head_x, head_y, head_px, head_py; // Location of the head of the snake |
DCchico | 1:10330bce85cb | 18 | int length; // length of the snake |
DCchico | 1:10330bce85cb | 19 | Coordinate locations[SNAKE_MAX_LENGTH]; // Snake body locations |
DCchico | 1:10330bce85cb | 20 | int score; //Current score of the snake |
DCchico | 1:10330bce85cb | 21 | } Snake; |
DCchico | 1:10330bce85cb | 22 | |
DCchico | 1:10330bce85cb | 23 | // Initialize a snake structure |
DCchico | 1:10330bce85cb | 24 | // You want to assign initial values to each of the variables defined above |
DCchico | 1:10330bce85cb | 25 | // in the snake structure. |
DCchico | 1:10330bce85cb | 26 | void snake_init (Snake * snake); |