Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Klackers Strategy

Klackers strategy via Monte Carlo

Roy Keyes

19 May 2014 - This is a post on my blog.

Klackers (a.k.a Shut the Box) is a dice game, often played in bars and pubs. It's a game of chance, arithmetic, and strategy. This little project is intended to find the best simple strategy for playing Klackers. Maybe you can become a Klackers shark...?

The game

Klackers is played with dice on a game board like the one pictured below.

A Shut the Box game, via Wikipedia

There are many variants of Klackers, but I will describe the version I am familiar with ("2 dice golf").

The board consists of a dice rolling area and a set of numbered tiles, 1 - 9. Each turn consists of the player rolling the dice and then turning over tiles that sum to the dice roll. For example, if you roll an 8, you might turn over tiles 3 and 5, if they are not already turned over. If there is no combination of standing tiles that sum to the dice roll, then the player's turn is over. Their score is the sum of the remaining tile values. The winner is the player with the lowest score on that turn.


When playing Klackers I've wondered about the best strategy. Not being a professional Klackers play (if that could possibly exist), the optimal strategy was not obvious to me. I decided to see what the best simple strategy would be.

I chose three simple strategies to test.

Randomly choose a set of tiles that equals the sum of the dice roll
Choose the set of tiles that equals the roll with the fewest tiles
Choose the set of tiles that equals the roll with the most tiles

Monte Carlo: this is a dice game after all.

To test the strategy I decided to use Monte Carlo simulations. A Monte Carlo simulation involves running a large number of trials, in which you randomly choose what to do next, based on known probabilities for each action. In the case of Klackers, the random "choice" is the value of the dice roll. By performing a very large number of trials and tallying the results, your resulting distribution of values will asymptotically approach the canonical distribution of values (assuming a good underlying model). For Klackers this means playing many games and tallying the final scores.

In this way I could test each strategy and analyze the resulting score distributions to choose a best strategy.

I wrote my simulation in Python. You can check out the code here.

For each strategy, I simulated 10 million games. The resulting score distributions are below.

Klackers score distributions

The vertical solid lines represent mean scores, while the vertical dashed lines represent median scores.

Remembering that a lower score is better, it's easy to see that strategy of choosing the fewest number of tiles that add to the dice sum. The intuition for this strategy is that by using fewer tiles, you are left with more possibilities to equal subsequent dice rolls. It's also clear that randomly choosing a combination of tiles is better than attempting to maximize the number of tiles used per roll -- a strategy which might intuitively lead to a zero score faster.

Strategy Mean score Median score
Fewest tiles 11.8 11
Random choice 20.4 21
Most tiles 24.2 24

It's interesting to note the shapes of the distributions. While the fewest tiles and random choice strategies have score distributions with a Poisson-like appearance, it also appears that there is other structure to the distributions, most clearly around the scores 9 and 10. It would be interesting to look further into this structure. While I have not performed exhaustive trials, simulating any number of games up to the 10 million displayed in the plots shows the same structure.

Go with the fewest tiles

For simple Klackers strategies, it seems that choosing the fewest tiles is the way to go. Try it and you'll have a finite probability of impressing you friends.

After doing this little project I came across some other analyses of Klackers, looking at other variants of the game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment