Beispiel #1
0
if search > 2 or search < 0:
    print("Wrong selection")
    sys.exit()

# run DFS
if search == 0:
    puzzle.DFS()
    puzzle.generateSolution("puzzleDFS")

# Pick heuristic
print("Pick heuristic A or B")
heuristic_choice = input()

# run best first search
if search == 1:
    if heuristic_choice == 'A':
        puzzle.BFS(puzzle.heuristicA)
        puzzle.generateSolution("puzzleBFS-h1")
    else:
        puzzle.BFS(puzzle.heuristicB)
        puzzle.generateSolution("puzzleBFS-h2")

# run a* algorithm
if search == 2:
    if heuristic_choice == 'A':
        puzzle.Astar(puzzle.heuristicA)
        puzzle.generateSolution("puzzleAs-h1")
    else:
        puzzle.Astar(puzzle.heuristicB)
        puzzle.generateSolution("puzzleAs-h2")