-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A console interface to the game of Set
--
-- A console interface to the game of Set
@package setgame
@version 1.1
module Set.Utils
-- | groups breaks a list into sublists of the given size. The final
-- resulting group may contain fewer elements than the given size.
-- Property: For all positive n. concat (groups n xs) == xs
groups :: Int -> [a] -> [[a]]
-- | delete1 returns a list with the first occurrence of @x removed.
-- If there is no occurrence Nothing is returned.
delete1 :: Eq a => a -> [a] -> Maybe [a]
-- | index returns the element at the given 0-based index and
-- returns Nothing on failure.
index :: Int -> [a] -> Maybe a
-- | Extract an element from a list by index returning that element and the
-- remaining list.
select :: Int -> [a] -> (a, [a])
-- | Drop last element of list if there is an element to drop.
init' :: [a] -> [a]
-- | chooseTwo returns all combinations of two elements.
chooseTwo :: [a] -> [(a, a)]
-- | seconds converts seconds to microseconds for use in
-- threadDelay.
seconds :: Int -> Int
-- | shuffleIO calls shuffle using a generator from
-- newStdGen.
shuffleIO :: [a] -> IO [a]
-- | shuffle shuffles the elements of a list using the given random
-- generator.
shuffle :: RandomGen g => [a] -> g -> ([a], g)
shuffle' :: RandomGen g => Int -> [a] -> g -> ([a], g)
-- | centerText centers the given string in a field of @width
-- characters.
centerText :: Int -> String -> String
-- | centerText right-aligns the given string in a field of @width
-- characters.
leftPadText :: Int -> String -> String
-- | centerText left-aligns the given string in a field of @width
-- characters.
rightPadText :: Int -> String -> String
module Set.Card
data Card
Card :: Color -> Count -> Shading -> Symbol -> Card
[color] :: Card -> Color
[count] :: Card -> Count
[shading] :: Card -> Shading
[symbol] :: Card -> Symbol
data Color
Red :: Color
Purple :: Color
Green :: Color
data Count
One :: Count
Two :: Count
Three :: Count
data Shading
Open :: Shading
Striped :: Shading
Solid :: Shading
data Symbol
Diamond :: Symbol
Squiggle :: Symbol
Oval :: Symbol
allCards :: [Card]
validSet :: Card -> Card -> Card -> Bool
-- | solveBoard returns the list of all valid sets contained in
-- the given list.
solve :: [Card] -> [(Card, Card, Card)]
instance GHC.Classes.Eq Set.Card.Card
instance GHC.Show.Show Set.Card.Card
instance GHC.Classes.Ord Set.Card.Symbol
instance GHC.Classes.Eq Set.Card.Symbol
instance GHC.Show.Show Set.Card.Symbol
instance GHC.Classes.Ord Set.Card.Shading
instance GHC.Classes.Eq Set.Card.Shading
instance GHC.Show.Show Set.Card.Shading
instance GHC.Classes.Ord Set.Card.Count
instance GHC.Classes.Eq Set.Card.Count
instance GHC.Show.Show Set.Card.Count
instance GHC.Classes.Ord Set.Card.Color
instance GHC.Classes.Eq Set.Card.Color
instance GHC.Show.Show Set.Card.Color
module Set.Game
-- | Game represents the current state of a Set game including the
-- remaining shuffled deck and the current tableau.
data Game
-- | newGame creates a new Game with a full tableau and
-- shuffled deck.
newGame :: IO Game
-- | considerSet verifies that a given set exists in the tableau and
-- then removes the set from the tableau.
considerSet :: Card -> Card -> Card -> Game -> Maybe Game
-- | extraCards returns either a new game with 3 additional cards
-- dealt or the number of sets remaining in the tableau.
extraCards :: Game -> Either Int Game
-- | sortTableau sorts the tableau with a given order.
sortTableau :: (Card -> Card -> Ordering) -> Game -> Game
tableau :: Game -> [Card]
-- | deckNull returns True iff the deck is empty.
deckNull :: Game -> Bool
-- | deckSize returns the number of cards remaining in the deck.
deckSize :: Game -> Int
-- | emptyGame tests for a game with no cards remaining in either
-- the tableau or the deck.
emptyGame :: Game -> Bool
-- | hint returns a randomly selected card contained in a set found
-- on the tableau.
hint :: RandomGen g => g -> Game -> (Maybe Card, g)
module Set.Ascii
-- | Compute the ASCII lines and color of a given card
cardLines :: Card -> (Color, [String])
module SetGame
gameMain :: Config -> IO ()
instance GHC.Classes.Eq SetGame.CurrentControl