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.
Really enjoyed this kata!
Found it! \o/
For future solvers, I found a collection of whitespace programs here. Compiling and tracing those helped me figure out what was going on.
Ack! I'm almost done except for "Testing conditional and unconditional jump functionality", tests 5 and 6:
I don't know what the actual tests are, but I'm able to write tests that should loop from 3 down to 1 or 0, and they pass:
Any clues for how to diagnose this case further?
This was a lot of fun! I haven't written an interpreter in a long time. I found Ruslan Spivak's series of articles to be very helpful.
This comment is hidden because it contains spoiler information about the solution
I had trouble passing the exception raising test for an invalid rank. I kept catching it at the place it causes trouble and raising it up to the calling function, but that wouldn't satisfy the test suite. Instead, I had to manually check that the rank was valid within
inc_progress
.I think
test.expect_error
should be more tolerant and allow errors to be raised from anywhere in the call stack.Nice job with the docstring
Wow, this kata took me from binary long division to DFAs to Arden's Theorem. It was very tempting to google for a solution but I'm glad I didn't.
This is O(n^2) in time isn't it? It requires computing all n+1 Fibonacci numbers. But given andreidemin's comment, you only need one Fibonacci number.
Sorcery!
Interesting idea. The general solution to this 3rd order linear difference equation is a
linear combination of exponentials r^n, where r is a solution to x^3-x^2-x-1 = 0. There are
three roots r, two of which are nonreal. To find the coefficients, a 3x3 system of linear
equations needs to be solved.