コード例 #1
0
def bfs(node, goal):
    print "Expanding Nodes.."
    Q = Queue()
    Q.queue(node)

    count = 0
    visited = []
    while Q.size():
        current = Q.dequeue()
        count += 1
        #print count
        for node in moveGen(current):
            if node.state not in visited:
                visited.append(node.state)
                if node.state == goal.state:
                    return (node)
                Q.queue(node)
コード例 #2
0
- Type 4: To export the queue to the queue.json file.
- Type 5: To import the queue from the queue.json file.
- Type 6: To quit
    ''')

    option = int(input("Enter a number:"))
    # add your options here using conditionals (if)
    if option == 1:
        print(
            "\nPlease enter the guest phone number you would like to add to the Queue."
        )
        user_input = str(input(""))
        add(user_input)
    elif option == 2:
        print("\nRemoving the first guest in line\n")
        if queue.size() > 0:
            dequeue()
        else:
            print("The Queue is empty")
        print_queue()
    elif option == 3:
        print_queue()
    elif option == 4:
        print("\nExporting your Queue to .json file.")
        save()
    elif option == 5:
        print("\nImporting your Queue from queue.json file.")
        load()
    elif option == 6:
        print("Bye bye!")
        stop = True