So I Built A Cupcake Card Game Simulator

Orchard Toys do a great line in table top games for kids.  They include games of chance, strategy and memory using thick card and clear, colourful illustrations. I heartily recommend any of the line as good value for money birthday presents.  (They also have a Pirate Memory Game, a fact which will be hilarious to fans of Little Britain).

One of their games is Where’s My Cupcake?  Children as young as 3 can play with adults on an equal footing because the game is entirely based on chance.  Players take turns to pick a cupcake card off a central pile, and see if it matches one of the cake cards laid out on the table.  If it does, they add both cards to their pile.  If it does not, they check to see if anyone has a matching card on the top of their pile, asking “would you like a cupcake?”  If no-one claims the cupcake card, its placed on the table and the next person takes a turn.  Play continues like that until the pile of cards are exhausted. The player with the most cupcake cards is the winner. Full instructions are here.

The only problem with the game is that because it is entirely based on chance, its actually very hard to let a very young person win, if you want them to!  Sometimes, a string of bad luck can mean they miss several opportunities to put a cupcake on their plate, and they might lose several games in a row.  For someone just learning how to share and play fair, this can be demoralising to the point where they refuse to play.  It would be nice to be able to optimise their chance of victory.

Since the game is entirely procedural, the outcome of the game is pre-determined from the moment the cards are shuffled.   However, the shuffling involves 30 cards with 10 designs on them, which means there are 4.39 x 1039 possible combinations.  Even the fastest super computer in the world would take several millennia to evaluate every combination.

Nevertheless, I decided to script a virtual version of the game, so I could simulate many hundreds of games and discover which player is statistically most likely to win.  Armed with that knowledge, I can ensure that the person I want to prevail is sat in that spot when the game is played, and thereby decrease the likelihood of tears before bedtime. Continue reading “So I Built A Cupcake Card Game Simulator”