diff options
Diffstat (limited to 'dice.orang')
| -rw-r--r-- | dice.orang | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,14 +1,14 @@ | |||
| 1 | def dice sides times = | 1 | def dice sides times = |
| 2 | let once _ = randInt 1 (sides + 1) in | 2 | let once () = randInt 1 (sides + 1) in |
| 3 | let aux acc times = | 3 | let aux acc times = |
| 4 | if times ?= 0 then acc | 4 | if times ?= 0 then acc |
| 5 | else aux (acc + once ()) (times - 1) | 5 | else aux (acc + once ()) (times - 1) |
| 6 | in | 6 | in |
| 7 | aux 0 times | 7 | aux 0 times |
| 8 | 8 | ||
| 9 | def guessing_game _ = | 9 | def guessing_game () = |
| 10 | let secret = randInt 1 101 | 10 | let secret = randInt 1 101 |
| 11 | and guessOnce _ = do | 11 | and guessOnce () = do |
| 12 | print "Make your guess: "; | 12 | print "Make your guess: "; |
| 13 | let guess = readInt () in | 13 | let guess = readInt () in |
| 14 | if secret > guess then do | 14 | if secret > guess then do |