/include/snake.hpp |
18,7 → 18,7 |
void move(); |
void append(int num); |
|
// Stuff that should be private - Did I write this comment? (F) |
// Stuff that should be private - Did I write this comment? (F) No (T) |
vector<Point> points; // list of points snake occupies |
|
// Colour Values |
/src/snake.cpp |
42,8 → 42,13 |
} |
} |
|
void append(int num) |
void Snake::append(int num) |
{ |
Point * p = & points[points.size() - 1]; |
points.push_back(*p); |
int index = points.size() - 1; |
|
if (index >= 0) |
{ |
Point p = points[index]; |
points.push_back(p); |
} |
} |
/src/point.cpp |
1,5 → 1,11 |
#include "point.hpp" |
|
Point::Point() |
{ |
X = 0; |
Y = 0; |
} |
|
Point::Point(int x, int y) |
{ |
X = x; |