# Cult of the Lamb – KnuckleBones minigame

Discussion and an*lysis about the Knucklebones miniature game dice board.

# How to Win

For the impatient: Use a solver!

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

# Introduction

This guide explains how to play Knucklebones optimally. I hope that you find this useful to quickly reach the achievements, earn some gold without spending any in-game time, or simply for fun.

This guide was written because I was curious to learn more about the Knucklebones Minigame. After writing a solution, I discovered that it has an amazing amount of depth. The best strategy can't just be explained in a few simple steps.

If we want to count the total number games that can occur in Knucklebones then one way is to multiply 718 with the number potential die values (six face plus one for empty slots). That would give us 7^18 = 1,628,413,597,910,449. However, that's not exactly correct as you can only put dice in the closest empty spot towards the other players.

We can count the number states that a row (3 dice) can have to address this issue. 60+61+62+63=259 and 6 columns = 259 = 301.855,146.292,441. We can do more.

It doesn’t matter how many dice are in a given column – they all represent the exact identical game, with exactly the same outcomes. The formula is now (6multichoose0-+(6multichoose1-+(6multichoose2-+(6multichoose3), which is a significant improvement. This brings the total to 846= 351,298,031,616. Here, "multichoose", the multiset coefficient ( see
https://en.wikipedia.org/wiki/Multiset#Counting_multisets – [wikipedia.org]

), and Wolfram Alpha's syntax.

Next, note that the same number of die cannot be placed in the same column. All dice with the identical face up are removed from each side after one is placed. There are now 3 067 combinations that can be made in one column for both sides of a board. This is a substantial improvement over the 2592 = 67 081. Total: 3,067^3 = 28,849,701,763.

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

Even more important, this number falls within the operating limit of personal computers. Since we can encode arbitrary game state into this interval using the combinatorial number scheme, we can use this system to fully explore and explore the game's state space. The above number also includes unreachable state, such as full states on both sides. A program traversing the game space can give us a precise number: 3,861,821,161 unreachable states.

The game has no theoretical limit to how many rounds it can take. Both players may keep rolling the identical die over and over, cancelling each other out with the die they just rolled.

# Perfect Play

"Perfect play" means choosing the best move regardless of opponent's choice. Knucklebones' means taking into consideration probabilities of successive die rolls and the board state, "looking ahead", an infinite number or turns (though the number can be finite so you can reach a previous gaming state).

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

You should note, however, that perfect play in this case is something slightly different. Knucklebones uses a random element and the possibility of winning is a probability instead of binary.

The strategies as well as the solver a*sume the opponent plays perfect. However, AI opponents in the game may play worse than perfect. You can win most games by playing well.

# Greedy Strategy

This strategy is easy and straightforward. If a particular move results in the best immediate outcome (most wins for you and least loss for your opponent), it is worth taking, regardless of any potential consequences. If the number or points of more than one movement is equal, then all moves are considered the "best".

A greedy strategy is generally worse than perfect play by around 3.5%.

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 vastly over-complicated. There are so many subtle spreading effects that it would be impossible even to list every possible scenario and choice in one format that could still be considered a strategy. The only real strategy to perfect play is to use the solver (see below).

What about next-best? I was curious about how it would be possible to create a strategy in simple words that allowed you to play as flawlessly as possible. I created a program to generate random strategies (which are easy enough for Steam guides) and then developed them to find one as perfect as possible.

Here is my current best strategy.

1. You can move the same way as for the "Greedy Strategies" (described previously), but only if it has less than 2 dice on your side. If it has two or three dice, move on to step 2.

2. Move as you would for the "Greedy Strategies" (described previously), but only if it brings (or keeps) the opponent’s score below 7. Otherwise, go to step 3.

3. If you can place your dice in a manner that it would delete any matching opponent's die and you still have more points than the opponent then do so. Otherwise, you can go to step 4.

4. Move as you would with the "Greedy Strategies" (described below).

If you find this strategy somewhat random, that is because it is. This is what happens when you try to describe complex systems, with non-obvious multiplying and compounding results, using only a few simple guidelines.

This strategy is generally worse than perfect play by 2.1%. The greedy strategy is also susceptible to the compounding effect of sub-optimal performance.

# Solver

If you are determined to play flawlessly, the only option seems be to fully explore and map the game state space to determine the victory probabilities for each step and the optimal moves.

This tool is available:

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

As stated, this solver a*sumes perfect plays from both sides.

# References

You can find the source code for this guide and the solver here.