Beispiel #1
0
 def test_code_to_movement(self):
     assert_equal(code_to_movement(12), (0, 0))
     # 1 field
     assert_equal(code_to_movement(6), (-1, -1))
     assert_equal(code_to_movement(8), (1, -1))
     assert_equal(code_to_movement(16), (-1, 1))
     assert_equal(code_to_movement(18), (1, 1))
     # 2 fields
     assert_equal(code_to_movement(0), (-2, -2))
     assert_equal(code_to_movement(4), (2, -2))
     assert_equal(code_to_movement(20), (-2, 2))
     assert_equal(code_to_movement(24), (2, 2))
Beispiel #2
0
 def move_code(self, code):
     code = int(code)
     movement = code_to_movement(code)
     return self.move(movement[0], movement[1])