- type Collection a = [a]
- selectOne :: Eq a => Collection a -> Dist (a, Collection a)
- select1 :: Eq a => Collection a -> Dist a
- select2 :: Eq a => Collection a -> Dist (a, a)
- selectMany :: Eq a => Int -> Collection a -> Dist ([a], Collection a)
- select :: Eq a => Int -> Collection a -> Dist [a]
- data Marble
- bucket :: Collection Marble
- jar :: Collection Marble
- pRGB :: Probability
- pRG :: Probability
- data Suit
- data Rank
- type Card = (Rank, Suit)
- plains :: [Rank]
- faces :: [Rank]
- isFace :: Card -> Bool
- isPlain :: Card -> Bool
- ranks :: [Rank]
- suits :: [Suit]
- deck :: Collection Card
- value :: Card -> Int
- draw :: ([Card], Collection Card) -> Dist ([Card], Collection Card)
- drawTo16 :: t -> IO ([Card], Collection Card)
- win :: ([Card], b) -> Bool
- chanceWin :: IO (Dist Bool)
Documentation
type Collection a = [a]Source
selectOne :: Eq a => Collection a -> Dist (a, Collection a)Source
select1 :: Eq a => Collection a -> Dist aSource
select2 :: Eq a => Collection a -> Dist (a, a)Source
selectMany :: Eq a => Int -> Collection a -> Dist ([a], Collection a)Source
Example collections
marbles
cards
Example
mini-blackjack: draw 2 cards, and if value is less than 14, continue drawing until value equals or exceeds 14. if values exceeds 21, you lose, otherwise you win.
draw :: ([Card], Collection Card) -> Dist ([Card], Collection Card)Source