Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

[SOLVED] Help with "logical path"


#1

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


#2

rewrite true and false to True and False.

edit:
type
if secretA or secretB == True:
and
if secretB == False:


#3

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


#4

thanks @Seojin_Roy_Lee it worked after i did that


#6

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.


#7

Put [SOLVED].
(20 chars)


#8

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


#9

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


#10

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)
else:
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)
else:
hero.moveXY(32, 15)

If secretB is NOT true, take the high path.

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

hero.moveXY(50, 24)https://codecombat.com/play/level/logical-path?


#11

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.


#12

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


#13

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.


#14

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


#15

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!


#16

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)

Help plz


#17

Wait solved it:sweat_smile:


#18

yay that comment is much shorter now