Exemplo n.º 1
0
def main():
    # Prompt the user to enter nine coins H's and T's
    initialNode = input("Enter an initial nine coin H's and T's: ").strip()

    # Create the NineTaileModel
    model = NineTailModel()
    path = model.getShortestPath(getIndex(initialNode))

    print("The steps to flip the coins are ")
    for i in range(len(path)):
        printNode(getNode(path[i]))
Exemplo n.º 2
0
def main():
    # Prompt the user to enter nine coins H's and T's
    initialNode = \
        input("Enter an initial nine coin H's and T's: ").strip()

    # Create the NineTaileModel
    model = NineTailModel()
    path = model.getShortestPath(getIndex(initialNode))

    print("The steps to flip the coins are ");
    for i in range(len(path)):
        printNode(getNode(path[i]))  
Exemplo n.º 3
0
def solve():
    c = "".join(coins.get())
    model = NineTailModel()
    path = model.getShortestPath(getIndex(c))
    canvas.delete(ALL)
    x = 10
    y = 10
    canvas.config(width = 50 + (50* len(path)))
    for i in range(len(path)):
        node = getNode(path[i])

        for j in range(3):
            for k in range(3):
                canvas.create_rectangle(x, y, x+10, y + 20)
                canvas.create_text(x + 5, y +  10, text = node[j+k])
                x += 10
            x = x - 30
            y += 20
        x += 50
        y = 10
Exemplo n.º 4
0
from WeightedNineTailModel import WeightedNineTailModel
from NineTailModel import NineTailModel

node = 511

tree1 = WeightedNineTailModel()
depth1 = tree1.getShortestPath(node)
tree2 = NineTailModel()
depth2 = tree2.getShortestPath(node)

if depth1 != depth2:
    print("They are not the same")
else:
    print("They are the same")