Nicolas Alvarez wrote:
> I understand the C++ one and the Haskell one looks like line noise.
OK, well how about this:
module Main where
import System.Random
main = do
target <- randomRIO (1, 100)
guess target
guess target = do
putStr "Guess: "
txt <- getLine
let number = read txt :: Int
case compare number target of
LT -> do putStrLn "Too low."; guess target
GT -> do putStrLn "Too high."; guess target
EQ -> do putStrLn "You win!"
Does that look like line noise to you? Or can you figure out what that does?
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|