I need some help with “logical path”
here is a picture of the error:
rewrite true and false to
if secretA or secretB == True:
if secretB == False:
Would you use the </> sign to put your code?
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.
:(:( 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?
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 EITHER secretA or secretB is true, take the high path.
if secretA and secretB == True:
If secretB is NOT true, take the high path.
if secretB == False:
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. hero.pickUpFlag(flag) elif enemyDistance < 10: # Only attack if the enemy distance is < 10 meters hero.attack(enemy) hero.attack(enemy)
Wait solved it:sweat_smile: