39 retVal = snake.
init(begin, direction, length);
51 retVal = snake.
move(&labyrinth);
65 TEST(Snake_move, testwall1)
81 short direction =
MVUP;
84 retVal = snake.
init(begin, direction, length);
96 retVal = snake.
move(&labyrinth);
106 ASSERT_EQ(hCoords.
x, expCoords.
x);
107 ASSERT_EQ(hCoords.
y, expCoords.
y);
132 retVal = snake.
init(begin, direction, length);
138 retVal = labyrinth.
addSnake(&snake);
144 retVal = snake.
move(&labyrinth);
154 ASSERT_EQ(hCoords.
x, expCoords.
x);
155 ASSERT_EQ(hCoords.
y, expCoords.
y);
180 retVal = snake.
init(begin, direction, length);
186 retVal = labyrinth.
addSnake(&snake);
192 retVal = snake.
move(&labyrinth);
202 ASSERT_EQ(hCoords.
x, expCoords.
x);
203 ASSERT_EQ(hCoords.
y, expCoords.
y);
228 retVal = snake.
init(begin, direction, length);
234 retVal = labyrinth.
addSnake(&snake);
240 retVal = snake.
move(&labyrinth);
250 ASSERT_EQ(hCoords.
x, expCoords.
x);
251 ASSERT_EQ(hCoords.
y, expCoords.
y);
257 TEST(Snake_move, testIntersection1)
276 retVal = snake.
init(begin, direction, length);
282 retVal = labyrinth.
addSnake(&snake);
289 retVal = snake.
move(&labyrinth);
296 retVal = snake.
move(&labyrinth);
303 retVal = snake.
move(&labyrinth);
317 TEST(Snake_move, testIntersection2)
336 retVal = snake.
init(begin, direction, length);
342 retVal = labyrinth.
addSnake(&snake);
356 retVal = snake.
move(&labyrinth);
367 ASSERT_EQ(hCoords.
x, expHCoords.
x);
368 ASSERT_EQ(hCoords.
y, expHCoords.
y);
370 std::list<Point> cpBody;
372 Point bCoords = cpBody.back();
376 ASSERT_EQ(bCoords.
x, expBCoords.
x);
377 ASSERT_EQ(bCoords.
y, expBCoords.
y);
383 TEST(Snake_move, testIntersection3)
402 retVal = snake.
init(begin, direction, length);
408 retVal = labyrinth.
addSnake(&snake);
415 retVal = snake.
move(&labyrinth);
421 retVal = snake.
move(&labyrinth);
427 retVal = snake.
move(&labyrinth);
441 TEST(Snake_move, testIntersection4)
460 retVal = snake.
init(begin, direction, length);
466 retVal = labyrinth.
addSnake(&snake);
481 retVal = snake.
move(&labyrinth);
491 ASSERT_EQ(hCoords.
x, expHCoords.
x);
492 ASSERT_EQ(hCoords.
y, expHCoords.
y);
494 std::list<Point> cpBody;
496 Point bCoords = cpBody.back();
500 ASSERT_EQ(bCoords.
x, expBCoords.
x);
501 ASSERT_EQ(bCoords.
y, expBCoords.
y);
507 #endif // SNAKE_MOVE_H
class for containing and displaying the game field
Definitions and prototypes for Labyrinth class.
bool initBall()
Ball initialization with labyrinth updating.
bool move(Labyrinth *labyrinth)
The snake movement on the game field(should be called in each iteration of the game cycle...
void getCoords(std::list< Point > *currBody)
The method to get the snake whole body coordinates(x ,y) without giving the direct access...
bool setLabyrinth(Point dimensions)
Sets the default values fro the variables as well as generating the labyritnh array with borders...
bool setDirection(int dir)
The method to set the direction where the snake is heading.
Point getCoords()
Get the ball coords without giving the direct access.
bool init(Point begin, short direction, int length)
Initializes snake as an entity without ancoring it anywhere.
const int MVLEFT
snake's head is moving left
shared functions for testing
bool setCoords(Point p)
Sets coordinates of the ball to given if they are correct.
bool rmPoint(Point p)
Remove Point from the labyrinth.
Point getHeadCoords()
The method to get the coordinates(x, y) of the snake's head without giving the direct access...
const int MVUP
snake's head is moving up
Describes the Snake entity of the game.
bool addPoint(Point p)
Adding Point to the labyrinth with the check of correction.
TEST(Snake_move, test1)
method runs with normal parameters and no collisions
bool addSnake(Snake *snake)
Adding snake to the laburinth and getting the host snake(firest added snake)
const int MVRIGHT
snake's head is moving right
Coordinates and style of the cell in console window.
Definitions and prototypes for Snake class.
const int MVDOWN
snake's head is moving down