C Rummy

by Linda Bussell

Linda is currently employed as a software engineer for

SofTech, Inc. She has been in the EdTec program for longer

than she cares to admit, and hopes to graduate next year.



Instructional Objective

For more advanced learners, the following additional objectives would be:

Learners/Context The learners are beginning C programming students, or anyone needing a refresher in the language syntax.

This card game would be used by the students after some basic C language syntax has been introduced. It is intended to be used during lab time or outside of class for practice and/or remediation purposes. The students may start with a "subset" of the cards, with more cards being introduced as more topics are covered. This subset of cards is simply the deck of cards, with some of the cards removed by either the instructor or the learners. For example, if "for loops" haven't been discussed, the "for" cards may be removed. The deck is designed to be extremely adaptable in this way.

Rationale The content to be learned involves making meaningful patterns from a fairly large yet limited set of elements. The possible combinations of "correct" answers is extremely large, and for that reason, a solitaire type game format was rejected, at least for beginning learners. The small groups of two to three learners can learn from each other, and keep each other honest as well.

A card game is useful for this type of content for several reasons. The subject matter is rather dry, and the elements of play and competition provided by a game could make the task more palatable, while providing necessary practice. The learners would have incentive to pay attention to the picayune details of syntax in order to ensure that their opponents aren't trying to slide by with an illegal statement. The practice can take place when the computer isn't available, and can help the students reduce their reliance on the compiler to find syntax errors for them, thus reducing the number of compiler passes needed and increasing productivity.

Rules Materials are a deck of 120 cards (or a subset). 2 - 3 players.

First, choose a dealer.

  1. The dealer deals 12 cards to each player, starting with the player on the dealer's left. The remaining cards are placed in a stack, face down. The top card is placed face up, next to the stack, to begin the discard pile.
  2. The players attempt to arrange their cards into complete, syntactically legal C statements.
  3. Starting with the player to the dealer's left, each player either picks up a card from the top of the deck, or picks up the card from the discard pile. The player may then discard one card on the discard pile, or elect to keep all cards in hand. Each player must keep at least 12 cards, but no more than 20 cards, in his/her hand at all times. If the discard pile becomes empty, a card is turned over from the top of the deck to start a new pile. If the deck becomes empty, the discard pile is shuffled, and the deck is replaced with one card turned over for discard (as at the start of the game).
  4. Play continues until one player can play all of the cards in his/her hand, making up one or more complete and legal C statements.
  5. The winner scores 25 points, plus 5 points for each card. An additional 10 points is scored for each complete "for", "while"," do", or "switch" statement.
  6. Next, the other players show their hands. Any card which is not part of a C statement subtracts 10 points from the respective player's score.
  7. The first player who correctly surmises that another player's statement is illegal scores an additional 5 points for each card making up the illegal statement, and those cards count against the offending player's score at the rate of 10 points per card. If the player holding the illegal statement was the supposed winner of that hand, the 25 points scored for winning the hand also go to the first player. Any disputes are to be settled by referring to the reference for the course, or any C reference manual agreed upon by the players.
  8. The first player to score 300 wins.

Variation To keep the game interesting for more advanced learners, the players might also pay attention to the logic of the statements; 10 points scored by the first player (including the offending player) who points out legal but dangerous or inherently useless statements.

Card Design Examples of various card types are shown below. Card a, the semicolon, is a typical example of the one element card. Card b, the parenthesis, is an example of a card which may be used right side up or upside down, to form either the left or right parenthesis. Card c, the numeral 1, may be used as is for an integer value, or combined with decimals and other numerals to make float values. It may also be used as a character value, or as part of a string. It doesn't matter, so long as the context supports its meaning. Card d stands for any type of variable, while Card e may be used only for an integer variable. Card f is an example of a card which combines two elements that are commonly used together. Each card, simple or complex, is worth the same number of points.

Deck Design Each card displays on or more elements which can be combined with other cards to form complete C statements. As shown above, some cards may represent the name of a variable or function, or a combination of an identifier with customary accompanying punctuation, while other cards may simply display one character or numeral. Each card counts the same as every other, no matter what is displayed on it. The more complex cards may foster the construction of more elaborate statements, while the simpler cards are more versatile.

Design Process The first step of the design process was to decide on the structure of the game. As previously discussed, the first thought was to use a solitaire format, because the goal of the game is to achieve a complex pattern. This was rejected, because the validity of the pattern is the content of the game, and the number of correct combinations is so large that an exhaustive list of correct answers would be impossible to implement. A rummy class game provides the learners the opportunity to check each other's solutions, thus clearing up misconceptions. The players can also learn from each other's correct solutions, as each player is likely to create a different arrangement from any given set of cards. A solitaire format could be an appropriate choice for more advanced learners, using a similar deck of cards.

The first prototype deck lacked sufficient numbers of semicolons, parentheses, and numbers, making valid combinations overly difficult to create. Several trials are needed to determine the optimum balance of card elements to keep the game from being too easy or too difficult. Another issue is the possibility of using a subset of the deck, editing out concepts which haven't yet been discussed in class. This would make the game easier in another way, by making the proportion of supporting cards (semicolons, etc.) larger in proportion to the total number of cards. No specific subsets are planned by the designer, it is left entirely up to the users (instructor or players) to determine a meaningful deck for their game, dependent on the knowledge level of the learners.

A likely addition to the game is a set of card racks to hold the players' hands. The cards were designed with the values displayed in the corners to facilitate viewing; however, with up to 20 cards in a hand it's a challenge just to hold the cards, let alone view them all at once. Another possibility is that the players could lay down their statements once they are completed rather than waiting until the end of the hand.