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.
Python translation
Nice kata by the way!
So for random test cases, you should definitely look at katas you've solved and see how they implemented random tests into their kata so you get a good idea and a good variety of implementations. You can't really "follow along" with a guide because creating random test cases varies from kata to kata.
For starters, I'll answer your question that you asked in your reply. You need to create a private method of the solution inside of your test cases. So then when you call
assertEquals(correct output, user's output)
, you can just call your private solution method in order to see if the user's solution was correct. Again, look at katas you've solved to get a better idea of this.For this kata in particular, I would recommend you make an array that keeps a pool of words it can randomly take from instead of just adding empty strings everywhere that isnt't a snark location (just makes it look nicer I suppose). Have some sort of "chance" (maybe like a 9/10 chance?) that there is a snark and insert it into a random location in your array. Then randomly assign integer values into the "Boojumeter" array. For this I would recommend to make it a pretty small bounds in order to ensure that there's a good chance of 0-14 being assigned (so it's not always a Boojum).
I hope this steers you in the right direction, and I hope you continue to author more katas in the future!
This comment is hidden because it contains spoiler information about the solution
First, I added two new example test cases that should further illustrate the goal of the kata.
Second, I made it more likely to create duplicates, for
array sizes >= 50
, the range of random inputs is now1 - size/3
.array sizes < 50
is now1 - size/2
. Hopefully this satisfies this issue.Thank you!
I fixed the initial solution for Python, thank you for pointing that out! (if you click reset the change should show now)
Thanks for the suggestion! It's definitely a much cleaner and "professional" way of explaining things. I'll go ahead and change the description.
Whoops... fixed now, thanks.
Why should I have to tell you what to do with them? I gave you all the pieces to the puzzle. If I gave anymore information out I'd basically be giving the solution away. But anyways, I went ahead and added an extra hint at the bottom of the description.
The coordinates represent squares on the chessboard. I went ahead and clarified this in the description. That n*n comment was a type, I forgot to put "chessboard".
I went ahead and added those two cases to the example cases but that solution should no longer work as you stated in a previous comment. I also fixed the snake_case and the initial solution setup. Thanks!
I took this into account, I fixed it for both Java and Python as well. Thanks! I'll keep this in mind for other katas I may make.
This should be fixed now, thank you.
Thanks a ton for catching this, I originally told myself to add this but it completely slipped my mind once I actually got to the random test cases.
Thanks a lot for the fork!
I changed the suggestions for 1, 2, and 4 but I'm not good enough at Python to really change it from a matrix to tuples. If you could, could you fork and show me the change? Thank you for the suggestion!
Loading more items...