示例#1
0
def main(start_state, goal_state, search_type):
    if search_type == "bfs":
        breadth_first_search = BFS(goal_state)
        res = breadth_first_search.breadthFirstSearch(start_state)
    elif search_type == "h1":
        a_star_h1 = AStar(goal_state, search_type)
        res = a_star_h1.aStar(start_state)
    elif search_type == "h2":
        a_star_h2 = AStar(goal_state, search_type)
        res = a_star_h2.aStar(start_state)
    else:
        print("Usage: python3 'SearchType' '[StartState]' '[EndState]'")
        print(
            "Search type = bfs, h1, or h2 where h1 is A* with count of tiles in the wrong place, and h2 is A* with Manhattan Values"
        )
    for i in res:
        print(i)