Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Pig simulates a dice game.
- roll :: IO Int
- data Move
- type Strategy = [Player] -> [Int] -> Move
- data Player = Player {}
- sayN :: Int -> Int -> String -> String -> IO ()
- play :: [Player] -> Int -> [Int] -> IO Player
- alwaysHold :: Strategy
- alwaysRoll :: Strategy
- hundredOrBust :: Strategy
- rollOnce :: Strategy
- roll5 :: Strategy
- roll6 :: Strategy
- rollK :: Strategy
- rollBadK :: Strategy
- defaultPlayer :: Player
- ah :: Player
- ar :: Player
- hob :: Player
- ro :: Player
- r5 :: Player
- r6 :: Player
- rk :: Player
- rb :: Player
- test :: [Player] -> IO Player
- track :: [Player] -> Map String Int -> Map String Int
- stats :: [Player] -> [(String, Int)]
- addLosers :: [Player] -> [(String, Int)] -> [(String, Int)]
Documentation
Player models information available to combatants.
sayN :: Int -> Int -> String -> String -> IO () Source #
sayN provides a debugging hook during development.
play :: [Player] -> Int -> [Int] -> IO Player Source #
play executes a game of Pig and returns the winner.
alwaysHold :: Strategy Source #
alwaysHold models a simple player who always holds.
alwaysRoll :: Strategy Source #
alwaysRoll models a simple player who always rolls.
hundredOrBust :: Strategy Source #
hundredOrBust models a player who strives for 100 points.
defaultPlayer :: Player Source #
defaultPlayer constructs a new player.