This is supposed to be coding practice though. It's like if the task was to sort a vector and you used R's built-in sort() function. Yeah... that works, but then what's the point? This is supposed to be a 6 kyu exercise, meaning it should take more than using a built-in function to accomplish.
I understand. I think there is a) not to reinvent the wheels, and b) write one's own code to show capability. Depending on the goals we may have different views, but I completely understand you.
Original reference solution appears to have been copy/pasted from some source as it includes code for using dice with other than 6 sides.
Original test cases test for a sum uniformly sampled from 10 - 40 and a number of dice uniformly from 2-7. This has the effect of approximately 43% of all test cases being degenerate, that is the target sum is larger than the highest possible total from the number of dice. New random test cases first select a random number of dice, then simulate that number of rolls and use that number as the target, ensuring there are no degenerate random cases. Degenerate cases are included in the sample tests. An assumption is made that degenerate cases are essentially the same so there is no reason for the random tests to include them.
Orgininal reference solution attempts a closed form solution for caluclating the probabilities. This solution, however, generates results outside the stipulated margin of error in as few as 36 dice.
This is supposed to be coding practice though. It's like if the task was to sort a vector and you used R's built-in
sort()
function. Yeah... that works, but then what's the point? This is supposed to be a 6 kyu exercise, meaning it should take more than using a built-in function to accomplish.Fixed broken R kata with a fork.
https://www.codewars.com/kumite/59b8ba985227dd140200000b?sel=5f6de9a0b0d883002923f25c
I understand. I think there is a) not to reinvent the wheels, and b) write one's own code to show capability. Depending on the goals we may have different views, but I completely understand you.
This makes the problem trivial and is therefore not a good solution.
Fixed Kata with a Fork: https://www.codewars.com/kumite/59b8ba985227dd140200000b?sel=5f6de9a0b0d883002923f25c
You can comment in the already open issue. Or try to fix the problem with a fork.
Yep, still an issue half a year later.
Duplicate issue.
R Kata still broken 5 months later.
Fixed R translation added which eliminates the triviality of the exercise in R.
https://www.codewars.com/kumite/5cc0d38e449d880019738cb8?sel=5f62ec06ab84150019b4e598
Any chance I can get someone to help me clean up the collective mess of R katas?
Corrected R translation added.
https://www.codewars.com/kumite/59f66c4025d5756d340000fb?sel=5f629d84e4729a002391aa93
Original reference solution appears to have been copy/pasted from some source as it includes code for using dice with other than 6 sides.
Original test cases test for a sum uniformly sampled from 10 - 40 and a number of dice uniformly from 2-7. This has the effect of approximately 43% of all test cases being degenerate, that is the target sum is larger than the highest possible total from the number of dice. New random test cases first select a random number of dice, then simulate that number of rolls and use that number as the target, ensuring there are no degenerate random cases. Degenerate cases are included in the sample tests. An assumption is made that degenerate cases are essentially the same so there is no reason for the random tests to include them.
Orgininal reference solution attempts a closed form solution for caluclating the probabilities. This solution, however, generates results outside the stipulated margin of error in as few as 36 dice.
New code performs tests with up to 400 dice.
This comment is hidden because it contains spoiler information about the solution
Nice recursive solution, but will hang for any modestly large number of dice, e.g.
Loading more items...