Exemple #1
0
 def test_action_UP_backwards(self):
     kaa = Snake(self.head_xy, self.bod_len)
     kaa.direction = kaa.UP
     head = kaa.action(kaa.DOWN)
     self.assertTrue(np.array_equal(head, [0, -1]))
Exemple #2
0
 def test_action_LEFT_outofrange(self):
     kaa = Snake(self.head_xy, self.bod_len)
     expected_coord = [-1, 0]
     actual_coord = kaa.action(kaa.LEFT + 4)
     self.assertTrue(np.array_equal(expected_coord, actual_coord))
Exemple #3
0
 def test_action_DOWN_outofrange(self):
     kaa = Snake(self.head_xy, self.bod_len)
     kaa.direction = kaa.DOWN
     expected_coord = [0, 1]
     actual_coord = kaa.action(kaa.DOWN + 4)
     self.assertTrue(np.array_equal(expected_coord, actual_coord))
Exemple #4
0
 def test_action_RIGHT(self):
     kaa = Snake(self.head_xy, self.bod_len)
     expected_coord = [1, 0]
     actual_coord = kaa.action(kaa.RIGHT)
     self.assertTrue(np.array_equal(expected_coord, actual_coord))
Exemple #5
0
 def test_action_UP(self):
     kaa = Snake(self.head_xy, self.bod_len)
     kaa.direction = kaa.UP
     expected_coord = [0, -1]
     actual_coord = kaa.action(kaa.UP)
     self.assertTrue(np.array_equal(expected_coord, actual_coord))
Exemple #6
0
 def test_action_LEFT_backwards(self):
     kaa = Snake(self.head_xy, self.bod_len)
     kaa.direction = kaa.LEFT
     head = kaa.action(kaa.RIGHT)
     self.assertTrue(np.array_equal(head, [-1, 0]))