Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

How to beat logical path

please help me beat logical path how to beat it? :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :sweat: :exploding_head: :exploding_head: :exploding_head:

Can you show us your code so we can help you?

Properly formatted, per this topic, please:
[Essentials] How To Post/Format Your Code Correctly

I don’t have one here is the code it gives you# 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)

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

hero.moveXY(38, 24)

If secretB is NOT true, take the high path.

hero.moveXY(50, 24)

I will let @dedreous to help you because I have to go to bed. Bye!

Ok, please read the topic I just sent you. It will be crucial, if not required, should you need help in future levels.

Here is how your last post should look:


I don’t have one here is the code it gives you# Get two secret true/false values from the wizard.

# 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.

hero.moveXY(38, 24)
# If secretB is NOT true, take the high path.

hero.moveXY(50, 24)

oh ok thanks
:grinning: :grinning:

So, with that being said, the concept this lesson covers is the use of logical operators…and, or, not.

The idea is to use if statements to test if a certain condition is true and then move according the result of that test.

1 Like

ok can I have the soulotion

No, that is not what this forum is here for. We are here to help, guide and even further teach coding techniques. As per the Welcome topic at the top of the forum, posting solutions is not allowed:

  • You may not post solutions. It is strongly against the rule and might result in a mute or ban.
2 Likes

OK SORRY I think I got an answer

I only see… one if statement.

Of course, that is the β€˜Restart’ code…what you get when you first visit the level, or restart it.