Anonymous user
Poker hand analyser: Difference between revisions
m
→Basic Version
m (→Basic Version) |
m (→Basic Version) |
||
Line 2,022:
where rankCountTuple xs = sortedGroups $ map rankCount $ groupedByRank
where groupedByRank = group sortedRank
rankCount c@(x:
sortedGroups = sortBy (\(_, n) (_, n') -> compare n' n)
uniqRanks = length ranks
ofKind n = any (\(_, y) -> n == y) ranks
straight = isSucc sortedRank || sortedRank == acesHigh
flush = and $ map (\c -> s' == suit c) cards
where s' = suit $ head cards
invalidHand = length (nub cards) /= 5
|