Last active
December 14, 2015 19:58
-
-
Save sleepynate/5140058 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 Control.Monad | |
data Gesture = Rock | Paper | Scissors deriving (Eq, Show, Read) | |
instance Ord Gesture where | |
a `compare` b | |
| a == b = EQ | |
Rock `compare` Scissors = GT | |
Paper `compare` Rock = GT | |
Scissors `compare` Paper = GT | |
_ `compare` _ = LT | |
readGes :: String -> Gesture | |
readGes = read | |
main = do | |
putStrLn "ROCK PAPER SCISSORS EPIC BATTLE TIEMS" | |
putStrLn "-------------------------------------" | |
putStrLn "" | |
putStrLn "INDICATE NUMBER OF DESTROYERS OF EACH OTHER" | |
x <- getLine | |
let players = read x::Int | |
moves <- replicateM players (putStrLn "What is your move!?!?!" >> getLine) | |
putStrLn $ show (maximum $ map readGes moves) ++ " wins" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment