Snake

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Committer:
congvu
Date:
Mon Nov 23 05:54:49 2020 +0000
Revision:
3:2fe73b263a9a
Parent:
2:4947d6a82971
ECE2035;

Who changed what in which revision?

UserRevisionLine numberNew 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);