コード例 #1
0
 def test_resilient_player_moves(self):
     """
     Check that the resilient player step counter works
     """
     board = cs.Board()
     player = cs.ResilientPlayer(board)
     player.move()
     player.move()
     assert player.step_counter() == 2
コード例 #2
0
 def test_resilience(self):
     """
     Checks that the resilient player moves extra steps after falling
     down a chute in the next move
     """
     board = cs.Board(chutes=([6, 1], [5, 1], [4, 1], [3, 1], [2, 1]))
     player = cs.ResilientPlayer(board, extra_steps=20)
     player.move()
     player.move()
     assert player.position >= 21
     player.move()
     assert player.position >= 27
コード例 #3
0
 def test_move(self):
     """ResilientPlayer can move."""
     b = cs.Board()
     p = cs.ResilientPlayer(b)
     p.move()
コード例 #4
0
 def test_constructor(self):
     """ResilientPlayer can be created."""
     b = cs.Board()
     p = cs.ResilientPlayer(b, extra_steps=4)
     assert isinstance(p, cs.ResilientPlayer)
     assert isinstance(p, cs.Player)