Logical Path Help


#1

I’m getting stuck on the very step, going from (44, 33) to (50, 24),
it just stays at (44, 33) and gets struck down by lightning!
I can’t find an answer to what I’m doing wrong. Please help.

// 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.
var secretD = secretA || secretB;
if (secretD) {
    hero.moveXY(32, 33);
} else {
    hero.moveXY(32, 15);
}
hero.moveXY(38, 24);
// If secretB is NOT true, take the high path.
var secretE = !secretB;
if (secretE) {
    hero.moveXY(44, 15);
} else {
    hero.moveXY(44, 33);
}
hero.moveXY(50, 24);




#2

What language is this? I only really know python, so if it’s another language I probably can’t help you. I do know an experienced player though… he might be able to help, if he knows this language.


#3

It might just be a bug.


#4

It is javascript, even if I don’t know the language

I can tell that the guy is saying secretE is assigned as not secretB
the script want the condition: if secretB is not True take the high path.

saying SecretE is not equal to secretB doesn’t mean secretB was not true.

actually if I understand it right, it mean that if secretB is false, then secretE is true and if secretB is True then secretE is False.

if we follow clearly the script,
if SecretE (meaning if secretE is True) move to y 15 (y 15 is the low path)
during that, SecretB is false. (which is why it doesn’t work since the script want the hero to take the high path when secretB is false.)

It would have been far more simple to just say if not secret B, move to the high path


#5

I changed the last part to the following but it’s doing the same thing. It’s going to 44,15 or 44,33, but from there it’s not going to 55,24. So it seems like the not secretB part is working, it’s just the last line that doesn’t work.

if (!secretB) {
    hero.moveXY(44, 15);
} else {
    hero.moveXY(44, 33);
}
hero.moveXY(50, 24);

#6

If you replace “if (!secretB)” with “if (secretB)” or the place of " hero.moveXY(44, 15);" with " hero.moveXY(44, 33);" , you will get the desired result:


if you have a pet use pet.debug(text)


#7

Got it! I had it backwards. Thank you!