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.
Thanks, you just run it a bunch of times and see if the distribution statistics match.
https://www.codewars.com/kata/sql-disorder ?
There are some katas that require generating random numbers with a given distribution, I don't remember how good the tests are there. And anyway it's not really practical to go too far with the tests because using built-in randomness is easier than creating a bad custom generator. At least it should be checked that the distribution is uniform.
The tests swap actual / expected.
The rounding is inconsistent between price and sub-total, total. In one you are expected to write 1.50, in the other 1.5 .
Do you have an example of a kata where checks are made to ensure random items are being picked.
The tests are rather weak:
https://www.codewars.com/kata/reviews/5494861f305bd8a28500003e/groups/5b65a25e42890f6570001732
I edited the description to explicitly explain the constraints on which fields are stored. Thank you for your feedback!
The tests for an item's required keys breaks if you have additional keys. This is not specified in the description. Either change the tests or update the details.
Thanks. This is closer to the coding style I use at work. Figured I'd do it this way since the kata is business-related.
Thanks for the solution. Together with mortonfox's, these are both much more readable than mine. The only criticism I have regarding your solution is with
i.delete('description')
. Even though it fits the requirements of the kata perfectly, my intention with limiting the amount of keys for each item in the final Hash was more of a white-list(admitting only desired keys) rather than a black-list(deleting each non-desired key) approach. This is because I had in mind an inventory where each items has many more key-values than the ones we'd want to keep in the chart.However I certainly did not make that intention clear enough, therefore this solution serves as significant feedback, much appreciated!
Although this does not end up being a one-liner ( which is by default cool imo), it really enhances readability compared to my solution. thanks!
That while loop could be replaced by a simpler
sample(3)
:)Looks like an off-by-one.
White code challenge completed: Count: 93. Honor Earned: 0.
Yellow code challenge completed: Count: 99. Honor Earned: 99.
Blue code challenge completed: Count: 32. Honor Earned: 128.
Purple code challenge completed: Count: 7. Honor Earned: 63.
It looks like I received zero points for 93 white katas completed (instead of 1 point),
1 point for each yellow kata completed (instead of 2 points),
4 points for each blue kata completed (instead of 5 points),
and 9 points for each purple kata completed (instead of 10 points).
Not sure whats going on. You can debug the individual events that get summed here. Let me know if something looks off.
Loading more items...