[Community Puzzle] Bender - Episode 4

Feel free to send your feedback or ask some help here!

Puzzle link: Bender - Episode 4.

There seems to be some odd bug - and I’m not sure if it is on my side:
Submissions almost always fail on validator 30, while the solutions pass locally.
It didn’t happen before my last update of the game, but I’m pretty sure that my changes are not related to crashes on that validator.
@dbdr scraped an error message implying, that this line gets no testcase input, resulting in a crash at get(0).

Hello eulersheZahl,

First, I would like to tell you I like this puzzle very much. I’m not convinced with the function thing but I guess the best coders will get an equal optimize solution without it.
For my part, I don’t pass the validator you mention (30) but don’t pass neither the validator 16 but I pass all tests!
Is there something special with validator 16?
I wrote my solution in python 3.


I generated all but the first 5 introduction testcases by the same script, so validator 16 should not be special. You can see the input on github.
To test locally, clone the repository, import it as a maven project (e.g. with eclipse or IntelliJ) and call your bot like this + outcomment line 7.
Here’s a screenshot:

Thank you! Found the problem.
I just copy the input in my code because I couldn’t make it work with eclipse (the method addAgent is undefined).

whoops, should be setAgent.
The comment is from a previous version of the SDK, the method name for single player games changed.

Yep I supposed that and try with setAgent but it didn’t work neither but I don’t know eclipse so there’s probably something I missed.

PS: I just get the following error on test 30
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:657)
at java.util.ArrayList.get(ArrayList.java:433)
at com.codingame.game.Referee.init(Referee.java:39)
at com.codingame.gameengine.core.GameManager.start(GameManager.java:111)
at com.codingame.gameengine.core.RefereeMain.start(RefereeMain.java:69)
at com.codingame.gameengine.core.RefereeMain.main(RefereeMain.java:52)

You were able to reproduce that crash locally? Because I failed to do so.
Only for the last validator, or others as well?

How does your setup look like?
Namely operating system, Java version

Just get the error on the test 30 (not validator). It happends twice.

Windows 10 and Java 8 JRE and last version of eclipse

Hm, interesting.
I’ll see if I can somehow reproduce these crashes too. For now I’m completely clueless

Edit: for testing purposes I made the last validator a regular testcase, not crashing either :rage:

Ok I tried and everything is ok for me too :confused:

I just re-uploaded the game without any changes, seems to work again.

First submit: crash on validator 27 and 30 and second submit crash on validator 30

(╯°□°)╯︵ ┻━┻

My python3 solution with some not well bounded DFS searches often gets an “Invalid path” from the game, even though likely it is in fact timing out or some other crash (OOM?). Furthermore, it seems to be scrapping most of the log-output, which all together is somewhat misleading and not very helpful during debugging. Did anyone else notice a similar behaviour, or did I maybe miss something else somewhere?

Looking at the puzzle again, I admit that the error message isn’t helpful: it doesn’t distinguish between timeout, no answer at all, a path that is too long, a path not leading to Fry.

But I’m scared to change it and update the puzzle, that would wipe out the leaderboard :fearful:

Ah, makes sense! Anyway, the missing log messages on the other hand were simply one very long line of output running into the limit. Together they confused me, but as long as one keeps the output short enough, having some log close to the final submission of the answer is easy enough to determine a timeout.

I do not understand how functions in the output work. Can anyone please provide an example? Thanks.


This solves the 14th testcase (named “Testcase 9”) using functions.

Thanks, I get it now.