Logical Path: Is this level bugged? [SOLVED]


#1

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)

Whenever I try to make the code work, it either tells me there is a code error or it doesn’t work. Can anyone help me?


#2

`


#3

Ouch. The formatting hurts.

But I get where you went wrong.

It’s

if not secretB:
    hero.say("I am doing this because secretB is not true!")

#4

Thank you so much! It works now.


#5
// Get two secret true/false values from the wizard.
hero.moveXY(14, 24);
var secretA = hero.findNearestFriend().getSecretA();
var 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.
var secretC = secretA && 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 === true || secretB === true) {
    hero.moveXY(32, 33);

// If secretB is NOT true, take the high path.
}else{ 
    if (secretB !== true) {
        hero.moveXY(32, 33);
    }
}
hero.moveXY(38,24);
hero.moveXY(44, 15);
hero.moveXY(50,24);

Alright so I got part way through okie dokie and then the instructions just kind of tailed off… I decided to continue through the points with hero.moveXY, I’m pretty sure I can keep repeating the true or false equation until I get to the end (going to try that now) but why do the instructions just trail off? (I got mission success for this) (Javascript)

::edit:: I tried rematching the true false parameter to move ahead and it didn’t work. (Also it doesn’t make sense the first string tells me no matter the answer go north)


#6

I need help too.

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

Did it


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

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

You need to format your if conditional statements as per the instructions. The first one, the one that was already done, is an example of how to do the next two.


#8

Correct Answers:

Mod edit:

(Solution removed)

Please do not post solutions. Feel free to post your non-working code when asking for assistance, but no final solutions are allow on this board. Thanks.


#12

The edit is removed. Thanks for bringing it out.