Ad
  • Custom User Avatar

    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!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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 now 1 - size/3. array sizes < 50 is now 1 - size/2. Hopefully this satisfies this issue.

    Thank you!

  • Custom User Avatar

    I fixed the initial solution for Python, thank you for pointing that out! (if you click reset the change should show now)

  • Custom User Avatar

    Thanks for the suggestion! It's definitely a much cleaner and "professional" way of explaining things. I'll go ahead and change the description.

  • Custom User Avatar

    Whoops... fixed now, thanks.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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".

  • Custom User Avatar

    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!

  • Custom User Avatar

    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.

  • Custom User Avatar

    This should be fixed now, thank you.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Thanks a lot for the fork!

  • Custom User Avatar

    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!

  • Custom User Avatar

    Thanks for the suggestion, went ahead and changed the max to 1000.

  • Loading more items...