4 kyu

Dice rolls threshold

43 of 147kirilloid
Description
Loading description...
Probability
Combinatorics
Algorithms
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Very mathematical problem, nice kata however.

  • elmofre Avatar

    My received values walk next to the answer with an error of hundredths. I'm really shocked that the decision honestly did not go...Does anyone have a similar problem? Help.

  • benjaminzwhite Avatar

    This comment has been hidden.

  • Voile Avatar

    Python, sample tests:

    test.expect(abs(actual - expected) < 1e-4, actual)
    

    This line is incorrect.

  • Voile Avatar

    This problem can be done purely by mathematics, and is definitely not 3kyu. I'd say 5kyu at most.

  • bkaes Avatar

    Any reason why you don't use Rational (aka Data.Ratio.Ratio Integer) or Data.Ratio.Ratio Int instead of Double?

    • kirilloid Avatar

      Well, first of all I have not enough experience with numeric types in Haskell. So I analyzed this and it turns out that numbers are not as big as I though: log2 100^20, which is around 132 bits.

      And actually we don't need such precision. Even though I calculate everyting as Integers to the end in my solution. So I've tried to migrate to Rational and everything seems OK now. Do you think it worths changing?

      BTW I'd appreciate if you give me some good articles on when Haskell number systems. Cause hackage gives only very basic info.

  • yurket Avatar

    looks like a typo in the line: ... the probability of that a die with N sides rolled M times (NdM in AD&D notation) ... I suppose, it should be "(MdN in AD&D notation)", as previous in the description the examples are: P(1d6 >= 4), P(2d6 >= 3)