At the start of each day at Brooklyn Game Lab, we will have “quick play;” games with easy to explain rules and can be finished within 30 minutes. My favorite game to suggest is Set, mostly because it involves quietly looking at cards on a table. I noticed how unusually difficult it was to describe the rules for what makes a Set, despite how intuitive it seemed to me after playing the game for so many years. Each card has a Number, a Shape, a Color, and a Shading. If three cards all have the same feature or if they all have different features, then those three cards are a Set. When I thought of how a computer would determine the logic of whether three cards made a Set, I realized that building a Set program would make for a good personal project.

My biggest priority for my Set program design was efficiency. I wanted my program to automatically detect if there are no Sets available for the player to find. If I had an algorithm check every time new cards are put down, I would need to take all 220 combinations of 3 cards from the 12 face up, and then run 8 checks for each of those combinations’ features to see if they’re a Set, for a grand total of 1780 checks every turn at most. There had to be a better way! The solution came in two parts. First, any pair of cards can make a set with a third card, a “Solution Card,” so to speak. Instead of running combinations of 3 cards, I can just find the Solution Card for every 66 combinations of 2 cards, store that value, and then check to see if a Solution Card is currently on the board. The second part of the solution is frontloading; I only need to re-check the combinations that had a card replaced (30 combinations each turn). The Solution Cards for untouched combinations would be the same. With these 2 solutions, 1780 checks every turn becomes an initial 528 checks, followed by only 30 checks each turn.

This was my first Python project that I created on my own from start to finish. Creating an executable build was a lot trickier than I had anticipated it being, but I learned a lot from it! Also, I don’t want to get in trouble with Set Enterprise Inc. for saying that this is an entirely original project, so I decided to call it “Legally Not Set!”.

Download Here!

View Source Code Here!