Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Anyone know if applicative parsers are possible to do in Ocaml? (I know monadic ones can be done). I made an attempt at a translation, but Ocaml complains
when I try to actually use the mutually recursive functions I wrote in my Haskell version (exprP, binP, etc). I'm not sure if I'm doing something wrong or if this is a limitation of the language, I would appreciate it if anyone can take a look at my translation.
My solution passes all the test cases but gives the error:
All of my answers were one line calls to scanl so I'm not sure what it's upset about. It possible to fix this one? It's a pretty fun problem.
The tests are correct.
Note the last few bullet points on the instructions:
In the test case generation 1 has already been populated. Notice that the state of the board just before
populate(generation2)
gets called.Relative to the blob (12 o clock is always up).
"every blob whose size is larger than the smallest blob size value will move to one of the 8 spaces immediately surrounding it in the direction of the nearest target blob with a lower relative size."
Ok, I'll keep working on it. I'm up to 312.
It does seem strange that if the number of tests (and presumably the variables in each) are random that I'd successfully complete the same number most of the time though.
Edit: Nevermind, I figured it out. Good kata!
Python 3. I tried changing my board from a dictionary to a list of lists instead but I still get the same result.
When I add a print statement to the top of move it either still times out or I get this result:
Full Test Suite
PRELIMINARY TESTS
FIXED TESTS (38 of 38 Assertions)
RANDOM TESTS (259 of 259 Assertions)
STDERR
Execution Timed Out (12000 ms)
Is it just too slow?
Hi, my code runs fine on the sample tests and the first part of the assertions, but fails on the random tests. Initially it was crashing in a few places (I'm guessing when trying to call move() with no blobs), but now my code just times out when I try to sumbit which makes debugging difficult. Any hints on how to procede?
This comment is hidden because it contains spoiler information about the solution
Thanks, it works now.
I don't see any difference in the description, but I changed my code to return an array and now it times out some time after
sum_john 99
.I must have missed the part in the description where it said that only arrays and not lists would be acceptable.
In OCaml, I get the expected result when run localy, but when attempting to run the sample tests I get the error:
File "(stdin)", line 49, characters 23-26: Error: This expression has type int list but an expression was expected of type int array
Line 49 is beyond my code (20 lines).
I think the issue is that the kata explicity mentions the naive forumla for calculating nCr, but doesn't make any mention of the fact that opimizations are required to actually run on larger inputs. I think this is a harder than 6kyu problem for that reason.
Loading more items...