def test_RandomPlayer_playTurn(): player_1 = RandomPlayer('Julie') player_1.initialize('blue', ['green', 'red']) board = Board([player_1]) board.tiles[0][0] = Tile(0, [[0, 6], [1, 2], [3, 4], [5, 7]]) player_1.place_pawn(board) player_1.position = Position(4, 0) # In this scenario, both these tiles cause elimination tile_1 = Tile(1, [[0, 1], [2, 3], [4, 5], [6, 7]]) tile_2 = Tile(2, [[0, 7], [1, 2], [3, 4], [5, 6]]) hand = [tile_1, tile_2] player_1.tiles_owned = hand just_played_id = player_1.play_turn(board, hand, 33).identifier assert (just_played_id == 1 or just_played_id == 2) # tile_3 in its current orientation will cause elimination, but after one rotation will be legal tile_3 = Tile(3, [[0, 7], [1, 2], [3, 6], [4, 5]]) hand = [tile_1, tile_2, tile_3] player_1.tiles_owned = hand tile_played = player_1.play_turn(board, hand, 33) assert tile_played.identifier == 3 assert tile_played.paths == [[0, 5], [1, 2], [3, 4], [6, 7]] # tile_3 in its current orientation will cause elimination, but after four rotations will be legal tile_3 = Tile(3, [[0, 1], [2, 7], [3, 4], [5, 6]]) hand = [tile_1, tile_2, tile_3] player_1.tiles_owned = hand tile_played = player_1.play_turn(board, hand, 33) assert tile_played == tile_3 assert tile_played.identifier == 3 assert tile_played.paths == [[0, 5], [1, 2], [3, 4], [6, 7]]
def test_RandomPlayer_initialize(): """ Just checking to make sure that the derived class properly uses the base class """ player_1 = RandomPlayer('Julie') player_1.initialize('blue', ['green', 'darkgreen']) assert player_1.name == 'Julie' assert player_1.color == 'blue' assert player_1.other_colors == ['green', 'darkgreen']