Exemplo n.º 1
0
 def test_move_along_spoke_from_bottom(self):
     game_position.input = lambda _: 'up'  
     gp = game_position.GamePositions()       
     start_x, start_y = 4, 0
     spaces_to_move = 4
     expected_end_x = 5
     expected_end_y = 3
     direction = 'rev'
     newx, newy = gp.find_next_position(
         start_x,
         start_y,
         spaces_to_move,
         direction
     )
     self.assertEqual(newx, expected_end_x)
     self.assertEqual(newy, expected_end_y)
Exemplo n.º 2
0
 def test_start_turn_from_top_spoke(self):
     print('test_start_turn_from_spoke')
     game_position.input = lambda _: 'down'  
     gp = game_position.GamePositions()       
     start_x, start_y = 5, 9
     spaces_to_move = 2
     expected_end_x = 5
     expected_end_y = 7
     direction = 'fwd'
     newx, newy = gp.find_next_position(
         start_x,
         start_y,
         spaces_to_move,
         direction
     )
     self.assertEqual(newx, expected_end_x)
     self.assertEqual(newy, expected_end_y)
Exemplo n.º 3
0
 def test_move_along_spoke_from_right_side(self):
     print('test_move_along_spoke_from_right_side')
     game_position.input = lambda _: 'left'  
     gp = game_position.GamePositions()       
     start_x, start_y = 10, 6
     spaces_to_move = 4
     expected_end_x = 7
     expected_end_y = 5
     direction = 'fwd'
     newx, newy = gp.find_next_position(
         start_x,
         start_y,
         spaces_to_move,
         direction
     )
     self.assertEqual(newx, expected_end_x)
     self.assertEqual(newy, expected_end_y)
Exemplo n.º 4
0
 def test_go_from_spoke_to_perim(self):
     print('test_start_turn_from_spoke')                
     commands = ['right', 'down']
     command_iter = iter(commands)
     game_position.input = lambda _: next(command_iter)
     gp = game_position.GamePositions()       
     start_x, start_y = 7, 5
     spaces_to_move = 5
     expected_end_x = 10
     expected_end_y = 3
     direction = 'fwd'
     newx, newy = gp.find_next_position(
         start_x,
         start_y,
         spaces_to_move,
         direction
     )
     self.assertEqual(newx, expected_end_x)
     self.assertEqual(newy, expected_end_y)
Exemplo n.º 5
0
 def setUp(self):
     # Default board is 11x11
     self.gp = game_position.GamePositions()