The Winamax Sponsored Challenge doesn’t work with Clojure. Even when I use the auto-generated code I get exceptions when running the second testcase.
An exception is thrown right at the start of the second test case.
The issue seems to be coming from input value such as 5C. The read function tries to interpret it as an number (because it start with a number) but fails because of the C that follows.
As I understand to, 5C should be provided with surrounding double quote (“5C”) , or as separated values (5 then C).
For some reason, I am limited to C++/Java/Javascript/Python3/C/Go/PHP/Python/Ruby on that puzzle. That said, you should not need the quotes to parse it as a string. If some operation pushes the interpreter to try and cast to a number, use (str (read)) to force the right type at initialization.
Unfortunately, the error is triggered within the read function, so before str had a chance to cast it to a string.
I tried with a REPL : type (read), then input 5C (without double quote). Got the same exception error.
At this point, I do not see any solution to make it work on user side.
Well I finally managed to solve it by wrapping a (try catch) form around the read function.
Quite ugly, but it works. I now get all the inputs correctly and I can focus on solving the puzzle itself.
torleif, when you entered the puzzle, were the selected language Clojure, or did you chose it afterward?
I ask you that because Clojure shouldn’t be available for that puzzle so it may be interesting for the team to know that.
On a side note, when I go on AI bots challenge I did not played (PR, PR2, PCR), clojure is already selected. Though it might be a coincidence since there is a possibility that I changed the language on these puzzle to Clojure for testing purpose.
I’d suppose finishing the puzzle in Clojure wouldn’t really be a problem as long as you don’t apply to a job at winamax, but only someone from the team like @MaximeC can answer you.
Thanks for this chrm, very interesting.
I came to the same conclusion that read is trying to recognize the input as a valid syntax (being a form, a function, a number…), but your explanations make more sense.