def test_find_all_paths_ignores_undo_moves(): config = [1, 2, 3, 4, 5, 6, 7, None, 8] mock_visited_states = [[1, 2, 3, 4, None, 6, 7, 5, 8]] previous_moves = [7] player = Solver(config) paths = player.find_all_paths_from_point(config, previous_moves, mock_visited_states, []) assert paths == [[7, 8], [7, 5, "L"]]
def test_find_all_paths_eliminates_circular_paths(): config = [1, 2, 3, 4, None, 5, 7, 8, 6] mock_visited_states = [[1, None, 3, 4, 2, 5, 7, 8, 6], [1, 2, 3, None, 4, 5, 7, 8, 6], [1, 2, 3, 4, 5, None, 7, 8, 6], [1, 2, 3, 4, 8, 5, 7, None, 6]] player = Solver(config) paths = player.find_all_paths_from_point(config, [], mock_visited_states, []) assert len(paths) == 4 assert [5, "X"] in paths assert [4, "X"] in paths assert [8, "X"] in paths assert [2, "X"] in paths
def test_find_paths_gives_up_on_longer_solution(): player = Solver([1, 2, None, 3]) paths = player.find_all_paths_from_point([1, 2, None, 3], [], [], []) assert paths == [[3], [1, "L"]]