Assignment 11

due at midnight on   +40

In this assignment, we will build part of a poker game. Using the card structure defined in class on 12/2, you should create and test functions that detect:

  • One pair (2 cards, same rank)
  • Two pairs
  • Three of a kind
  • Four of a kind
  • A flush (5 cards, same suit)

Wikipedia has a list of poker hands that illustrate these in more detail.

The key to detecting each is a tally array. You are either tallying the ranks or (in the case of the flush) the suits. Some other examples of tally arrays are in the frequency and dice programs from 11/25.