Poker hand analyser: Difference between revisions

m
Line 2,022:
where rankCountTuple xs = sortedGroups $ map rankCount $ groupedByRank
where groupedByRank = group sortedRank
rankCount c@(x:xs_) = (x, length c)
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
 
Anonymous user