In my last article, I defined a deck of cards as “a complete set of cards,” but it’s really not that simple. Though most games require one card of each face & suit combination (as in a standard 52-card deck), not all of them do. Some games, such as Mille, require multiple decks whereas other games, such as Spanish 21, require some of the standard cards to be removed. Therefore, to build “deck” functionality, we need:

  • A way to maintain an arbitrary list of cards.
  • An abstract way to supply an initial set of cards to the deck.
  • A method for shuffling the cards. Continue reading »
© 2011 James Tharpe Suffusion theme by Sayontan Sinha