# Logical Path: Help me!

``````# Get two secret true/false values from the wizard.
hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()

# If BOTH secretA and secretB are true, take the high path; otherwise, take the low path.
# Check the guide for notes on how to write logical expressions.
secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)

# If EITHER secretA or secretB is true, take the high path.
if (secretA == "true" or secretB == "true"):
hero.moveXY(32, 33)

# If secretB is NOT true, take the high path.
if (secretB !== "true"):
hero.moveXY(44,33)
``````

It says: Fix your code: Parentheseas must match. What parantheseas arenât matching?

I donât think you are using python but maybe your third if is meant to look like this

``````if (secretA == "true") or (secretB == "true"):
hero.moveXY(32, 33)

``````

and what language are you using?

p.s. if itâs python the parentheses are not needed

``````if (secretB !== "true"):
hero.moveXY(44,33)
``````

should be

``````if (secretB != "true"):
hero.moveXY(44,33)
``````

only one equal sign is needed

I am using Python thank you for helping me I will try it again right now:slight_smile:

Oh, I wasnât sure, thanks a lot!

Hereâs my code now and my pet cougar and I just stop when Iâm in front of the first bunch of tress in the middle

``````# Get two secret true/false values from the wizard.
hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()

# If BOTH secretA and secretB are true, take the high path; otherwise, take the low path.
# Check the guide for notes on how to write logical expressions.
secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)

# If EITHER secretA or secretB is true, take the high path.
if (secretA == "true") or (secretB == "true"):
hero.moveXY(32, 33)
# If secretB is NOT true, take the high path.
if (secretB != "true"):
hero.moveXY(44, 33)
``````

Okay so I look back at my code and your hero doesnât get stuck but rather they stop because you need to write more code so your sA or sB needs tp changer to this.

``````if (secretA == "true") or (secretB == "true"):
hero.moveXY(32, 33)
else:
blah blah
hero.moveXY(blah, blah)
``````

I wonât tell you the code
and the sB !=

``````  if (secretB != "true"):
hero.moveXY(44, 33)
else:
blah blah
hero.moveXY(blah, blah)
``````

needs to do the same thing. After you do that you will have enough code.
and also donât write

``````if secretA == "true" or secretB == "true":
``````

you can get rid of the parentheses and == 'true" and change to

``````if secretA or secretB:
``````

and for the not true you should write them as

``````if secretA == True:
``````

the True should be light blue I am not sure if your method works or not but this one is faster.

I need help. The coding says I made a mistake but their is nothing wrong with it.

hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()
secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)
secretD = secretA or secretB
if secretD:
hero.moveXY(32, 33)
else:
hero.moveXY(32, 16)
hero.moveXY(38, 24)
Secret = secretA not secretB
if secret:
hero.moveXY(44, 33)
else:
hero.moveXY(44, 15)
hero.moveXY(50, 24)

How do I do the last part where B is false in Lua.

you probally already beat it but i wanted to say thanks because your code helped me beat this stupid level been stuck for a whole dayâŚ under hero moveXY(38,24) should be this secretD = not secretB
than under than the last if secret should be if secretD: and remeber to format everything correctly, which i know you probally already have, thanks again

This is my code:

hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()

secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)

# bla bla bla

if (secretA == True) or (secretB == True):
hero.moveXY(32, 33)
else:
hero.moveXY(32, 15)
hero.moveXY(38, 24)

# bla bla bla

if secretB != True:
hero.moveXY(44, 33)
else:
hero.moveXY(44, 15)
hero.moveXY(50, 24)

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.

That being said, why are you using parenthesis in this line?

if (secretA == True) or (secretB == True):

use this code

(Solution removed)

Itâs great that you solved this level but please donât post finished, working code or final solutions. The purpose of this board is to help people learn and simply providing solutions is counterproductive toward that goal. Thanks.

Hi welcome to the forum, sorry for the delay.
My advice would be to check secretA and secretB like they do here:

``````var secretC = secretA && secret B;
``````

for all the secret checking, rather than doing this:

``````if (secretA == "true" or secretB = "true"):
``````

mainly because the code above (the code you wrote) doesnât work. Are you used to doing Python? Because youâve used a : at the end of the if statement and an `or` in the middle. If not my advice would be to read the hints carefully as they tell you what you need to know.
So you could start line 16 like this:

``````var secretD = secretA || secretB // this is how you do or in javascript
``````

and then move on from there.
Youâre also missing the section where you go back down from the cross you go to.
E.g. the else part in the example code.
I hope this helps.
P.S. in future can you put your code actually onto the forum rather than in a screenshot: instructions here: How to Post Your Code With Radiant, Harmonious Formatting.

hey uh please format code use âââ before and after putting code in

Anyways, uh my character always gets stuck on the last or middle tree or i fail and the wizard zaps me. my code:
âââ# Get two secret true/false values from the wizard.

# Check the guide for notes on how to write logical expressions.

hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()

# If BOTH secretA and secretB are true, take the high path; otherwise, take the low path.

secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)

# If EITHER secretA or secretB is true, take the high path.

if secretA or secretB == âtrueâ:
hero.moveXY(32, 33)
else:
hero.moveXY(32, 15)
hero.moveXY(38, 24)

# If secretB is NOT true, take the high path.

if secretB == âfalseâ:
hero.moveXY(44, 33)
if secretB == âtrueâ:
hero.moveXY(44, 15)
hero.moveXY(50, 24)âââ

Sorry, didnt format correctly

``````# Get two secret true/false values from the wizard.
# Check the guide for notes on how to write logical expressions.
hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()

# If BOTH secretA and secretB are true, take the high path; otherwise, take the low path.
secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)

# If EITHER secretA or secretB is true, take the high path.
if secretA or secretB == "true":
hero.moveXY(32, 33)
else:
hero.moveXY(32, 15)
hero.moveXY(38, 24)
# If secretB is NOT true, take the high path.
if secretB == "false":
hero.moveXY(44, 33)
if secretB == "true":
hero.moveXY(44, 15)
hero.moveXY(50, 24)

``````

There is something wrong with this line:

`if secretA or secretB == "true":`

Hint: The code you should replace that line with is very similar to your line for `secretC`:

`if secretC:`