< Back

SET

I'm a fan of all types of games. I play plenty of video games and board games. However, one of my favorite games is a card game called Set. Set is a very interesting game that consist of a deck of very special cards. Each one of these cards can be described by the shapes, color, and shading of what is on those cards. The goal of the game is to find a number of sets: The cards that share all of the attributes, or have all different attributes. You are going to write a command line version of this program.


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

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).

Create a command line program that allows a user to play a textual 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 input 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.


Class Structure

For Monday, February 8th, I want you to turn in (on paper!) a design for your SetCard class. You should define what the attributes of the class are going to be, as well as any methods you think you might need.

Just because I'm only asking for the Class Structure, I still suggest you perform the top down design for your main function. 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 3. You can create a tar file by issuing the following commands:

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

"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.

  2. Graphics:

    One thing that I noticed when I wrote this program is that it is incredibly hard to actually identify sets. I've learned to identify sets based on their images, as opposed to actually identifying the terms for the sets. It would be much nicer if we were able to see the cards of the set instead.

    Sometime this weekend, I will upload an archive file of images for each one of the cards. Use these images to create a graphical version of the program.