Created
June 11, 2017 13:41
-
-
Save furu/0492cc654b3e81a6066a7da64d83fed2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Random | |
main :: IO () | |
main = do | |
gen <- getStdGen | |
putStrLn $ message $ dice1d100 gen | |
dice1d100 :: StdGen -> Int | |
dice1d100 gen = fst $ randomR (1, 100) gen | |
message :: Int -> String | |
message n | |
| n <= 5 = "サイコロの結果は" ++ show n ++ "で、クリティカルです!" | |
| n >= 96 = "サイコロの結果は" ++ show n ++ "で、ファンブルです!" | |
| otherwise = "サイコロの結果は" ++ show n ++ "です!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment