Beispiel #1
0
 def test_movement_to_energy(self):
     assert_equal(movement_to_energy(0,0), 1)
     assert_equal(movement_to_energy(0,1), 2)
     assert_equal(movement_to_energy(0,2), 5)
     assert_equal(movement_to_energy(1,0), 2)
     assert_equal(movement_to_energy(1,1), 3)
     assert_equal(movement_to_energy(1,2), 6)
     assert_equal(movement_to_energy(2,0), 5)
     assert_equal(movement_to_energy(2,1), 6)
     assert_equal(movement_to_energy(2,2), 7)
Beispiel #2
0
 def move(self, dx, dy):
     denergy = movement_to_energy(dx, dy)
     self._energy -= denergy
     self._world.move(self.get_position(), dx, dy)
     self._position.move(dx, dy)