Snake game for a 5x5 LED matrix

Dependencies:   MCP23S17 mbed

Committer:
dhamilton31
Date:
Wed Oct 09 16:23:20 2013 +0000
Revision:
0:dc906408980e
Child:
1:5fcb94bb03db
Snake movement completed, along with options to turn LEDs on and off with ledCube class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dhamilton31 0:dc906408980e 1 #include "mbed.h"
dhamilton31 0:dc906408980e 2 #include "bodyPiece.h"
dhamilton31 0:dc906408980e 3 #include <list>
dhamilton31 0:dc906408980e 4
dhamilton31 0:dc906408980e 5
dhamilton31 0:dc906408980e 6 typedef enum {
dhamilton31 0:dc906408980e 7 Up,Down,Left,Right
dhamilton31 0:dc906408980e 8 } Direction;
dhamilton31 0:dc906408980e 9
dhamilton31 0:dc906408980e 10 class snake
dhamilton31 0:dc906408980e 11 {
dhamilton31 0:dc906408980e 12 public:
dhamilton31 0:dc906408980e 13 snake(char startRow, char startCol);
dhamilton31 0:dc906408980e 14 void move(char newHeadRow, char newHeadCol);
dhamilton31 0:dc906408980e 15 int movementSpeed;
dhamilton31 0:dc906408980e 16 Direction movementDirection;
dhamilton31 0:dc906408980e 17 void addPiece();
dhamilton31 0:dc906408980e 18
dhamilton31 0:dc906408980e 19 private:
dhamilton31 0:dc906408980e 20 std::list<bodyPiece> snakeBody;
dhamilton31 0:dc906408980e 21 int bodySize;
dhamilton31 0:dc906408980e 22 };
dhamilton31 0:dc906408980e 23
dhamilton31 0:dc906408980e 24 class food
dhamilton31 0:dc906408980e 25 {
dhamilton31 0:dc906408980e 26 public:
dhamilton31 0:dc906408980e 27 char currRow, currCol;
dhamilton31 0:dc906408980e 28 food(char row, char col);
dhamilton31 0:dc906408980e 29 void moveFood(char row, char col);
dhamilton31 0:dc906408980e 30 };