FITD.hs 360 B

123456789101112131415161718
  1. module Rolling.FITD (roll) where
  2. import Rolling.Common
  3. judge :: Int -> Result
  4. judge n
  5. | n <= 3 = Failure
  6. | n <= 5 = Partial
  7. | otherwise = Success
  8. roll :: Int -> Prob Result
  9. roll 0 = normalize $ do
  10. a <- die 6
  11. b <- die 6
  12. return (judge (a `min` b))
  13. roll n = normalize $ do
  14. dice <- sequence [ die 6 | _ <- [1..n] ]
  15. return (judge (maximum dice))