Aunt Sandra's Solitaire Card Game Analysis

Coded by ChatGPT with prompts from Wayne


Playing Cards Playing Cards Playing Cards

The Game

When I was a young boy, my dear Aunt Sandra introduced a solitaire card game to our family. It is a simple one-person game, it can be played just about anywhere, and it is very unusual to win. I've won it three times in my whole life. My Dad played it all the way to Taiwan and back on a business trip and never won. We call it Aunt Sandra's Dumb Game.

All you need is one deck of standard playing cards. Shuffle them well, then hold the deck so the backs are facing you. Pull the card from the back of the deck (furthest from you) and place it on the front where you can see it. Then do the same thing with the next three cards. Fan them so you can see each card in order. You should be able to hold the whole deck in one hand.

Compare the first and fourth cards. If they have the same value (e.g. 8 and 8 or King and King) then remove all four cards and set them aside. If the first and fourth cards have different values but the same suit, then take out the two cards in the middle and set them in the discard pile. If there are still more than four cards showing, you can do the same evaluation again, comparing the last card to the card that is three spots ahead of it. If there are less than four cards showing, or if you cannot remove any cards, then draw another card from the back, and evaluate it against the card that is three spots ahead of it.

Continue until there are no new cards remaining. To win, you will have zero cards remaining. If you win, let me know and I will raise the flag and cheer.

The Simulation (Python)

While driving back home from a vacation to the beach in 2019, I got the idea that I could simulate the game in Python to play it millions of times to generate an accurate estimation of just how (in)frequent it is to win the game. I hacked together some Python and got my answer (0.3%). A single game simulation page provides the card-by-card analysis of the simulation that I used for verification and debugging.

The Web Version (AI-generated JavaScript)

Since then, I lost that code. When Generative AI became so popular, I used ChatGPT to recreate the program. That only took an hour or two, and I know the new code was far superior to my first effort. Working with Claude recently, I was easily able to get the game implemented in JavaScript to host on a web page.

This was not only a fun project to satisfy my curiosity and need to tinker. I also love that I can run many simulations so quickly and easily. Simulating different numbers of games demonstrates my favorite statistical principle: the Law of Large Numbers. This says that as the number of independent trials of a random process increases, the average of the results will tend to converge to the expected value. It is easy to see how much more smooth and well-defined the histogram is when running a huge number of game simulations.

And the best part is that I can win the game 0.003 * 100,000 = 300 times just by clicking a button.