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.
It's just recursion ;-)
really cool solution!
I have to say it is a ugly feature of ruby to use
%
for formatting. I would rather usesprintf
or other helper methods to achieve this.I think
total
is better, it stands for the sum of all previous results.Maybe you return string instead of number?
This is so clever. I didn't know
String.prototype.replace
's real power!Cool ;P
"Test Failed: Should parse numbers - Expected: 3, instead got: 3", WTF is this!?
<pre>+text+</pre>
is awesome idea! Added that.No worries. It needen't be too hard to randomly generate text for this. You could have a list of words to use (or maybe just use the lorem ipsum text as a basis) and pick words at random from there. But the text doesn't really have to make any sense; you could just have random jumbles of letters and numbers (
Math.random().toString(16)
for example).Another feature you could add is to (particularly on fail, but maybe just do it anyway) display the aligned text (
<pre>+text+</pre>
). If it's part of a failed test, you could put the coder's solution to the side of it to make it easier to see how different they look. This would also reinforce how it all lines up instead of it all being in the coder's head.Thank you very much for you feedback, I did my best :) Great idea to randomize the order of the widths! Also I thought about randomly generated text for the test, but it looks a bit complex, like another kata :) Anyway, thanks, and I wish you luck with your kata.
Great job. Solid explanation, and good tests. You could randomise the order of the tests (the widths, anyway), just to make sure there's no easy cheating, and perhaps to show up some possible weird bugs in the solution. I've been working on a similar kata myself, using some real gathered (hard-coded) character widths to measure with. Never got round to sitting down and figuring it all out. If I do get it done, it'll be thanks to this kata! ^^
Yep, pretty similar logic. Solved yours kata as well :) Thanks for the feedback.
I suggest you to add some trivial examples. That would help others solve this kata.
Thanks :) I will probably change the difficulty. It needs MOOOAAR solutions :))
Loading more items...