[Solved] The Wizard's Door. Help!


#1

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

https://codecombat.com/play/level/the-wizards-door

Move to Laszlo and get the secret number from him.

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

Follow Laszlo’s instructions to get the magic number!

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)


#2

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.


#3

@MunkeyShynes

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


#4
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?


#5

@MunkeyShynes

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


#6

Did you read the last sentence in my first post?


#7

@MunkeyShynes

Thank you so much.:grinning:


#8

Thank you so much. It helped me a lot.

:grinning:


#9

:+1:

(Post must be at least 20 characters)