Learn Recursion by Solving the Tower of Hanoi Puzzle - Step 50

My code does not pass. I get this error Your code raised an error before any tests could run. Please fix it and try again. From my past exercises I think this signifies or means that I am probably missing an indentation somewhere. Ro maybe I do not understand what the end of the move call is

rods = {
    'A': list(range(NUMBER_OF_DISKS, 0, -1)),
    'B': [],
    'C': []

# User Editable Region

def move(n, source, auxiliary, target):
    if n > 0:
        # move n - 1 disks from source to auxiliary, so they are out of the way
        move(n - 1, source, target, auxiliary)
        # move the nth disk from source to target

        # display our progress
        print(rods, '\n')
        move(n - 1, source, target, auxiliary    
move(n - 1, source, target, auxiliary              

# User Editable Region

# initiate call from source A to target C with auxiliary B
move(NUMBER_OF_DISKS, 'A', 'B', 'C')

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Learn Recursion by Solving the Tower of Hanoi Puzzle - Step 50

first reset then inside if block call move() function and pass arguments. in instruction there’s a tricky instruction given

Try to figure out the correct order.

u have to pass arguments in correct order n-1 first argument is correct. play around putting these arguments source, target and auxiliary by changing positions to get correct order. it’s fun :smile:

1 Like

Wow @aaronvincent6411 you rock!

1 Like

What is meant by first reset? I am also getting the same error.

Press the reset button in the lesson to reset the code to the original state.

Please open a new topic if you have further questions.