# Bug in submission of Skynet Chasm

In the Skynet Chasm puzzle, my code passed all missions successfully in the IDE, however, when I submit the code, two missions are highlighted as unsuccessful. When I play those two missions, I find the behavior different from that in the IDE, but the code is the same!

Here’s my code:

int main()
{
int R; // the length of the road before the gap.
cin >> R; cin.ignore();
int G; // the length of the gap.
cin >> G; cin.ignore();
int L; // the length of the landing platform.
cin >> L; cin.ignore();
// game loop
while (1) {
int S; // the motorbike’s speed.
cin >> S; cin.ignore();
int X; // the position on the road of the motorbike.
cin >> X; cin.ignore();
int remainingStepsOnRd;
if (S)
remainingStepsOnRd = (R - X)%S;
if (S + X > R && X <= R) cout << “JUMP” << endl;
else if (X > R) cout << “SLOW” << endl;
else if (S < G) cout << “SPEED” << endl;
else if ((S*S + S)/2 - S >= G - (S - remainingStepsOnRd) + L)
cout << “SLOW” << endl;
else if (S - remainingStepsOnRd >= G)
cout << “WAIT” << endl;
else if (S - remainingStepsOnRd < G)
cout << “SPEED” << endl;
}
}

I have similar problem, but only with the first test case. It passes in IDE, but fails on submission. Didn’t find a solution yet…

What if S == 0? Do you just leave that poor remainingStepsOnRd uninitialized?

Ok, let’s suppose that S > 0… let’s see what we have here (the fact that I have like 3 small ifs for this problem, with no sanity checks, kind of makes me feel bad for my implementation)

R = 3
G = 1
L = whatever… let’s say… 7
S = 1
X = 0

so, the only good result should be “SPEED”, “JUMP”, “SLOW”, “SLOW”, which is nothing fancy to confuse the program.

remainingStepsOnRd = 3%1 = 0
if (1 + 0 > 3…
else if (0 > 3)…
else if (1 < 1)…
else if ((1*1 + 1) / 2 - 1 >= 1 - (1 - 0) + 7) …
else if (1 - 0 >= 1) “WAIT”

case closed!

I’ve a similar issue but on test 4. All test are ok during the development phase, but during the submisison process it fails.

I believe that the generic solution isn’t trivial and passing all tests in the IDE doesn’t mean to be able to drive correctly the bike through every scenario. Probably the tests in the submission process are a little bit different.

Probably

I had the same issue, I am new to CodinGame. Seems great so far! But some bugs are still there.

My solution was to commit again and BANG! had 100% ^^