Logical Path Error?


#1

Stage: Backwoods Forest
Level: Logical Path
Language: Python

The last suggestion to navigate the maze seen below does not work.

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

Instead, It should say, # If secretB is NOT true, take the low path.

I’m not sure if this is a new bug because I have seen tutorial videos on youtube where the level does work properly.

This is my high path code that does not work.

# 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 or secretB:
    hero.moveXY(32, 33)
else:
    hero.moveXY(32, 15)
hero.moveXY(38, 24)
# If secretB is NOT true, take the high path.
if secretB != "true":
    hero.moveXY(44, 33)
else:
    hero.moveXY(44, 15 )
hero.moveXY(50, 24)

This is my low path code that does work. The only difference are the if else y-coordinates in the last section.

# 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 or secretB:
    hero.moveXY(32, 33)
else:
    hero.moveXY(32, 15)
hero.moveXY(38, 24)
# If secretB is NOT true, take the high path.
if secretB != "true":
    hero.moveXY(44, 15)
else:
    hero.moveXY(44, 33 )
hero.moveXY(50, 24)

#2

I am not sure but I think your last if else statement should look like this

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

the True should be a light faded blue color I think. The reason your other “wrong” code works because it’s checking if it’s true so swapping it works.


#3

"true" is a string. True (python) is a boolean.


#4

Thank you. You guys were right.