Timeout: your program did not provide an input in due time (ver 3.0)

Hi I’ve googled and searched the forums here, but the 2-3 brief mentions don’t explain why this error is happening (I’m placing it in General as it seems others have the issue across all puzzles).
Myself, I’m on the Mars Lander part 2 puzzle in C#, and the last line is console writing the rotation and thrust each loop faithfully, so I’m not sure what the error is suppose to mean.

It’s explained in the mission intro that the lander must get inputs each second, which is why my last line:

Console.WriteLine(rotate + " " + thrust);

writing at the end of each loop is suppose to fulfill that condition right?

Lastly, I’ve seen a few people also have this issue, but their solutions are something along the lines of “Did you terminate the line properly?” or something (or perhaps the 2 solutions for Python and Perl don’t apply here?)

Thanks in advance and I hope this error can be both explained properly and also described in more detail in each puzzle to stop this happening in future. Thanks and awesome site!

writing at the end of each loop is suppose to fulfill that condition right?

That, and within the allotted time.

The common reasons for timeout are:

  • The code takes too long to output.
  • The code is stuck in a loop and does not output anything.
  • The code reads an input (for the next round) before it outputs an answer for the current round.
  • As you mentioned, newline is not included as part of the output.
  • The code takes too long to compile on CodinGame - this applies to certain languages only e.g. Groovy.
1 Like

Thanks for the reply. Could you elaborate what do you mean by ‘newline’?
When I add a newline to the start or end of the console command (which sends commands to the objective) it errors with:

Expected two integers but found ''

Which means the newline completely negated the output that was suppose to be sent out. E.g.

Console.WriteLine(rotate2 + " " + thrust + "\n"); OR
Console.WriteLine("\n" + rotate2 + " " + thrust);

When you use WriteLine, the newline is included, so you don’t have to add “\n”. But for certain languages, “\n” has to be explicitly added.

1 Like

You’re just breaking the while loop on certain conditions thus 0 output are sent

1 Like

Alright thanks for that. I’ve given up since I don’t think it’s any of the reasons outlined nicely by you.

  1. Too long to output? It’s barely 10+ lines when I troubleshoot and simple maths
  2. Code stuck in a loop, no output? Runs fine for 20 loops then error appears. No change in variables or decision-making for past 5 rounds (and subsequent round)
  3. Code reads and input before answer for next round? I forced the outputting of an answer each loop, even by naming it a constant
  4. Newline not included? I am using C# writeline
  5. Code takes too long to compile? Again I’m at the start of the chapter so I don’t think so.

Thanks though! I’ll have to give this puzzle a miss - I suspect that’s one of the reasons why it has so few solvers.

CG_SaiksyApo said:
You’re just breaking the while loop on certain conditions thus 0 output are sent

Thanks too for your helpful reply.
There are no breaks or anything that makes it out of the main while loop.
I’ll note your advice for future puzzles though so thanks again!

 // HORIZONTAL
if (X < landingX && rotate > -45) {
    //if (rotate > -45) {rotate2 = rotate2 - 15; poof = 0; }
    rotate2 = rotate2 - 15;
    
    if ( hSpeed > 10 ) {
        if (rotate < 45) {rotate2 = rotate2 + 15; poof = 1; break; }
    }
    
    if (X + ( hSpeed * 8 ) > landingX ) {
        if (rotate > 45) {rotate2 = rotate2 + 15; poof = 1; break; }
    }

    //if (thruston = false) { thrust = thrust + 1; }

}

if (X > landingX && rotate < 45) {
    //if (rotate > -45) {rotate2 = rotate2 - 15; poof = 0; }
    rotate2 = rotate2 + 15;
    
    if ( hSpeed < -10 ) {
        if (rotate > 45) {rotate2 = rotate2 - 15; poof = 1; break; }
    }
    
    if (X - ( hSpeed * 8 ) < landingX ) {
        if (rotate < 45) {rotate2 = rotate2 - 15; poof = 1; break; }
    }

    //if (thruston = false) { thrust = thrust + 1; }

}

Theses break were breaking the while loop.

2 Likes

Careful with those ifs Eugene! :smiley: