So there’s this neat game called Set.
If you’ve never come across the game, the basic idea is that you have 12 cards each with 4 different attributes with 3 possible values of each attribute.
Color: Red Purple Green
Shape: Diamond, Oval, Squiggly
Number: 1 2 3
Fill-Type: Solid/Filled, Clear, Lined/Striped
Your goal is to find a set of 3 cards that agree or disagree on each of the attributes.
The link provided above has visual examples.
You can play a 2 player flash version at www.highergames.com
Here at emad nerdotronics labs, we went ahead and automated the process.
Here is the source: http://blag.thegrebs.com/setsolve.py.html.
It is pretty straight forward and there are no suprises.
Of course there are a number of issues we can all scream about, which is great, because the world needs more screaming.
from Practicality:
—-This is completely useless in versions of the game where each set is removed as it is found and three new cards replace it. —-
Yes. For that you would just have to change a few ways the search is made. for instance. stop at the first one found, erase the 3 found cards, append the 3 new cards, search again. As you can see, that wouldnt take much effort to do with what I already have.
—-Isn’t this game a brain teaser? What’s the point of automating it? Isn’t this ju– oh ok i just read the category of this posting. —-
Apology Accepted.
from Coding Methodology:
—-Youshould totally use a dictionary to print out the actual color, shape, filltype of the card found in a non mnemonic way. —-
Yes, just change two things and you can do that.
—-Why not just use an array of attributes and loop through those during the card comparison, it would totally be cooler! —-
yeah, I thought of that, but I figured I might as well keep a little more self documenting. It is very much do-able, though