Hacker News

anniegracehu
Show HN: Daily Set Puzzle – I rebuilt it after setgame.com's SSL cert expired anniehu.com

anniegracehuop15 hours ago

To generate the puzzle, we have to remember that each puzzle needs exactly 12 cards with exactly 6 valid sets.

For a set to be valid, each of the 4 attributes (number, shape, color, fill) must be either all the same or all different across the 3 cards.

I used brute force to shuffle all 81 possible cards, pick the first 12, and count the valid sets.

To count sets, I check every possible group of 3 cards which is C(12,3) = 220 combinations.

If there are exactly 6 sets, we're done, otherwise we reshuffle and try again.

To make the puzzle the same for everyone each day, I seed the shuffle with the date and use a pseudo-random number generator (in this case, Mulberry32).

It's not hard to find 12 cards with exactly 6 sets, so I pre-generated a year of puzzles in about 5 seconds and cached them.

anniegracehuop16 hours ago

The official Daily Set Puzzle website certificate expired a few months ago.

https://www.reddit.com/r/SetCardGame/comments/1l51y28/is_it_...

Since I love playing the daily puzzle, I made my own :)

(see Internet Archive version here: https://archive.is/anjqk)

Please let me know if you have any feedback!

hn-front (c) 2024 voximity
source