The Suit Pile

We first examine the suit pile, which builds cards up in suit and in order from ace to king. The only method redefined is the function canTake, which determines whether a card can be placed on the stack. A card can be played if the stack is empty and the card is an ace, or if it is the same suit as the topmost card, and the next card in sequence.

[audio] [real] Text to accompany slide16, in Chapter 8 of An Introduction to Object-Oriented Programming