Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- type Collection a = [a]
- type Probability = Rational
- selectOne :: Fractional prob => StateT (Collection a) (T prob) a
- select1 :: Fractional prob => Collection a -> T prob a
- select2 :: Fractional prob => Collection a -> T prob (a, a)
- select :: Fractional prob => Int -> Collection a -> T prob [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
- totalValue :: Collection Card -> Int
- draw :: Fractional prob => ([Card], Collection Card) -> T prob ([Card], Collection Card)
- drawF :: ([Card], Collection Card) -> Dist ([Card], Collection Card)
- drawTo16 :: T ([Card], Collection Card)
- win :: ([Card], b) -> Bool
- chanceWin :: (Fractional prob, Ord prob, Random prob) => T (T prob Bool)
Documentation
type Collection a = [a] Source #
type Probability = Rational Source #
selectOne :: Fractional prob => StateT (Collection a) (T prob) a Source #
select1 :: Fractional prob => Collection a -> T prob a Source #
select2 :: Fractional prob => Collection a -> T prob (a, a) Source #
select :: Fractional prob => Int -> Collection a -> T prob [a] Source #
Example collections
marbles
jar :: Collection Marble Source #
pRGB :: Probability Source #
pRG :: Probability Source #
cards
deck :: Collection Card Source #
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.
totalValue :: Collection Card -> Int Source #
draw :: Fractional prob => ([Card], Collection Card) -> T prob ([Card], Collection Card) Source #
drawF :: ([Card], Collection Card) -> Dist ([Card], Collection Card) Source #