# [Solved] The Wizard's Door. Help!

I can’t figure out the code to The Wizard’s Door and this is my code.

# Move to Laszlo and get the secret number from him.

hero.moveXY(30, 13)
secret = hero.findNearestFriend().getSecret()
secretr = secret
number = secret + 7

# Move to Erzsebet and say her magic number.

hero.moveXY(17, 26)
hero.say(number)
number = (7 + secret) % 4

# Move to Simonyi and say his magic number.

hero.moveXY(30, 39)
hero.say(number)
number = number * secretr

# Move to Agata and say her magic number.

hero.moveXY(43, 26)
hero.say(number)

# hero.say(number)

We can’t see the structure since you didn’t post your code correctly. From now on please paste the code from the game using the </> button so it is formatted properly. Help us help you.

You redefine secret as secretr. All this does is rename the variable, secret. Why?

Also, you are constantly redefining the variable, number. This can be confusing. Why not have a separate variable for each wizard?

``````secret = hero.findNearestFriend().getSecret()

erz = secret + 7

hero.say(erz)

sim = erz % 4

hero.say(sim)

aga = sim * secret

hero.say(aga)
``````

Obviously, there’s a lot missing from that code and you’ll have to fill in the blanks, but you should at least see how to use a different variable for each wizard. This should be less confusing as each computation has a different name so they’re easier to keep track of.

Also, I know the directions/comments say to use modulo 4 for Simonyi’s number but I had to use “/” (divide) to pass.

1 Like

@MunkeyShynes

Sorry. I don’t get what your are saying.

``````secret = hero.findNearestFriend().getSecret()

ErzsebetNumber = secret + 7

hero.say(ErzsebetNumber)

SimonyiNumber = ErzsebetNumber % 4

hero.say(SimonyiNumber)

AgataNumber = SimonyiNumber * secret

hero.say(AgataNumber)
``````

Does that make more sense?

1 Like

@MunkeyShynes

It makes more sense but every time I go to Simonyi and I say 1 she zaps me and I die.

Did you read the last sentence in my first post?

1 Like

@MunkeyShynes

Thank you so much.

Thank you so much. It helped me a lot.

(Post must be at least 20 characters)

1 Like

This level wont let me pass even when my code is correct and when i submit the wizards numbers change
This is my code

``````# Move to 'Laszlo' and get his secret number.
hero.moveXY(30, 13)
las = hero.findNearestFriend().getSecret()

# Add 7 to 'Laszlo's number to get 'Erzsebet's number.
# Move to 'Erzsebet' and say her magic number.
erz = las + 7
hero.moveXY(17, 26)
hero.say(erz)

# Divide 'Erzsebet's number by 4 to get 'Simonyi's number.
# Go to 'Simonyi' and tell him his number.
hero.moveXY(30, 39)
erz = las + -2.75
hero.say(erz)
# Multiply 'Simonyi's number by 'Laszlo's to get 'Agata's number.
# Go to 'Agata' and tell her her number.
hero.moveXY(43, 26)
erz = las + 17.5
hero.say(erz)
``````

So i restarted my code and reset it this is what it looks like

``````# Move to 'Laszlo' and get his secret number.
hero.moveXY(30, 13)
las = hero.findNearestFriend().getSecret()

# Add 7 to 'Laszlo's number to get 'Erzsebet's number.
# Move to 'Erzsebet' and say her magic number.
erz = las + 7
hero.moveXY(17, 26)
hero.say(erz)

# Divide 'Erzsebet's number by 4 to get 'Simonyi's number.
# Go to 'Simonyi' and tell him his number.

# Multiply 'Simonyi's number by 'Laszlo's to get 'Agata's number.
# Go to 'Agata' and tell her her number.

``````

Please don’t post asking for assistance with the same level in multiple locations. This will not get assistance faster.

i need some help with this level plaese

please post your code and format it

hero.moveXY(30, 13)
las = hero.findNearestFriend().getSecret()

# Move to ‘Erzsebet’ and say her magic number.

erz = las + 7
hero.moveXY(17, 26)
hero.say(erz)

# Go to ‘Simonyi’ and tell him his number.

sim = erz/4
hero.moveXY(30, 39)
hero.say(“sim”)

# Go to ‘Agata’ and tell her her number.

aga = sim * las
hero.moveXY(43, 26)
hero.say(“aga”)

here you go

what did i do wrong with this code

Format your code using this button

``````hero.moveXY(30, 13)
las = hero.findNearestFriend().getSecret()

# Add 7 to 'Laszlo's number to get 'Erzsebet's number.
# Move to 'Erzsebet' and say her magic number.
erz = las + 7
hero.moveXY(17, 26)
hero.say(erz)

# Divide 'Erzsebet's number by 4 to get 'Simonyi's number.
# Go to 'Simonyi' and tell him his number.
sim = erz/4
hero.moveXY(30, 39)
hero.say("sim")
# Multiply 'Simonyi's number by 'Laszlo's to get 'Agata's number.
# Go to 'Agata' and tell her her number.
aga = sim * las
hero.moveXY(43, 26)
hero.say("aga")

``````

nvm i know what i did wrong but thanks for trying to help me