Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data BadPlay target
- data Play target
- data Action target
- bustingHand :: Card -> Card -> Bool
- getTarget :: Play target -> Maybe target
- getValidPlays :: player -> [player] -> Card -> Card -> [(Card, Play player)]
- playToAction :: (Eq target, MonadError (BadPlay target) m) => target -> Card -> Play target -> m (Action target)
- viewAction :: Action target -> (target, Card, Play target)
Documentation
A thing that can be done with a card.
A validated card + play combination. Only guarantees that such a thing makes sense according to the rules, rather than the current state of the round.
bustingHand :: Card -> Card -> Bool Source
If you're holding the Minister, there's a potential to "bust out" -- to have to immediately leave the round because you're holding another high card.
:: player | The current player |
-> [player] | All other active players in the round |
-> Card | The card they were dealt |
-> Card | The card that was in their hand |
-> [(Card, Play player)] | All valid plays |
Return all valid plays for a hand.
If the hand is one that would bust out (see bustingHand
) then returns an
empty list.
playToAction :: (Eq target, MonadError (BadPlay target) m) => target -> Card -> Play target -> m (Action target) Source
Given a player, a card, and a choice of play, decide whether it's a valid action.
viewAction :: Action target -> (target, Card, Play target) Source