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

[SOLVED] Help with "logical path"


I need some help with “logical path”
here is a picture of the error:


rewrite true and false to True and False.

if secretA or secretB == True:
if secretB == False:

1 Like

Would you use the </> sign to put your code?

1 Like

thanks @Seojin_Roy_Lee it worked after i did that


It’s great that you were able to complete this level but please do not post finished code or solutions here. The purpose of this board is to help people learn and simply providing solutions is counterproductive toward that goal. Thanks.


(20 chars)


:(:(:frowning: this lev… i have 0 idea.


Please post your code. We can’t help unless you post what you’ve done so far.


can you help me with this level? i am stuck on it… i copied your code, maybe bug or error?
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)
hero.moveXY(20, 15)
hero.moveXY(26, 24)

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

if secretA and secretB == True:
hero.moveXY(32, 33)
hero.moveXY(32, 15)

If secretB is NOT true, take the high path.

if secretB == False:
hero.moveXY(44, 32)
hero.moveXY(44, 15)

hero.moveXY(50, 24)


Copied code from where? If you copied it from here in Discourse then it won’t work. We don’t allow anyone to post working code. We only allow code that isn’t working so we can help you fix it.

Please learn to post your code properly with formatting. Directions are here.


but i copied it from my codecombat account…
not from the discourse!
and i did exactly what the video did… would you help please?


Your computer doesn’t work any different than anyone else’s. If you had followed instructions then the code would display with the proper formatting.

What video? Please provide a link to this video because I don’t know what you mean.


There’s a video guide attached to the level if you’re a subscriber.


Hmmm finished the level!
Just found out you needed to PLACE the flag for it to work!
Also found out that the hero will auto set routes if the flag is around a corner… still works! And it’s faster!
No more slow hero!


I need help with Mind the trap! What is wrong with my code?!

while True:
    flag = hero.findFlag()
    enemy = hero.findNearestEnemy()
    Distance = hero.distanceTo(enemy)
    if flag:
        # Pick up the flag.
    elif enemyDistance < 10:
        # Only attack if the enemy distance is < 10 meters

Help plz


Wait solved it:sweat_smile:


yay that comment is much shorter now