The Great Escape - Bug ? - Input() timeout


#1

Hi !
I’m having a problem with the Great Escape, sometimes my input() retrieval never goes through the last wall.
I retrieve the input() for each playerCount, then I retrive wallCount and get input() for each wallCount.
And sometimes, when a wall has been added either by me or another player, I retrive all walls except for one, and the program stops due to timeout, I’m eliminated.

And I tired many things and can’t manage to understand when and why that happens, and what I could do about it.

Thanks !

This is my last input retrieval code in python3 :

inp=[]
for id in range(playerCount):
    inp.append(input())
    print("input=%s"%(inp[-1]), file=sys.stderr)
wallCount=int(input()) # number of walls on the board
print("input wallCount=%d"%(wallCount), file=sys.stderr)
for id in range(wallCount):
    inp.append(input())
    print("input=%s"%(inp[-1]), file=sys.stderr)

#2

Same problem here:

for i in range(wallCount):        
    print("input=%s"%(input()), file=sys.stderr)

prints correctly the wall to the stderr.

but if I write the following:

for i in range(wallCount):                
    texte = input()
    print("input=%s"%(texte), file=sys.stderr)

I get:
"Timeout: the program did not provide 1 input lines in due time… ME will no longer be active in this game.
Summary for round 2:

Getting a bit crazy until I looked for info on the forums. (long time without programming, so checking everything that I can think of)


#4

I’ve tried timing, but I’m way inside the time limit with a turn under 25ms.
And if I change the starting positions, I don’t explode.

My actual test is a 1v1 me against someone named kingofnumbers with these settings :

height=9
positions=4 0 8 3
width=9
symmetric=false

If I move him at 1 instead of 0, I go fine.
Well I’m lost there…


#5

Ok, it turns out that it’s really a timeout.
At least I think it is.
But it does not happen there, I guess some stderr messages don’t go through, and the system kills our program not precisely when the timeout is occurring, or something like that.

I sped some things up, and it works.

It was the moment when the program was killed that was misleading, always when retrieving the last wall.


#6

I encountered the same problem and thanks to you I understood what’s wrong. I think output is buffered and all output before next “input()” is not printed.
To print it you should use print(“something”, file=sys.stderr, flush=True)

Also there is larger limit on first turn, and I spent 0.5 seconds on first turn and failed on second turn, so I thought there was some error


#7

In most of multiplayer games, first turn has a 1 second timeout and all other turns has a 50ms timeout. But The Great Escape is an old multiplayer puzzle so the other turns timeout is probably 100ms. It should be writter at the end of the statement.