Logical Conclusion Assistance


#1

Can someone help me with figuring out what is wrong with my code for the level “Logical Conclusion”? It fails at the zso variable every time. Thank you!

// Move to Eszter and get three secret values from her.
hero.moveXY(24, 16);
var secretA = hero.findNearestFriend().getSecretA();
var secretB = hero.findNearestFriend().getSecretB();
var secretC = hero.findNearestFriend().getSecretC();

// Say “TRUE” to Tamas if A AND B are true, OR if C is true. Otherwise, say “FALSE.”
// Remember to use parentheses to do your logic in the proper order.
var tam = (secretA && secretB) || secretC;
hero.moveXY(19, 26);
hero.say(tam);

// Say “TRUE” to Zsofi if A OR B is true, AND if C is true. Otherwise, say "FALSE."
var zso = (secretA || secretB) && secretC;
hero.moveXY(26, 36);
hero.say(zso);
// Say “TRUE” to Istvan if A OR C is true, AND if B OR C is true. Otherwise, say "FALSE."
var ist = (secretA || secretC) && (secretB || secretC);
hero.say(ist);

// Say “TRUE” to Csilla if A AND B are true, OR if B is true AND C is NOT true. Otherwise, say "FALSE."
var csi = (secretA && secretB) || secretB && !secretC;
hero.say(csi);


#2

When you say it fails. Are you getting an error or are you failing the level? If your failing the level maybe your coords are not exactly on the X.

Can you also format your code by using three back ticks before and after the code. Its the key right next to the 1.

// Move to Eszter and get three secret values from her.
hero.moveXY(24, 16);
var secretA = hero.findNearestFriend().getSecretA();
var secretB = hero.findNearestFriend().getSecretB();
var secretC = hero.findNearestFriend().getSecretC();

// Say "TRUE" to Tamas if A AND B are true, OR if C is true. Otherwise, say "FALSE."
// Remember to use parentheses to do your logic in the proper order.
var tam = (secretA && secretB) || secretC;
hero.moveXY(19, 26);
hero.say(tam);

// Say "TRUE" to Zsofi if A OR B is true, AND if C is true. Otherwise, say "FALSE."
var zso = (secretA || secretB) && secretC;
hero.moveXY(26, 36);
hero.say(zso);
// Say "TRUE" to Istvan if A OR C is true, AND if B OR C is true. Otherwise, say "FALSE."
var ist = (secretA || secretC) && (secretB || secretC);
hero.say(ist);

// Say "TRUE" to Csilla if A AND B are true, OR if B is true AND C is NOT true. Otherwise, say "FALSE."
var csi = (secretA && secretB) || secretB && !secretC;
hero.say(csi);

I did not change the code all I did was make it easier for others to read this.

Edit: Its possible your failing because your not moving your hero to the next X. The hero ends up saying the other two secrets in the same spot.


#3

After you use hero.say(zso);, you’re not walking to the next location. Similarly, you’re not walking to the next location after you use hero.say(ist). After these two changes are made, the program will work flawlessly.

Edit: aand I just realized Ty_Ler already edited the fix at the bottom of his post. My bad. Still, that’ll fix it.


#4

Alright, I adjusted that so the hero moved and it now is submitting perfectly and we passed the level. Thank you taylerzy and Ty_Ler so much!