Hello there, I’ve having issues with time out in Hypersonic using python. After some logs, I found out that not all entities are being sent to the input, so the (inital) code is waiting for them. Here is a picture of how my read input code looks like and the output.
(Copy the hole url since I can’t post images since im “New” (I’m Master so wtf)
Anyone has encountered this before? any idea of how to solve it?
stdout are not synchronized. I don’t think this points to a lag in reading the input but rather to a processing code which gets outside the time/round limit
I find it really hard to believe since my code is still really simple and does not have any high demanding computing. I’ve been coding for 10 years now, and this should be done instantly.
And I’ve been coding for 15 years and I see a problem in the code that you shared.
Try adding flush=True to your prints, it is possible that the code is stopping further down, and you’re just not seeing the full stderr log.
And I’ve been coding for 30+ years and I still can’t post my first version of HyperSonic
Oh well, I really needed to hack that thread, I couldn’t refrain sorry
OP; did you get this resolved?
I’m running to the same issue. It’s pretty easy to validate that the timeout isn’t caused by any running code by having (flushed) debug lines right before and after input() calls. At times (usually when the board is pretty empty), some of the powerups (the last one in all the cases I’ve seen) simply aren’t given as an input.
I am experiencing the same, usually after all boxes are destroyed, but can also happen few rounds before. I use python3 as language.
My issue was not flushing output at every point possible, as I thought I was doing. Thanks for the tip JamesMcG! My log function now reads (maybe helpful to someone):
def log(to_log, newline=True):
print(to_log, file=sys.stderr, flush=True, end='\n' if newline else '')
I’m also having the same issue on python3.
Basically, the entities variable suggests more lines than input actually has.
I tried flushing at every point (like zepp_dev suggested), but it didn’t help.
Here’s the example for the game when it happens.
Just to clarify, the flushing didn’t solve the timeout, it just helped me realize where my bug was. Before I didn’t see all my debug lines and that left me with an impression that I didn’t receive all input. So be sure to log out all the input you get to verify there’s an actual issue.
The flushing helped me realize as well where to look for the issue. Fixed and now everything works fine.
Thanks for answer! That’s right, now I can see where the problem is (in my code).