[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.

Thanks

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:
image

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.

1DD2UD44U4443LR111111222LL3323UU;DDD;LLLL;UUUU;RR

This solves the 14th testcase (named ā€œTestcase 9ā€) using functions.

Thanks, I get it now.