Discussion and an*lysis on the Knucklebones diceboard minigame.

# How to Win

For the impatient: Use the solver!

https://cy.md/ta/cult-of-the-lamb/knucklebones/ – [cy.md]

# Introduction

This guide will show you how to play the Knucklebones game optimally. I hope it helps you to quickly achieve the achievements, earn gold in-game, or just for fun.

This guide is my curiosity about the Knucklebones game. I was surprised at how complex it is, and that it can't be explained in just a few simple steps.

# Facts about Knucklebones

If we wanted to count all possible game states in Knucklebones, we could multiply the number o the die slots with the number o the die values (six faces plus one empty slot). That would give us 7^18 = 1,628,413,597,910,449. However, this isn't quite right as you can only place the dice in the closest empty slot to the other player.

To solve this problem, we can count how many states a column (3 dice) can contain. 60+61+62+63=259, and since there are 6 columns, 2596=301,855,146.292,441. It's better, but there are still ways to do more.

It doesn't really matter what order of dice are in a column. The same game will still be played with the exact same outcome, regardless of which order they are placed. The formula above has been improved to (6 multichoose 0, – +(6) multichoose 1, -+(6multichoose 2, -+(6multichoose 3, – =84). This is a substantial improvement. The sum of 846 is 351,298,031,616. Multichoose here is the multiset coefficient. ( see

https://en.wikipedia.org/wiki/Multiset#Counting_multisets – [wikipedia.org]

), and the Wolfram Alpha syntax.

Next, we need to note that the same dice cannot be in the same column of both sides. If one die is placed, all dice that have the same face up are removed. The total number of combinations possible for both columns (on both sides of the board), is 3,067. This is an improvement over previous 2592 = 67.081. Total: 3,067^3 = 28,849,701,763.

We also notice that the columns themselves can be moved freely. 3067 multichoose 3 == 4,812,987,894, which gives us a reasonable upper bound for the number of functionally-distinct reachable game states.

Furthermore, this number is within reach of modern personal computers' operating capacities. Because we can encode or decode arbitrary game state into this interval with a combinatorial numeral system, we can use it to fully explore the game space. The above number also includes states that both sides are full. A program which traverses all of the game state spaces can be written to arrive at the exact number of 3,861,821,161 states.

The game has no limit on the number of turns. It's possible for both players not to stop rolling the same dice over and over again, cancelling each others' dies.

The advantage of the first player to go is only 1.8%.

# Perfect Play

"Perfect play" basically means that you choose the move that is most likely for victory regardless of the opponent's choice. Knucklebones takes into account the probabilities of successive dice rolls as well as the state and board of the board. This allows them to "look ahead" for an infinite number turn (though there is no limit to the number of game state you can reach).

Wikipedia provides more information.

https://en.wikipedia.org/wiki/Solved_game#Perfect_play – [wikipedia.org]

But, in our case, perfect will be something slightly different. Knucklebones is not a game like chess or checkers. Instead of being binary, it involves a random component, so the possibility that you win is a probability distribution.

The strategies and the solver a*sume perfect play by the opponent. However, AI opponents can play worse than perfect. Playing perfectly can help you win most of your games.

# Greedy Strategy

This strategy is straightforward and straightforward. It is exactly what you think it is. If a move leads to the best possible immediate outcome (most point gained for you + most point lost for your opponent), you should take it. If more than one move is worth the same points, then all moves are considered equivalent.

An average of 3.5% is the cost of a greedy strategy.

Though, don't be fooled into thinking that this small number means that using the greedy strategy will make you lose only 3.5% more often than if playing perfectly: the difference is 3.5% *per turn*, and since typical Knucklebones games last over 20 turns, this will quickly compound into a much bigger number (about 30% after ten of your turns).

# Better Strategy

A strategy to describe perfect play would be incredibly complex and vast. There are so many subtle proliferating effects that it would not be possible to describe every situation and option in a format that could still qualify as a strategy. The only true strategy for perfect play is to use solvers (see below).

What about the next-best thing? I was curious to see how simple it would be to create a strategy that could be described in plain English and which, when followed, would allow you to play as perfect as possible. I developed a program to generate random strategies, which are easy enough to include in a Steam guide. Then, I reworked them to find the perfect one.

Here is my current best strategy:

1. Move as you would for "Greedy Strategy", but only if the column that you would like to move to has less then two dice on your side. If it has two or three dice, move to step 2.

2. Move as you would in the "Greedy Strategie" (described above), except if doing so will bring or keep the opponent’s score for that column below 7. Otherwise, continue to step 3.

3. If you are able to place your die so that it would delete one or several matching opponent's dice, and you still have fewer total points than the opponent after doing so, then go ahead. Otherwise, proceed to step 4.

4. Move as you would to the "Greedy Strategie" (described above).

If you find this strategy a little odd, that's because it is. It is possible to describe complex systems with nonobvious propagating or compounding effects using only a few simple principles.

This strategy is more dangerous than perfect play, with an average of 2.1%. The same caution applies to compounding effects of suboptimal play, as well as the greedy strategy.

# Solver

If the goal of playing perfectly is to explore the game state space, map out the winning probabilities, and make the optimal moves at each step, then that seems to be the only way to go.

Here's a tool that does this:

https://cy.md/ta/cult-of-the-lamb/knucklebones/ – [cy.md]

This solver a*sumes perfect playing from both sides as previously mentioned.

# References

This guide, the solver and miscellaneous tools have the source code:

https://gitlab.com/CyberShadow/cult-of-the-lamb-knucklebones – [gitlab.com]

We appreciate your interest!

Hope you enjoy the post for Cult of the Lamb Knucklebones dice board minigame, If you think we should update the post or something is wrong please let us know via comment and we will fix it how fast as possible! Thank you and have a great day!

## Leave a Reply