< Back

Set

Set is a mathematical card game which relies on the user finding a set of 3 cards out of a collection of 12 cards. Each card has 4 attributes: Number, Shape, Shading, and Color. 3 cards make a set if and only if there is only 1 or 3 of a given attribute. If there are only 2 of a given attribute across the 3 cards, you do not have a set.


set_cards.zip

Setup

Create a directory assignment3 under assignments in your cs170 directory. All code for the assignment should be stored in this directory.

cd ~/cs170/assignments
mkdir assignment3
cd assignment3

Details

THIS IS A C++ PROGRAM

Set is a game that is played using special cards. Each card has four attributes that describes what is drawn on the card:

\[ \begin{eqnarray*} number &=& \{1, 2, 3\}\\ color &=& \{red, green, purple\}\\ shape &=& \{oval, diamond, squiggle\}\\ shading &=& \{filled, shaded, open\} \end{eqnarray*} \]

In the game of set, 12 cards are dealt on the board. The goal of the game is to identify sets of three cards. Three cards form a set if for each attribute above they either share the attribute, or all three are unique. For example, the cards which are 1 red filled oval, 1 green filled oval, 1 purple filled oval form a set because they all share the same number, shape, and shading, but they have all three unique colors. Similarly the cards 1 red filled oval, 2 green shaded diamonds, and 3 purple open squiggles are a set, because they are unique for each attribue.

However, the set of cards 1 red filled oval, 1 green shaded oval, and 3 purple open oval is not a set, because for the number attribute they are not all the same (you have 1 and 3) and they are not all unique (there are two 1's).

You are to create a QT version of the game SET. You should create a deck of the entirety of the set cards (There is one card for every permuation of the above attributes). You should then be able to deal 12 of these cards onto the set board, and allow the user to select three cards that they believe should make a set. If the cards dealt are a set, remove those three cards and deal three more cards. If it is not a set, tell the user the cards were not a set and do not change the cards on the board. This process should continue until the deck is empty or their are no visible sets on the board.

Pseudocode

For Wednesday, February 15th, I want you to turn in (on paper!) pseudocode for your program. You should define what classes you want, the attributes of the class are going to be, as well as any methods you think you might need.

As usual, start with main! That will direct what you want in your classes as far as methods. You do not need to include full details on QT classes you will use, but anything you create from scratch should more or less be defined. This is worth 30 points of your assignment grade. It does not sound like a lot, but they should be 30 easy points to get each week. Do not neglect them.


Submission

You are required to submit a tar file to http://inquire.roanoke.edu/. On inquire, there is a link for Assignment 4. You can create a tar file by issuing the following commands:

  cd ~/cs170/assignments
  tar czvf assignment4.tgz assignment4/

"Hacker" Prompt

  1. No Sets: Right now your game will end as soon as the board doesn't contain any additional sets. So a game of set might be incredibly short. And this isn't really the way that the game is truly played. Instead of ending the game, continue to deal three cards until there is at least one set on the board. So your board may now be much, much larger than the typical 12 cards.