# Help with The Wizard's Haunt

I tried to do The Wizard’s Haunt but Sandor keeps killing me.

``````# Move to 'Zsofia' and get the secret number from her.
hero.moveXY(18, 20)
zso = hero.findNearestFriend().getSecret()

# Divide 'Zsofia's number by 4 to get 'Mihaly's number.
# Move to 'Mihaly' and say his magic number.
mih = zso / 4
hero.moveXY(30, 15)
hero.say(mih)

# Divide 'Mihaly's number by 5 to get 'Beata's number
# Move to 'Beata' and say her magic number.
bea = mih/5
hero.moveXY(42, 20)
hero.say(bea)
# Subtract 'Beata's number from 'Mihaly's to get Sandor's number.
# Move to 'Sandor' and say his magic number.
san = bea - mih
hero.moveXY(38, 37)
hero.say(san)
``````
1 Like

Who is subtracting from whom?

2 Likes

Well, Sandor equals Beata minus Mihally.

1 Like

Not quite. The comment states to ‘subtract Beata’s number from Miholy’s’…the key here is the from part.

2 Likes

I don’t understand that, could you make it a little clearer?

1 Like

Who do you think should be Sandor: Beata - Miholy or Miholy - Beata? And do not forget this:

Andrei

1 Like

Let’s say you have two numbers, called Alpha and Beta. They equal thus:

Alpha = 6
Beta = 2

If I have you subtract Beta from Alpha, the answer would be 4, right? However, what happens if you subtract Alpha from Beta, which is what you are doing in your code?

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.