I just had an error while running against the AI in my IDE:
The game has crashed. Please contact the author and enclose the following error:
java.lang.NumberFormatException: For input string: "3881335696"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.valueOf(Integer.java:983)
at com.codingame.game.CommandManager.parseCommands(CommandManager.java:74)
at com.codingame.game.Referee.handlePlayerCommands(Referee.java:88)
at com.codingame.game.Referee.gameTurn(Referee.java:80)
at com.codingame.gameengine.core.GameManager.start(GameManager.java:122)
at com.codingame.gameengine.core.RefereeMain.start(RefereeMain.java:67)
at com.codingame.gameengine.core.RefereeMain.main(RefereeMain.java:50)
We are aware of this visual oddity, we plan on changing the animation to make what is going on here much clearer.
Basically, in the viewer the payment of the read-ahead tax happens at the end of a frame, but in the game logic, ingredients are committed to the payment at the strat of the frame, and they are only placed onto the tome at the end of the frame. This “commit ingredients for payment” notion isn’t animated yet. Stay tuned for that update.
Hello, I’m working with swift in this challenge, and I get an error when conforming to AdditiveArithmetic protocol. It works fine in my Xcode editor (Version 12.2 (12B45b), swift 5), but I get “type ‘List’ does not conform to protocol 'AdditiveArithmetic’sourcekitd” in the coding game editor during compilation. this protocol is available in Xcode since v10.2 as mentioned here https://developer.apple.com/documentation/swift/additivearithmetic#see-also. It seems like this protocol has been added in version 5 of the swift standard library as the documentation here https://swiftdoc.org/v5.1/protocol/additivearithmetic/ is not available for previous versions.
Can you confirm that the coding game system uses the standard swift library and which version of it please ?
EDIT : I found a post where it states that the swift language has been updated to v5.1.1 here Languages update
In the end I still don’t know why I get an error message.
Hi,
I’m doing the challenge in js and I have noticed some random spikes in timing that causes some random timeout.
Because of that, I have to limit my algorithm to stay bellow 30ms instead of the authorized 50ms, in an attempt to absorb those spikes (but it is not always enough and I loose a non-null fraction of game because of timeout).
Apart from the watchdog i had to put in, my algo is deterministic, so launching with the same conditions should not yield different results.
When I’m in the ide, I also get the timeouts, here relaunching using the same conditions usually fix it.
It is hard to debug this issue without access to the environment.
Maybe the GC run during some turn, if that is the case it could be solved by calling explicitly global.gc() between turns (or at least expose it so we can call it in our code).
I would love to continue the challenge in JS, but if this cannot be solved I’ll switch to cpp.
The amount of work i can do under those 30ms also seems to vary depending on when i launch the code.
An other idea to mitigate timeout issues due to spikes: instead of stopping the game on a strict timeout, do a sliding average (ie if you take less time on a turn, it gives you extra time on the next)
“Warning: your code did not read all available input before printing an instruction, your outputs will not be synchronized with the game’s turns and unexpected behaviour may occur.”
Each time I get it, my code ends up in timeout error otherwise it runs well.
I am wondering if it is a real timeout error or something else ?
Same here, performance isn’t very consistent with ts/js.
I’ve had to put a timer check in several of my loops conditions to exit as soon as things are getting hot, which may or may not happen, restarting the same game several times can give different results.
Please refer to @eulerscheZahl answer above. I am new here, so I didn’t know myself but you can time your bot to end in time if you program it correctly. I choose C, so I have no GC to worry about but still, stopping all calculations even with GC running should not cause you to time out.
The CodinGame server is sometimes generous and let you slip above 50ms if it’s just a spike. I have seen it many times before. If your average is low, a spike of 60 ms will not time you out. With C language I can consistantly end everything at 49 ms. @eulerscheZahl’s bot was outputting debug message with similar output, consistant 49 ms, no spike and he is with C#.
Experiencing some weird timeouts as well with Python 3.
I timed everything, from (just after) the first input().split() to the final print statement and I’m always way under 10ms.
After trying to debug a bit it seems that the last input().split(), containing the data of the opponent, randomly times out…not sure where to go from there…
Thanks for the answer but I was aware of the inputs/timer constraint.
I’m talking about post inputs computations that can take varying amounts of time when comparing the same turn between 2 replays.
UI Request : it would be practical to have a visual hint on repeatable spells, so we don’t have to hover all of them (especially the opponent’s one) to get the information.
Yes exactly: the issue is for post-input code that takes a variable amount of time for the same work.
Even with a code that most turn take less than 10ms it can spike and timeout randomly. I’ve also seen some turns where indeed the program is not killed while taking 60ms, but the problem here is that it is completely random and our code have to account for worst case scenario.
Same here (have to keep it bellow 30ms, I have lag spikes ranging from 2ms to 20ms).
From my understanding, it’s due to the garbage collector of JS which can be very unpredictable. If it’s this, I think there’s nothing we can do about it …
Maybe using object pooling, not using array and splices… But you kinda miss the point of using JS then.