combinatorial-0.1: Count, enumerate, rank and unrank combinatorial objects

Safe HaskellSafe
LanguageHaskell98

Combinatorics.CardPairs

Contents

Synopsis

general

data Card Source #

Constructors

Other 
Queen 
King 

Instances

Enum Card Source # 

Methods

succ :: Card -> Card #

pred :: Card -> Card #

toEnum :: Int -> Card #

fromEnum :: Card -> Int #

enumFrom :: Card -> [Card] #

enumFromThen :: Card -> Card -> [Card] #

enumFromTo :: Card -> Card -> [Card] #

enumFromThenTo :: Card -> Card -> Card -> [Card] #

Eq Card Source # 

Methods

(==) :: Card -> Card -> Bool #

(/=) :: Card -> Card -> Bool #

Ord Card Source # 

Methods

compare :: Card -> Card -> Ordering #

(<) :: Card -> Card -> Bool #

(<=) :: Card -> Card -> Bool #

(>) :: Card -> Card -> Bool #

(>=) :: Card -> Card -> Bool #

max :: Card -> Card -> Card #

min :: Card -> Card -> Card #

Show Card Source # 

Methods

showsPrec :: Int -> Card -> ShowS #

show :: Card -> String #

showList :: [Card] -> ShowS #

data CardCount i Source #

Constructors

CardCount 

Instances

allPossibilities :: CardSet a -> [[a]] Source #

possibilitiesCardsBorderNaive :: CardCount Int -> CardCount Integer Source #

Count the number of card set orderings with adjacent queen and king. We return a triple where the elements count with respect to an additional condition: (card set starts with an ordinary card ' ', start with queen q, start with king k)

examples

cardSetSizeRummyJK :: CardCount Int Source #

Allow both Jack and King adjacent to Queen.

tests