Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Snake/Snake-test.h
- Revision:
- 76:7fa91122907f
- Parent:
- 75:f00c79f79b6a
- Child:
- 83:329da564799a
--- a/GameObjects/Snake/Snake-test.h Sun May 05 13:04:09 2019 +0000 +++ b/GameObjects/Snake/Snake-test.h Sun May 05 15:00:34 2019 +0000 @@ -26,7 +26,7 @@ bool Snake_test_movement() { success_flag = true; - + success_flag = check_initialisation(); success_flag = check_west_movement(); success_flag = check_east_movement(); @@ -52,7 +52,7 @@ // Read the position Vector2D read_pos_1 = snake.get_pos(0); printf("%f, %f\n", read_pos_1.x, read_pos_1.y); - + // Fail the test if the initial position is wrong if (read_pos_1.x != WIDTH/2 || read_pos_1.y != 18) { //18 because I'm testing the position of the first snake beed, from the top. success_flag = false; @@ -126,7 +126,7 @@ // Read the position Vector2D read_pos_4 = snake.get_pos(0); //getting the position of the first beed printf("%f, %f\n", read_pos_4.x, read_pos_4.y); - + // Fail the test if the final position after moving West but stopping motion using b[i] = 0; is wrong. if (read_pos_4.x != ((WIDTH/2)) || read_pos_4.y != 18) { //18 because I'm testing the position of the first snake beed, from the top and ((WIDTH/2)) because it is not meant to moove. success_flag = false; @@ -153,7 +153,7 @@ // Read the position Vector2D read_pos_5 = snake.get_pos(2); //getting the position of the third beed printf("%f, %f\n", read_pos_5.x, read_pos_5.y); - + // Fail the test if the final position of the third beed after moving West and after 3 itterations; is wrong. if (read_pos_5.x != ((WIDTH/2)-2) || read_pos_5.y != 24) { //24 because I'm testing the position of the third snake beed, from the top and ((WIDTH/2)) because it is not meant to moove. success_flag = false; @@ -183,7 +183,7 @@ // Read the position Vector2D read_pos_6 = snake.get_pos(0); //getting the position of the first beed printf("%f, %f\n", read_pos_6.x, read_pos_6.y); - + // Fail the test if the final position of the first beed after moving East 3 times and colliding with block numbered 1; is wrong. if (read_pos_6.x != ((WIDTH/2)+2) || read_pos_6.y != 27) { //27 because I'm testing the position of the first snake beed of length 8, from the top // and colliding once with a block numbered 1, read_pos_6.x = ((WIDTH/2)+2) because the 7th beed from bottom mooved only 2 times in effect. @@ -214,7 +214,7 @@ // Read the position Vector2D read_pos_7 = snake.get_pos(0); //getting the position of the first beed printf("%f, %f\n", read_pos_7.x, read_pos_7.y); - + // Fail the test if the final position of the first beed after moving East 3 times and colliding with block numbered 1; is wrong. if (read_pos_7.x != ((WIDTH/2)-4) || read_pos_7.y != 21) { //21 because I'm testing the position of the first snake beed of length 9, from the top // and colliding twice with food, read_pos_7.x = ((WIDTH/2)-4) because the current top beed mooved same number of times to the top beed before it ate food.