Ejemplo n.º 1
0
 def test_snake_position(self):
     """
     test that the first snake in default board
     is on 24 and ends at position 5
     """
     board = cs.Board()
     assert board.snake_dict[24] == 5
Ejemplo n.º 2
0
    def test_goal_position(self):
        """
        test that the default board has goal on position 90

        """
        board = cs.Board()
        assert board.goal == 90
Ejemplo n.º 3
0
 def test_constructor_named(self):
     """Constructor with kw args works."""
     b = cs.Board()
     s = cs.Simulation(player_field=[cs.Player, cs.Player],
                       board=b,
                       seed=123,
                       randomize_players=True)
     assert isinstance(s, cs.Simulation)
Ejemplo n.º 4
0
    def test_ladder_position(self):
        """
        test that the first ladder in default board
        is on position 1 and that it ends on position 40

        """
        board = cs.Board()
        assert board.ladder_dict[1] == 40
Ejemplo n.º 5
0
 def test_first_move(self):
     """
     Testing the first move. The player position must be greater than
     the starting position at 0.
     """
     board = cs.Board()
     player = cs.Player(board)
     player.position = 0
     player.move()
     assert player.position > 0
Ejemplo n.º 6
0
 def test_move(self):
     """LazyPlayer can move."""
     b = cs.Board()
     p = cs.LazyPlayer(b)
     p.move()
Ejemplo n.º 7
0
 def test_constructor(self):
     """LazyPlayer can be constructed."""
     b = cs.Board()
     p = cs.LazyPlayer(b, dropped_steps=3)
     assert isinstance(p, cs.LazyPlayer)
     assert isinstance(p, cs.Player)
Ejemplo n.º 8
0
 def test_move(self):
     """ResilientPlayer can move."""
     b = cs.Board()
     p = cs.ResilientPlayer(b)
     p.move()
Ejemplo n.º 9
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)
Ejemplo n.º 10
0
 def test_move(self):
     """Player has move() method."""
     b = cs.Board()
     p = cs.Player(b)
     p.move()
Ejemplo n.º 11
0
 def test_constructor(self):
     """Player can be constructed."""
     b = cs.Board()
     p = cs.Player(b)
     assert isinstance(p, cs.Player)
Ejemplo n.º 12
0
 def test_position_adjustment(self):
     """position_adjustment callable and returns number"""
     b = cs.Board()
     assert isinstance(b.position_adjustment(1), (int, float))
Ejemplo n.º 13
0
 def test_goal_reached(self):
     """goal_reached() callable and returns bool"""
     b = cs.Board()
     assert isinstance(b.goal_reached(1), bool)
Ejemplo n.º 14
0
 def test_constructor_named_args(self):
     """Constructor with kw args callable."""
     b = cs.Board(ladders=[(1, 4), (5, 16)],
                  snakes=[(9, 2), (12, 3)],
                  goal=90)
     assert isinstance(b, cs.Board)
Ejemplo n.º 15
0
 def test_constructor_args(self):
     """Constructor with unnamed arguments callable."""
     b = cs.Board([(1, 4), (5, 16)], [(9, 2), (12, 3)], 90)
     assert isinstance(b, cs.Board)
Ejemplo n.º 16
0
 def test_constructor_default(self):
     """Default constructor callable."""
     b = cs.Board()
     assert isinstance(b, cs.Board)