Set Puzzle

The puzzle is solved by finding sets of three cards that are all the same, or all different, across four independent "facets" or "dimensions". These dimensions are: number, shape, color, and fill. Each of these dimensions has three possible values. Number may be: one, two, or three; color may be: red, green, or blue; shape may be: rectangle, X, or O; and fill may be: open, striped, or solid.

Example sets:
a SET
same: [none]
different: number, color, shape, fill

a SET
same: number, color, shape
different: fill

a SET
same: number, shape
different: color, fill

NOT a set
same: number, shape
different: color
wrong: fill
To make it a set, one of the open fills needs to be solid, or the striped fill needs to be open.

a SET
same: shape
different: color, number, fill

NOT a set
same: shape, number
different: fill
wrong: color
To make it a set, one of the red colors needs to be blue, or the green color needs to be red.

How many cards would you expect in a Set deck?

How would you uniquely identify each card?

Can you "compute" the value of each of the four dimensions, or, does it need to be "stored"?
What kind of algorithm will give us a decision on whether 3 cards constitute a set?

Above are all combinations of three 3-valued variables. Is a pattern or source of leverage evident?

Here is an implementation ...

What kind of algorithm is necessary and sufficient to compute all the sets present in an array of 12 cards?

What is the equation for "all combinations of X things taken Y at a time"?

Here is an implementation ...

How about supplying the "view" component (Java GUI code) and having the student design the "model" component (game engine)?