setgame-1.1: A console interface to the game of Set

Safe HaskellSafe





data Game Source

Game represents the current state of a Set game including the remaining shuffled deck and the current tableau.

Game creation functions

newGame :: IO Game Source

newGame creates a new Game with a full tableau and shuffled deck.

Game update functions

considerSet :: Card -> Card -> Card -> Game -> Maybe Game Source

considerSet verifies that a given set exists in the tableau and then removes the set from the tableau.

extraCards :: Game -> Either Int Game Source

extraCards returns either a new game with 3 additional cards dealt or the number of sets remaining in the tableau.

sortTableau :: (Card -> Card -> Ordering) -> Game -> Game Source

sortTableau sorts the tableau with a given order.

Game query functions

deckNull :: Game -> Bool Source

deckNull returns True iff the deck is empty.

deckSize :: Game -> Int Source

deckSize returns the number of cards remaining in the deck.

emptyGame :: Game -> Bool Source

emptyGame tests for a game with no cards remaining in either the tableau or the deck.

hint :: RandomGen g => g -> Game -> (Maybe Card, g) Source

hint returns a randomly selected card contained in a set found on the tableau.