Software Engineering 2B03: Software Design II
Revised 2003 January 17

The card game Sevens

1. Background and general

A major component of this course is a team project to design and develop a specified program system. The system to be developed will involve playing a card game. Each student team will design and implement a module (subsystem) which simulates one player in the game, making moves, keeping track of the state of the game, calculating scores, etc. as required.

The game, which we will call Sevens, is a new variant in the "adding-up" family of card games [Parlett]. This variant has been designed especially for 2B03 and differs in small but significant ways from previously published card games.

2. Sevens: general overview

Sevens is played with an ordinary deck of fifty two cards. Each card is imprinted with a symbol (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q or K) and a suit (clubs, spades, diamonds or hearts). In principle any number of players may participate. In the 2B03 tournament at least 2 and at most 9 players will play in any one game.

During the game, each player places a card onto the table in turn. Depending on the total value of the cards on the table after each such play, reward or punishment points may be earned. Each player's goal in the game is to earn as high a number of points as possible.

3. The procedure for playing Sevens

A game of Sevens begins with shuffling the entire deck of cards into a random sequence and dealing an equal number of cards to each player. At least 1 card is placed onto the table and the dealer (who is not one of the players) announces the score value of each card dealt onto the table.

The score value of a card depends on the symbol on the card. In some cases, the person playing the card onto the table may choose between two different score values permitted for the card symbol in question. The permitted score values for each card symbol are announced by the dealer at the beginning of each game, before play starts. The permitted score values for each card symbol may, and generally do, vary from game to game.

The first player selects a card from her/his hand and places it onto the table on top of the cards already on the table, announces the score value of that card and, if appropriate, claims reward or punishment points. The second and following players do the same in sequence until all cards from the players' hands have been played onto the table.

The following restrictions apply to playing a card from a player's hand onto the table:

1. The next player must place a card of a different color than the most recently played card on the table, if he/she can.

2. Otherwise, the next player must place a card of a different suit than the most recently played card on the table, if he/she can.

3. Otherwise (i.e., if the next player has only cards of the same suit as the most recently played card on the table), any card from the player's hand may be placed onto the table.

If, upon placing a card onto the table and announcing its score value, the total score value of all the cards on the table is divisible by seven, the player playing that card earns a corresponding number of reward or punishment points. If the decimal representation of the total score value of all the cards on the table contains a seven (e.g. 17, 37, 73, etc.), then the player playing that card earns a corresponding (but typically different) number of reward or punishment points. If both of these conditions are met, i.e. if the total score value of all the cards on the table is divisible by seven and its decimal representation contains a seven, then the player playing that card earns a corresponding (possibly still different) number of reward or punishment points. The number of reward or punishment points earned in these three cases is announced by the dealer at the beginning of the game, before play starts. A positive value represents a reward; a negative value, a punishment. These parameters of the game may, and generally do, vary from game to game.

4. Scoring a game

At the end of the game players are ranked according to the number of reward and punishment points they have earned during the game. The player with the greatest number of reward and punishment points wins and the player with the smallest number of points loses.

5. Sevens tournament in 2B03

A Sevens tournament will be run on a computer near the end of the term. The main control program, written by a TA, will shuffle and deal the cards, communicate with the students' modules as necessary, create a log of each game, and accumulate and report the results of each game and of the tournament. The main control program will execute all games in the tournament consecutively without manual intervention. The tournament will be organized so that all teams' modules play approximately the same number of times, in different playing positions and against all other teams. Each team's rank in each game will be recorded and the average rank for each team will be calculated. Each team's performance in the tournament will be determined by its average rank in the games in which it played.

The main control program will call appropriate access routines in the teams' modules as needed for initializing a game, dealing a card to a player, requesting each player's move in turn, informing the other players of one player's move, obtaining scores, etc. The interface between the main control program and the team modules is specified more precisely in the document Semiformal Specification of the Interface between the Main Control Program and the Student Teams' Player Modules.

Any team module that plays in violation of the rules of the game or fails to initialize or play when requested at any time during the tournament will be disqualified and removed from the tournament. The tournament will then be rerun with the remaining teams.

6. Reference literature:

Descriptions of card games in general and "adding-up" card games in particular can be found in many books, including: