Bug in Skynet -the Chasm?

Hi so I wrote a code in Java but in Testcase 1 it goes into the if-statement which prints out false and it does the wrong thing. In Testcase 2 though it does the right thing and does not go into the false if-statement and I succeed. It is the same code and I checked with the syst.err.prntline.


you do realize that without your code, your message is completely impossible to understand right ?

Are you sayinig the code in a if block is executed whereas the condition of the if is false ? If that’s what you say my hint would simply be: re-check your code and the condition of the if. Obviously you’re not printing the same thing you’re testing. Or you’re not going in the if on one iteration and going in it in another (remember you’re in an infinite loop).

And for further questions in the forum, remember that the answer you get can only be as precise and as clear as your question is ! The rule of not posting full code sometimes makes it harder to clearly explain a problem but it’s always possible to track down your issue enough to expose it clearly without spoiling.


Thanks colin for answering,

nvm my code is buggy.

We ask for not displaying a full solution, but you can still share parts of your code relating to the problem.

Like the if + condition and what correspond to variables in the condition.

        if ((coordX >= start && (road-coordX-1) > 0) || (speed == 0 && (road-coordX-1) > 0)) {

that is the if condition, in the variable start I calculated at which point he needed to speed up. So I end up right in front of the gap and (road-coordX-1) should be zero, which should fail the if condition, but I still get a SPEED printed out, but in Test case 2 and 3 I do get a JUMP printed out when he is right in front of the gap. The Jump condition is when (road-coordX-1) == 0. But since I have not implemented when the speed is not zero, I will just try that and look if it works then.
Thank you for taking your time to reply, I appreciate it.

Just two reminders to help you:

  • there’s a debug mode on the display of the puzzle (where you can see the moto on the bridge) that is very helpful on this (and some other) puzzles. Just click on the settings icon (small gear in bottom right of the puzzle display, next to the fullscreen icon)
  • you can print deubg info on standard error (System.err.println) which would allow you to check the values of coordX, start etc … to understand why the condition is true whereas you expect it to be false

Although you probably already know it it’s always better to be sure.