A complete hand (5 cards) is dealt to each player. Define a type synonym or data type Hand. Each player has the aim of collecting the best possible combination of cards (Fig. 2), as some hands are stronger than others. A ‘straight flush’ for example is much stronger than ‘two pairs’.
In this exercise you need to define a data type representing the possible categories of poker hands:
data Combo ...
You should take into account, for instance, that a pair of sixes is weaker then a pair of Jacks or that a straight starting from six is stronger then a straight starting from five. Refer to http://en.wikipedia.org/wiki/Poker_hands for the exact rules. Make the data type an instance of Show and Ord, where the ordering should correspond to the strength of the combo.
A complete hand (5 cards) is dealt to each player. Define a type synonym or data type Hand. Each player has the aim of collecting the best possible combination of cards (Fig. 2), as some hands are stronger than others. A ‘straight flush’ for example is much stronger than ‘two pairs’.
In this exercise you need to define a data type representing the possible categories of poker hands:
data Combo ...
You should take into account, for instance, that a pair of sixes is weaker then a pair of Jacks or that a straight starting from six is stronger then a straight starting from five. Refer to http://en.wikipedia.org/wiki/Poker_hands for the exact rules. Make the data type an instance of Show and Ord, where the ordering should correspond to the strength of the combo.