Zilch is a fun little dice game codified into an online game by Gaby Vanhegan that can be played at http://playr.co.uk/. Zilch is actually a variation of the game Farkle which goes by several other names including Zonk, 5000, 10000, Wimp Out, Greed, Squelch and Hot Dice^{1}. I've worked out the strategy that maximizes your expected game score and wanted to share the analysis, my strategy finder software, and the strategy itself. Depending on whether you have zero, one or two consecutive zilches from previous turns, three successively more conservative turn-play strategies are required to maximize your long term average score. Using these three strategies you rack up an average of 620.855 points per turn, which is the best you can possibly do.
Beyond the scope of Gaby's implementation of Zilch, the scoring rules of Farkle vary from venue to venue and the strategies provided here do not generally apply, but the analysis and the software do.
If you understand conditional probabilities, expectations, and can do a little algebra, you should be able to follow along. If you're just here to take the money and go pound someone in the game, you'll need to at least read and understand Strategy Formulation before you try to interpret the tables.
Contents
Background
I've found several blog postings where folks have offered probabilistic analyses of various aspects of the game^{2,3,4}, but none (that I've seen) find the game strategy that maximizes your expected points. It is possible that I'm the first to publish these solutions. If not, it was still a fun problem. I've always enjoyed software, algorithms, optimization, and probabilities and this problem delves into all of these areas.
The Rules of Zilch
Zilch is played with two players and six six-sided dice. (Though really there's nothing to stop you playing with more people, but this is not supported in the online game.)
Each player takes turns rolling the dice. The dice in a roll can be worth points either individually or in combination. If any points are available from the roll, the player must set aside some or all of those scoring dice, adding the score from those dice to their point total for the turn. After each roll, a player may either reroll the remaining dice to try for more points or may bank the points accumulated this turn (though you can never bank less than 300 points).
If no dice in a roll score, then the player loses all points accumulated this turn and their turn is ended. This is called a zilch, a sorrowful event indeed.
If all dice in a roll score, the player gets to continue his turn with all six dice. This is called a free roll and is guaranteed to brighten your day.
A player may continue rolling again and again accumulating ever more points until he either decides to bank those points or loses them all to a zilch.
If a player ends three consecutive turns with a zilch, they not only lose their points from the turn but also lose 500 points from their banked game score. (This is the only way to lose banked points.) After a triple zilch, your consecutive zilch count is reset to zero so you're safe from another triple zilch penalty for at least three more turns.
The game ends when one player has banked a total of 10,000 points and all other players have had a final turn.
Scoring is as follows:
- Each 1 is worth 100 points.
- Each 5 is worth 50 points.
- A set of three 1s is worth 1000 points.
A set of three 2s is worth 200 points.
A set of three 3s is worth 300 points.
A set of three 4s is worth 400 points.
A set of three 5s is worth 500 points.
A set of three 6s is worth 600 points.
Each extra die in a set doubles the value of the set. So four 4s are worth 800 points and six 1s are worth 8000. - Three pair is worth 1500 points.
- A six die straight is worth 1500 points.
- Six dice with no other scoring options at all are worth 500 points. (And this is why a 6 die roll is called a free roll: you can't zilch when rolling 6 dice.)
- Each die can only be used once when scoring. (If you roll two 1s, two 2s, and two 3s you can either count the two 1s for 200 or use all six dice for three-pair and 1500 points — you can't use the ones both ways for 1700 points.)
Limitations
The strategy presented will maximize your expected Zilch scores, but this is not necessarily the same strategy that will let you reach 10,000 points in the fewest number of turns; and certainly falls short of giving a complete gaming strategy that will maximize your chances of winning the game^{5}, the holy grail of Zilch analysis. In particular, the strategy considers neither your current overall score, nor your opponent's score, nor the fact that the game ends when a player reaches 10,000 points (after the other player gets a final turn). All that I offer is a way to maximize your expected Zilch scores.
My intuition is that when you're in the lead you should play more conservatively; and when you're behind you should play more aggressively. (Though I think it a common mistake to be too aggressive too early when behind.) Consider this extreme example. Let's say you're currently beating your opponent 7500 to 1500 and it's your turn. On your turn you rack up 2500 points and are faced with the choice of either banking the 2500 or rolling five dice to go for more points. The strategy identified here advises you to roll the five dice; but surely in this case it is better to bank the 2500, putting you at the game goal of 10,000 points and forcing your opponent to try to put out 8550 points in a single turn to steal the win away from you.
Analysis
Strategy Formulation
I will start by showing how to maximize the expected points for a particular turn. Because of the three consecutive zilch rule, the strategy that actually maximizes the average points gained across all turns is different: it is possible to trade off some expected gain in those turns where you have either zero or one consecutive zilches to reduce your zilch probability and more strongly avoid even getting into a turn where you are facing your third consecutive zilch. I will solve for this more complete strategy later, but for now let's stick with maximizing the expected points for a single turn and just ignore how such a greedy strategy might negatively affect the outcome of subsequent turns.
For my purposes, a Zilch turn has a state that may be completely defined by two variables (s, n) where s is the number of points accumulated in the current turn, and n is the number of dice you are about to roll. At the beginning of a new turn, the turn state is (s=0, n=6). Let's say for your opening roll you throw:
1, 3, 3, 4, 4, 6
The turn state will then advance to (s=100, n=5). You actually have no choice here: you must always select at least one scoring die and since the 1 (worth 100 points) is the only scoring die, you must select it. Furthermore, you are not allowed to bank less than 300 points so you must roll the five remaining dice.
Suppose with the remaining 5 dice you roll:
1, 1, 2, 3, 5
Here you have three scoring dice: two 1s and a 5. You now have a choice of turn states that you may enter:
- (s=150, n=4) (take just the 5)
- (s=200, n=4) (take a single 1)
- (s=250, n=3) (take a single 1 plus the 5)
- (s=300, n=3) (take the two 1s)
- (s=350, n=2) (take the two 1s plus the 5)
Note that s includes not just the points taken from this roll, but also all points accumulated in previous rolls during this turn as well. It should be clear that state B is better than A and state D is better than C. Of the remaining three states (B, D and E) it's not so obvious which is better. You also have the option of banking from either of states D or E (but not from B since you don't have 300 points in that case). Obviously, banking from state D is just plain dumb: if you're going to bank you'll do so from state E to bank as many points as you can! That leaves you with four reasonable choices:
- enter state B = (s=200, n=4) and roll;
- enter state D = (s=300, n=3) and roll;
- enter state E = (s=350, n=2) and roll; or
- enter state E = (s=350, n=2) and bank.
My objective is to find the optimal turn play strategy that defines what to do in all such situations which when followed will maximize the expected number of points for the entire turn starting from any given turn state.
Let E(s, n) be the expected number of additional points you will gain for the turn if you (perhaps non-optimally) roll while in state (s, n) but then follow the optimal turn strategy (which we hope to find) for all subsequent decisions in the turn. Note that E(s, n) includes not just the expected points for the upcoming roll, but all the expected points from all subsequent rolls, if any, as dictated by chance and the optimal play strategy.
Suppose we somehow solve for E(s, n) and find that:
E(s=200, n=4) = | 149 | ||
E(s=300, n=3) = | 34 | ||
E(s=350, n=2) = | -20 |
Applying this information to the example leads to the following final expected scores for the turn.
- Final expected score by rolling from state B = 200 + 149 = 349.
- Final expected score by rolling from state D = 300 + 34 = 334.
- Final expected score by rolling from state E = 350 - 20 = 330.
- Final expected score by banking from state E = 350.
So, the choice that leads to the highest expected score for the turn is to bank the 350 points. From this example, it should be clear that if we can find E(s, n) for all possible game states (s, n) we'll have the optimal Zilch turn play strategy.
Finding E(s,n) - the Zilch strategy function
Let,
T(s, n) = | { | s + max(0, E(s, n)) s + E(s, n) |
for s ≥ 300 for s < 300 |
(1) |
T(s, n) is simply the total expected points for the turn given that you are in turn state (s, n) and you follow the optimal strategy. The special case for s < 300 models the rule that you can't bank less than 300 points. The max function used when s ≥ 300 models the requirement that you bank when E(s, n) is negative, and roll otherwise.
Suppose we are in some particular state (S, N) then let r_{1}, r_{2}, … r_{R} be all possible rolls of N dice that do not result in a zilch. For any given roll r_{i} you can potentially enter multiple game states (s_{1}, n_{1}), (s_{2}, n_{2}), … (s_{K}, n_{K}) (depending on which combination of scoring dice you choose — just like in the previous example). Define C(r_{i}, S, N) to be the particular scoring combination among all scoring combinations possible with roll r_{i} that when applied to turn state (S, N) will advance the turn to the new state (S_{i}, N_{i}) that maximizes T. What could be simpler? Let C_{S} be the number of points taken in scoring combination C, and let C_{N} be the number of dice used in scoring combination C.
I also need a simple little function F(n) to reset the state variable n back to 6 when a score is selected that uses all remaining dice:
F(n) = | { | 6 n |
for n = 0 for n ≠ 0 |
(2) |
We can now express E(S, N) as a weighted sum of the expected scores of all states reachable from (S, N):
E(S, N) = -p_{N}(S+y) + | ∑_{i} | T(S_{i}, N_{i}) - S 6^{N} |
(3) |
where
S_{i} | = | S + C_{S}(r_{i}, S, N) |
N_{i} | = | F(N - C_{N}(r_{i}, S, N)) |
p_{N} | = | probability of zilching when you roll N dice |
y | = | zilch penalty. |
To handle the three zilch rule, I've introduced the constant y which gives the additional penalty (beyond loss of all turn points) for rolling a zilch. Setting y to 0 models turns where you have only zero or one consecutive zilches. Setting y to 500 models turns where you are playing with two consecutive zilches. As we shall see, these two cases will lead to two different turn play strategies.
The term -p_{N}(S+y) gives the expected decrease in your score due to the likelihood of a zilch. The terms (T(S_{i}, N_{i}) - S) give the expected increase in your score given that you throw r_{i}. Summing over all possible r_{i} and multiplying by the probability of rolling any particular r_{i} gives the appropriate weighted sum.
Equation 3 expresses E(S, N) in terms of the T values of all the game states reachable from (S, N). But here's the important thing: any game state (s, n) reachable by any roll r from (S, N) has s > S. (Your score can only go up if you don't zilch and by definition r is not a zilching roll.) So, if we already know T(s, n) for all s > S, then we can calculate E(S, N) using the above summation.
I claim there exists some large value of accumulated turn points S_{BIG} where the optimal turn play strategy is to always bank when faced with rolling less than six dice and to always roll when you have six dice to roll. If I set S_{BIG} equal a million points, then I'm claiming that if you've somehow accumulated a million or more points on the current turn (an absurdly large number of points to be sure) you'll want to bank them if you're ever faced with rolling five (or fewer) dice: the 7% chance of losing all of your points far outweighs any comparatively meager gains you might achieve by continuing to roll. This claim is equivalent to saying:
E(s, n) < 0 for s ≥ S_{BIG}, 1 ≤ n ≤ 5 | (4) |
Now if you have six dice to roll, you risk nothing so you might as well further insult your opponent by adding to your million point score. The number of points you expect to gain in this situation through the end of your turn is a constant:
E(s, n) = E_{BIG6} for s ≥ S_{BIG}, n = 6 | (5) |
Here's how to solve for E_{BIG6}. Let
E_{B} | = | the expected number of points gained from a single roll of 6 dice given that the roll does not grant another free roll (so you have to bank). | ||
E_{F} | = | the expected number of points gained from a single roll of 6 dice given that the roll does grant another free roll. | ||
p_{F} | = | probability of a 6 die roll granting another free roll. |
These terms are easily calculable by simply enumerating all the six die rolls and determining the best possible scoring combination in each case. (There's a subtlety here I'm not going to bore you with regarding how to score a roll of four 1s and a pair of either 2s, 3s, 4s or 6s; I explain this in detail in the software comments for the interested reader.) Once found they can be used in the following sum:
E_{BIG6} = (1-p_{F}) E_{B} + p_{F} (E_{F} + (1-p_{F}) E_{B} + p_{F} (E_{F} + ... )) | (6) |
This nicely simplifies to,
E_{BIG6} = | E_{B} + | p_{F} 1-p_{F} |
E_{F} | (7) |
Combining Equations 1, 4 and 5 give
T(s, n) = | { | s + E_{BIG6} s |
for s ≥ S_{BIG}, n = 6 for s ≥ S_{BIG}, 1 ≤ n ≤ 5 |
(8) |
Knowing T(s, n) for s ≥ S_{BIG}, we can now use Equation 3 to iteratively calculate E(S_{BIG} - 50, n), E(S_{BIG} - 100, n), … E(0, n). The rest is just the grunt work of writing the software to implement the curious function C; solving for E_{BIG6}; and solving for all E(s, n) for s < S_{BIG}. (Did I just slander my own profession?) But before we start grunting let's see what we can do about the three consecutive zilch problem.
Maximizing expected score across all turns
There are actually three different types of turns:
- T_{0}: a turn played with no previous consecutive zilches,
- T_{1}: a turn played with one previous consecutive zilch; and
- T_{2}: a turn played with two previous consecutive zilches.
Using the technique already described, we can find the strategies that will maximize the expected points in each of these turns independently, but what we really want is a strategy for each turn that when used together will maximize the average score for all of these turn types when weighted by the frequency of the appearance of the turn type in a game.
If z_{i} is the probability of zilching while in turn type T_{i} (while following some strategy designed specifically for that turn type) then we have the state transition diagram shown in Figure 1.
Performing a steady state analysis of this system we can find the probability t_{i} of being in any particular state T_{i}. (I.e., we want to find what fraction of our turns will be of each type.) We have these flow equations which must balance:
t_{0} = (1-z_{0})t_{0} + (1-z_{1})t_{1} + t_{2} t_{1} = z_{0}t_{0} t_{2} = z_{1}t_{1} |
Also
t_{0} + t_{1} + t_{2} = 1 |
Solving gives
t_{0} = 1 / (1 + z_{0} + z_{0}z_{1}) t_{1} = z_{0} / (1 + z_{0} + z_{0}z_{1}) t_{2} = z_{0}z_{1} / (1 + z_{0} + z_{0}z_{1}) |
Define E_{i} to be the expected points gained for a turn of type T_{i}. Then the average score for all turns is:
E_{AVG} = t_{0}E_{0} + t_{1}E_{1} + t_{2}E_{2} |
or
E_{AVG} = | E_{0} + z_{0}E_{1} + z_{0}z_{1}E_{2} 1 + z_{0} + z_{0}z_{1} |
(9) |
E_{AVG} is what we want to maximize. Both E_{i} and z_{i} are just a function of the strategy used to play a turn of type T_{i}. The strategy employed for T_{2} only affects E_{2}, so E_{2} can be independently maximized — something we already know how to do. That leaves the strategies for T_{0} and T_{1}. E_{2} is the term that's pulling down our average score since it's the turn played with the 500 point penalty for zilching. Can we modify our strategies for T_{0} and/or T_{1} in such a way so as to trade off some of our expected gains in those turns to reduce the coefficient z_{0}z_{1} on E_{2} and thereby actually increase E_{AVG}?
In Equation 3, I introduced the variable y to model the penalty for a zilch in a game. I said it should be set to 0 normally, but set to 500 if we are playing a turn where the third consecutive zilch is imminent. If we extend this idea and allow y to become a free variable, we can examine different levels of trade-off between expected score and the probability of zilching. For each y value, we'll find the optimal strategy given that zilch penalty; and then find both the expected number of points per turn and the probability of zilching on the turn for that strategy. E_{AVG} then becomes a function of just two variables y_{0} and y_{1}. We then need only to find the particular values Y_{0} and Y_{1} that maximize E_{AVG}. Piece of cake!
When doing this analysis, it's important to understand that the penalties y_{0} and y_{1} are artificial. The true zilch penalty for these turns is of course zero. Accordingly, the values calculated for E(s, n) will not represent the true expected change in points for the turn from state (s, n). But the values E(s, n) do still define a strategy, dictating that you roll if E(s, n) is positive, and that you bank when E(s, n) is negative. Likewise, the E(s, n) values are still used in the normal way to determine which state among the reachable states after a roll is most desirable. To get the actual expected increase in score from state (s, n), you must add back the false zilch penalty times the probability of zilching for the remainder of the turn. Although you could calculate this for all states (s, n); we only really need to know the true expectation for the turn as a whole, which we can get by correcting E(0, 6). This gives rise to the notion of a corrected expectation for the turn:
E_{C} = E(0,6) + yz | (10) |
Enough analysis! On to the results! Now I am become death, destroyer of Zilch.
Results
The optimal strategies
I wrote a little java program that solves for E_{BIG6}; finds E(s,n) for a supplied zilch penalty, y; for that strategy, calculates the probability of zilching, z; and also outputs the corrected expected points for the turn, E_{C}. Running the software for the case y=0 we get:
E_{BIG6} = | 478.237 | ||
E_{C} = E(0, 6) = | 623.017 | ||
z = | .193326 |
So the best you can do for a single turn is to rack up an average of about 623 points, and zilch about 1 time in 5. I'll get to the actual strategy tables shortly, but first let's solve for the optimal strategies required for the three zilch rule for turn types T_{0}, T_{1} and T_{2}.
Finding the best strategy for T_{2} is easy: just set y=500 and you get these results:
E_{2} = E(0, 6) = | 547.157 | ||
z_{2} = | .132148 |
You don't use E_{C} here since the 500 point zilch penalty is not artificial but real. This penalty reduces the maximum expected points per turn by about 12%. The more conservative play required here also reduces the zilch probability by about a third.
To find the best strategies for T_{0} and T_{1} we need to let the zilch penalty for those two turn types (y_{0} and y_{1}) vary and then maximize E_{AVG} as given by Equation 9. Table 1 shows how varying the penalty for zilching (y) affects the probability of zilching (z) and the corrected expected points per turn (E_{C}). Due to the integral nature of the problem, there are fairly large ranges of y that have no affect on the strategy. I'm only listing y values among those tried that produced a strategy change:
y | z | E_{C} |
---|---|---|
0 | 0.193326 | 623.017489 |
10 | 0.193326 | 623.017488 |
15 | 0.193302 | 623.017141 |
17 | 0.193296 | 623.017049 |
22 | 0.190399 | 622.955542 |
24 | 0.182110 | 622.759187 |
26 | 0.178151 | 622.657753 |
27 | 0.177759 | 622.647306 |
30 | 0.177757 | 622.647238 |
38 | 0.177723 | 622.645977 |
42 | 0.177619 | 622.641662 |
44 | 0.174575 | 622.509618 |
65 | 0.174551 | 622.508057 |
67 | 0.174543 | 622.507569 |
68 | 0.170991 | 622.268940 |
72 | 0.170988 | 622.268745 |
77 | 0.170631 | 622.241338 |
80 | 0.170620 | 622.240487 |
88 | 0.170484 | 622.228569 |
92 | 0.170389 | 622.219825 |
115 | 0.170387 | 622.219696 |
117 | 0.170383 | 622.219130 |
122 | 0.157678 | 620.678963 |
127 | 0.157507 | 620.657322 |
130 | 0.157498 | 620.656168 |
138 | 0.157427 | 620.646349 |
142 | 0.157364 | 620.637441 |
165 | 0.157362 | 620.637123 |
167 | 0.157357 | 620.636297 |
172 | 0.157356 | 620.636150 |
177 | 0.157286 | 620.623706 |
180 | 0.157271 | 620.620945 |
188 | 0.157239 | 620.615023 |
192 | 0.157171 | 620.602036 |
203 | 0.144131 | 617.962533 |
215 | 0.144129 | 617.962108 |
217 | 0.144120 | 617.960165 |
222 | 0.143469 | 617.816023 |
227 | 0.143448 | 617.811242 |
230 | 0.143424 | 617.805798 |
231 | 0.142245 | 617.534058 |
235 | 0.140672 | 617.165031 |
238 | 0.140661 | 617.162252 |
242 | 0.140573 | 617.141121 |
265 | 0.140572 | 617.140733 |
267 | 0.140558 | 617.137106 |
272 | 0.140556 | 617.136678 |
277 | 0.140553 | 617.135694 |
280 | 0.140521 | 617.126870 |
288 | 0.140519 | 617.126208 |
292 | 0.140413 | 617.095273 |
315 | 0.140411 | 617.094663 |
317 | 0.140401 | 617.091542 |
322 | 0.140391 | 617.088225 |
327 | 0.140390 | 617.088121 |
330 | 0.140376 | 617.083493 |
338 | 0.140376 | 617.083407 |
340 | 0.140343 | 617.072035 |
342 | 0.140031 | 616.965512 |
365 | 0.140029 | 616.964776 |
367 | 0.139995 | 616.952543 |
372 | 0.139981 | 616.947224 |
380 | 0.139967 | 616.942009 |
392 | 0.139576 | 616.788919 |
415 | 0.139575 | 616.788296 |
417 | 0.139555 | 616.780056 |
422 | 0.139544 | 616.775513 |
430 | 0.139522 | 616.765914 |
442 | 0.139326 | 616.679483 |
465 | 0.139325 | 616.678925 |
467 | 0.139318 | 616.675611 |
472 | 0.139308 | 616.670956 |
480 | 0.139279 | 616.657114 |
481 | 0.132230 | 613.270797 |
492 | 0.132148 | 613.230640 |
Pumping this table through a little awk script (which I hacked out at a command prompt and didn't save for you), I found that E_{AVG} is maximized when Y_{0} = 0 and Y_{1} = 72. Here are the summary statistics:
y_{0} = | 0 | ||
z_{0} = | .193326 | ||
E_{0} = | 623.017 | ||
y_{1} = | 72 | ||
z_{1} = | .170988 | ||
E_{1} = | 622.269 | ||
y_{2} = | 500 | ||
z_{2} = | .132148 | ||
E_{2} = | 547.157 |
E_{AVG} = 620.855 |
For turn type T_{0}, you're best off just going for the maximum expected points possible: trying to play more conservatively doesn't reduce your zilch probability (or the probability of entering state T_{2}) enough to offset the corresponding loss in expected points for turns of type T_{0}.
For turn type T_{1} (when you've got one consecutive zilch) you're best off pretending you will be penalized an extra 72 points if you zilch. This reduces your expected score by only 0.2% but reduces your probability of zilching by about 10%. This little extra protection against your third consecutive zilch slightly increases your overall average turn scores.
Let's move on to the actual strategies.
Strategy T_{0}: playing with no consecutive zilches
Table 2 below gives E(s, n) for all s ≤ 3200 for the case y = 0. This is the strategy achieving the maximum expected points for a turn and is the best strategy to use if you didn't zilch on your previous turn. The first table entry is E_{BIG6} = 478.237. The last table entry gives the total expected points for the turn: E_{0} = 623.017. The probability of zilching for the entire turn (not shown in the table) is z_{0} = .193326.
n | ||||||
---|---|---|---|---|---|---|
s | 6 | 5 | 4 | 3 | 2 | 1 |
3200 | 478.237 | -6.608 | -340.997 | -775.515 | -1319.085 | -1948.921 |
3150 | 478.237 | -2.750 | -333.126 | -761.626 | -1296.863 | -1915.588 |
3100 | 478.237 | 1.108 | -325.256 | -747.737 | -1274.640 | -1882.254 |
3050 | 478.323 | 4.966 | -317.386 | -733.848 | -1252.418 | -1848.921 |
3000 | 478.706 | 8.824 | -309.515 | -719.959 | -1230.196 | -1815.573 |
2950 | 479.301 | 12.682 | -301.645 | -706.070 | -1207.971 | -1782.162 |
2900 | 479.897 | 16.540 | -293.774 | -692.181 | -1185.734 | -1748.665 |
2850 | 480.492 | 20.398 | -285.904 | -678.291 | -1163.471 | -1715.134 |
2800 | 481.088 | 24.256 | -278.033 | -664.394 | -1141.189 | -1681.602 |
2750 | 481.683 | 28.114 | -270.161 | -650.488 | -1118.900 | -1648.070 |
2700 | 482.278 | 31.973 | -262.286 | -636.578 | -1096.612 | -1614.538 |
2650 | 482.874 | 35.833 | -254.407 | -622.667 | -1074.324 | -1581.006 |
2600 | 483.470 | 39.694 | -246.527 | -608.754 | -1052.035 | -1547.475 |
2550 | 484.069 | 43.558 | -238.645 | -594.840 | -1029.747 | -1513.943 |
2500 | 484.677 | 47.423 | -230.761 | -580.924 | -1007.458 | -1480.410 |
2450 | 485.290 | 51.290 | -222.876 | -567.008 | -985.170 | -1446.876 |
2400 | 485.975 | 55.157 | -214.989 | -553.089 | -962.881 | -1413.339 |
2350 | 486.949 | 59.026 | -207.101 | -539.170 | -940.591 | -1379.789 |
2300 | 488.222 | 62.896 | -199.211 | -525.251 | -918.299 | -1346.179 |
2250 | 489.496 | 66.767 | -191.320 | -511.331 | -895.995 | -1312.472 |
2200 | 490.771 | 70.640 | -183.429 | -497.410 | -873.664 | -1278.714 |
2150 | 492.048 | 74.513 | -175.538 | -483.482 | -851.309 | -1244.955 |
2100 | 493.326 | 78.386 | -167.645 | -469.545 | -828.945 | -1211.197 |
2050 | 494.604 | 82.260 | -159.748 | -455.601 | -806.581 | -1177.438 |
2000 | 495.884 | 86.136 | -151.848 | -441.655 | -784.217 | -1143.678 |
1950 | 497.164 | 90.013 | -143.944 | -427.706 | -761.853 | -1109.919 |
1900 | 498.448 | 93.894 | -136.037 | -413.755 | -739.488 | -1076.159 |
1850 | 499.740 | 97.776 | -128.128 | -399.802 | -717.124 | -1042.398 |
1800 | 501.041 | 101.661 | -120.218 | -385.848 | -694.759 | -1008.635 |
1750 | 502.344 | 105.547 | -112.306 | -371.893 | -672.394 | -974.870 |
1700 | 503.867 | 109.434 | -104.392 | -357.936 | -650.029 | -941.102 |
1650 | 505.684 | 113.323 | -96.476 | -343.979 | -627.662 | -907.298 |
1600 | 507.502 | 117.213 | -88.558 | -330.022 | -605.289 | -873.408 |
1550 | 509.327 | 121.105 | -80.641 | -316.064 | -582.895 | -839.469 |
1500 | 511.172 | 124.998 | -72.723 | -302.102 | -560.480 | -805.529 |
1450 | 513.033 | 128.891 | -64.805 | -288.132 | -538.055 | -771.583 |
1400 | 514.894 | 132.784 | -56.883 | -274.156 | -515.630 | -737.633 |
1350 | 516.756 | 136.679 | -48.958 | -260.177 | -493.203 | -703.679 |
1300 | 518.619 | 140.575 | -41.030 | -246.196 | -470.774 | -669.725 |
1250 | 520.484 | 144.474 | -33.100 | -232.212 | -448.345 | -635.771 |
1200 | 522.356 | 148.374 | -25.167 | -218.227 | -425.916 | -601.816 |
1150 | 524.236 | 152.277 | -17.233 | -204.240 | -403.487 | -567.860 |
1100 | 526.119 | 156.180 | -9.297 | -190.252 | -381.057 | -533.901 |
1050 | 528.180 | 160.085 | -1.360 | -176.263 | -358.627 | -499.941 |
1000 | 530.368 | 163.992 | 6.579 | -162.273 | -336.196 | -465.950 |
950 | 532.560 | 168.763 | 14.520 | -148.283 | -313.760 | -431.909 |
900 | 534.870 | 174.577 | 22.461 | -134.293 | -291.310 | -397.845 |
850 | 537.684 | 180.570 | 30.403 | -120.299 | -268.848 | -363.762 |
800 | 540.959 | 186.564 | 38.345 | -106.301 | -246.379 | -329.574 |
750 | 544.307 | 192.559 | 46.289 | -92.299 | -223.889 | -295.226 |
700 | 547.655 | 198.555 | 54.235 | -78.294 | -201.356 | -260.789 |
650 | 551.006 | 204.879 | 62.183 | -64.276 | -178.780 | -226.340 |
600 | 554.457 | 212.146 | 70.136 | -50.240 | -156.188 | -191.890 |
550 | 558.365 | 219.989 | 78.096 | -36.194 | -133.594 | -157.423 |
500 | 562.820 | 227.838 | 86.062 | -22.143 | -110.997 | -122.863 |
450 | 567.530 | 235.694 | 94.033 | -8.089 | -88.381 | -88.136 |
400 | 572.248 | 243.557 | 102.010 | 5.970 | -65.722 | -53.275 |
350 | 576.985 | 251.428 | - | - | -43.013 | -18.370 |
300 | 581.746 | - | - | 34.134 | -20.274 | 16.539 |
250 | - | - | - | 48.243 | 6.148 | 51.455 |
200 | - | - | 149.232 | 64.645 | 40.331 | - |
150 | - | - | 163.981 | 91.507 | - | - |
100 | - | 306.667 | 184.939 | - | - | - |
50 | - | 322.318 | - | - | - | - |
0 | 623.017 | - | - | - | - | - |
Using this table, you can easily figure out what to do in any turn play situation. Consider these examples.
- With 300 points and 3 dice to roll, you should roll.
- With 300 points and 2 dice to roll, you should bank.
- With 300 points and 1 die to roll, you should roll.
- With an opening roll of (3, 3, 3, 5, 2, 6) you should take the 5 and roll five dice.
- With an opening roll of (1, 1, 1, 1, 4, 4), you should score it as three pair for 1500 and take a free roll.
- If you already have 500 points and then roll (1, 1, 1, 1, 4, 4), you should score it as a set of four 1s for 2000 and bank.
Strategy T_{1}: playing with one consecutive zilch
Table 3 below gives E(s, n) for all s ≤ 3200 for the case y = 72. This is the optimal strategy for turns of type T_{1} (when you're playing with one consecutive zilch). The corrected expected points for the turn is: E_{1} = 622.269. The probability of zilching for the entire turn is z_{1} = .170988.
n | ||||||
---|---|---|---|---|---|---|
s | 6 | 5 | 4 | 3 | 2 | 1 |
3200 | 478.237 | -12.164 | -352.330 | -795.515 | -1351.085 | -1996.921 |
3150 | 478.237 | -8.306 | -344.460 | -781.626 | -1328.863 | -1963.588 |
3100 | 478.237 | -4.448 | -336.589 | -767.737 | -1306.640 | -1930.254 |
3050 | 478.237 | -0.590 | -328.719 | -753.848 | -1284.418 | -1896.921 |
3000 | 478.237 | 3.268 | -320.848 | -739.959 | -1262.196 | -1863.588 |
2950 | 478.490 | 7.126 | -312.978 | -726.070 | -1239.974 | -1830.254 |
2900 | 479.039 | 10.984 | -305.108 | -712.181 | -1217.751 | -1796.879 |
2850 | 479.635 | 14.842 | -297.237 | -698.292 | -1195.522 | -1763.412 |
2800 | 480.230 | 18.700 | -289.367 | -684.403 | -1173.271 | -1729.888 |
2750 | 480.826 | 22.558 | -281.497 | -670.510 | -1150.994 | -1696.356 |
2700 | 481.421 | 26.416 | -273.625 | -656.607 | -1128.707 | -1662.824 |
2650 | 482.016 | 30.275 | -265.751 | -642.699 | -1106.419 | -1629.292 |
2600 | 482.612 | 34.134 | -257.874 | -628.788 | -1084.130 | -1595.760 |
2550 | 483.208 | 37.995 | -249.995 | -614.876 | -1061.842 | -1562.229 |
2500 | 483.804 | 41.858 | -242.113 | -600.962 | -1039.554 | -1528.697 |
2450 | 484.408 | 45.722 | -234.230 | -587.047 | -1017.265 | -1495.165 |
2400 | 485.020 | 49.588 | -226.345 | -573.131 | -994.977 | -1461.631 |
2350 | 485.634 | 53.456 | -218.460 | -559.214 | -972.688 | -1428.095 |
2300 | 486.436 | 57.324 | -210.572 | -545.295 | -950.399 | -1394.558 |
2250 | 487.662 | 61.193 | -202.683 | -531.375 | -928.109 | -1360.988 |
2200 | 488.935 | 65.064 | -194.792 | -517.456 | -905.813 | -1327.317 |
2150 | 490.210 | 68.936 | -186.901 | -503.536 | -883.495 | -1293.567 |
2100 | 491.486 | 72.808 | -179.010 | -489.612 | -861.147 | -1259.809 |
2050 | 492.764 | 76.682 | -171.118 | -475.678 | -838.785 | -1226.051 |
2000 | 494.042 | 80.555 | -163.224 | -461.737 | -816.421 | -1192.292 |
1950 | 495.321 | 84.430 | -155.325 | -447.791 | -794.057 | -1158.532 |
1900 | 496.600 | 88.307 | -147.422 | -433.843 | -771.693 | -1124.773 |
1850 | 497.882 | 92.186 | -139.516 | -419.893 | -749.329 | -1091.013 |
1800 | 499.169 | 96.067 | -131.608 | -405.942 | -726.964 | -1057.253 |
1750 | 500.468 | 99.951 | -123.698 | -391.988 | -704.600 | -1023.492 |
1700 | 501.770 | 103.837 | -115.788 | -378.034 | -682.235 | -989.727 |
1650 | 503.075 | 107.723 | -107.874 | -364.077 | -659.870 | -955.960 |
1600 | 504.884 | 111.611 | -99.959 | -350.120 | -637.503 | -922.192 |
1550 | 506.702 | 115.501 | -92.042 | -336.163 | -615.137 | -888.340 |
1500 | 508.520 | 119.393 | -84.125 | -322.206 | -592.755 | -854.402 |
1450 | 510.357 | 123.285 | -76.207 | -308.248 | -570.346 | -820.463 |
1400 | 512.214 | 127.178 | -68.289 | -294.281 | -547.922 | -786.520 |
1350 | 514.075 | 131.071 | -60.370 | -280.306 | -525.497 | -752.572 |
1300 | 515.936 | 134.965 | -52.446 | -266.328 | -503.071 | -718.619 |
1250 | 517.799 | 138.861 | -44.519 | -252.348 | -480.643 | -684.665 |
1200 | 519.663 | 142.758 | -36.590 | -238.365 | -458.214 | -650.711 |
1150 | 521.529 | 146.658 | -28.658 | -224.381 | -435.785 | -616.756 |
1100 | 523.408 | 150.559 | -20.724 | -210.394 | -413.356 | -582.801 |
1050 | 525.290 | 154.463 | -12.789 | -196.408 | -390.926 | -548.844 |
1000 | 527.217 | 158.367 | -4.853 | -182.418 | -368.496 | -514.884 |
950 | 529.405 | 162.273 | 3.086 | -168.429 | -346.066 | -480.915 |
900 | 531.595 | 166.585 | 11.026 | -154.439 | -323.633 | -446.896 |
850 | 533.840 | 171.940 | 18.967 | -140.449 | -301.191 | -412.833 |
800 | 536.398 | 177.933 | 26.908 | -126.458 | -278.733 | -378.761 |
750 | 539.486 | 183.927 | 34.850 | -112.461 | -256.266 | -344.627 |
700 | 542.833 | 189.921 | 42.793 | -98.460 | -233.787 | -310.353 |
650 | 546.182 | 195.917 | 50.738 | -84.457 | -211.274 | -275.947 |
600 | 549.531 | 201.970 | 58.685 | -70.445 | -188.717 | -241.498 |
550 | 552.913 | 208.696 | 66.637 | -56.417 | -166.130 | -207.048 |
500 | 556.531 | 216.537 | 74.593 | -42.375 | -143.535 | -172.593 |
450 | 560.750 | 224.384 | 82.556 | -28.326 | -120.940 | -138.093 |
400 | 565.457 | 232.237 | 90.525 | -14.273 | -98.336 | -103.453 |
350 | 570.171 | 240.097 | - | - | -75.702 | -68.632 |
300 | 574.899 | - | - | 13.848 | -53.014 | -33.729 |
250 | - | - | - | 27.930 | -30.282 | 1.178 |
200 | - | - | 130.189 | 35.303 | -7.274 | - |
150 | - | - | 141.074 | 47.867 | - | - |
100 | - | 288.116 | 151.530 | - | - | - |
50 | - | 298.518 | - | - | - | - |
0 | 609.958 | - | - | - | - | - |
Strategy T_{2}: playing with two consecutive zilches
Table 4 below gives E(s, n) for all s ≤ 3200 for the case y = 500. This is the optimal strategy for turns of type T_{2} (when you're playing with two consecutive zilches). The expected points for the turn is: E_{2} = 547.157. The probability of zilching for the entire turn is z_{2} = .132148.
n | ||||||
---|---|---|---|---|---|---|
s | 6 | 5 | 4 | 3 | 2 | 1 |
3200 | 478.237 | -45.189 | -419.700 | -914.403 | -1541.307 | -2282.254 |
3150 | 478.237 | -41.331 | -411.830 | -900.515 | -1519.085 | -2248.921 |
3100 | 478.237 | -37.472 | -403.960 | -886.626 | -1496.863 | -2215.588 |
3050 | 478.237 | -33.614 | -396.089 | -872.737 | -1474.640 | -2182.254 |
3000 | 478.237 | -29.756 | -388.219 | -858.848 | -1452.418 | -2148.921 |
2950 | 478.237 | -25.898 | -380.348 | -844.959 | -1430.196 | -2115.588 |
2900 | 478.237 | -22.040 | -372.478 | -831.070 | -1407.974 | -2082.254 |
2850 | 478.237 | -18.182 | -364.608 | -817.181 | -1385.751 | -2048.921 |
2800 | 478.237 | -14.324 | -356.737 | -803.292 | -1363.529 | -2015.588 |
2750 | 478.237 | -10.466 | -348.867 | -789.403 | -1341.307 | -1982.254 |
2700 | 478.237 | -6.608 | -340.997 | -775.515 | -1319.085 | -1948.921 |
2650 | 478.237 | -2.750 | -333.126 | -761.626 | -1296.863 | -1915.588 |
2600 | 478.237 | 1.108 | -325.256 | -747.737 | -1274.640 | -1882.254 |
2550 | 478.323 | 4.966 | -317.386 | -733.848 | -1252.418 | -1848.921 |
2500 | 478.706 | 8.824 | -309.515 | -719.959 | -1230.196 | -1815.573 |
2450 | 479.301 | 12.682 | -301.645 | -706.070 | -1207.971 | -1782.162 |
2400 | 479.897 | 16.540 | -293.774 | -692.181 | -1185.734 | -1748.665 |
2350 | 480.492 | 20.398 | -285.904 | -678.291 | -1163.471 | -1715.134 |
2300 | 481.088 | 24.256 | -278.033 | -664.394 | -1141.189 | -1681.602 |
2250 | 481.683 | 28.114 | -270.161 | -650.488 | -1118.900 | -1648.070 |
2200 | 482.278 | 31.973 | -262.286 | -636.578 | -1096.612 | -1614.538 |
2150 | 482.874 | 35.833 | -254.407 | -622.667 | -1074.324 | -1581.006 |
2100 | 483.470 | 39.694 | -246.527 | -608.754 | -1052.035 | -1547.475 |
2050 | 484.069 | 43.558 | -238.645 | -594.840 | -1029.747 | -1513.943 |
2000 | 484.677 | 47.423 | -230.761 | -580.924 | -1007.458 | -1480.410 |
1950 | 485.290 | 51.290 | -222.876 | -567.008 | -985.170 | -1446.876 |
1900 | 485.975 | 55.157 | -214.989 | -553.089 | -962.881 | -1413.339 |
1850 | 486.949 | 59.026 | -207.101 | -539.170 | -940.591 | -1379.789 |
1800 | 488.222 | 62.896 | -199.211 | -525.251 | -918.299 | -1346.179 |
1750 | 489.496 | 66.767 | -191.320 | -511.331 | -895.995 | -1312.472 |
1700 | 490.771 | 70.640 | -183.429 | -497.410 | -873.664 | -1278.714 |
1650 | 492.048 | 74.513 | -175.538 | -483.482 | -851.309 | -1244.955 |
1600 | 493.326 | 78.386 | -167.645 | -469.545 | -828.945 | -1211.197 |
1550 | 494.604 | 82.260 | -159.748 | -455.601 | -806.581 | -1177.438 |
1500 | 495.884 | 86.136 | -151.848 | -441.655 | -784.217 | -1143.678 |
1450 | 497.164 | 90.013 | -143.944 | -427.706 | -761.853 | -1109.919 |
1400 | 498.448 | 93.894 | -136.037 | -413.755 | -739.488 | -1076.159 |
1350 | 499.740 | 97.776 | -128.128 | -399.802 | -717.124 | -1042.398 |
1300 | 501.041 | 101.661 | -120.218 | -385.848 | -694.759 | -1008.635 |
1250 | 502.344 | 105.547 | -112.306 | -371.893 | -672.394 | -974.870 |
1200 | 503.867 | 109.434 | -104.392 | -357.936 | -650.029 | -941.102 |
1150 | 505.684 | 113.323 | -96.476 | -343.979 | -627.662 | -907.298 |
1100 | 507.502 | 117.213 | -88.558 | -330.022 | -605.289 | -873.408 |
1050 | 509.327 | 121.105 | -80.641 | -316.064 | -582.895 | -839.469 |
1000 | 511.172 | 124.998 | -72.723 | -302.102 | -560.480 | -805.529 |
950 | 513.033 | 128.891 | -64.805 | -288.132 | -538.055 | -771.583 |
900 | 514.894 | 132.784 | -56.883 | -274.156 | -515.630 | -737.633 |
850 | 516.756 | 136.679 | -48.958 | -260.177 | -493.203 | -703.679 |
800 | 518.619 | 140.575 | -41.030 | -246.196 | -470.774 | -669.725 |
750 | 520.484 | 144.474 | -33.100 | -232.212 | -448.345 | -635.771 |
700 | 522.356 | 148.374 | -25.167 | -218.227 | -425.916 | -601.816 |
650 | 524.236 | 152.277 | -17.233 | -204.240 | -403.487 | -567.860 |
600 | 526.119 | 156.180 | -9.297 | -190.252 | -381.057 | -533.901 |
550 | 528.180 | 160.085 | -1.360 | -176.263 | -358.627 | -499.941 |
500 | 530.368 | 163.992 | 6.579 | -162.273 | -336.196 | -465.950 |
450 | 532.560 | 168.763 | 14.520 | -148.283 | -313.760 | -431.909 |
400 | 534.870 | 174.577 | 22.461 | -134.293 | -291.310 | -397.845 |
350 | 537.684 | 180.570 | - | - | -268.848 | -363.762 |
300 | 540.959 | - | - | -106.301 | -246.379 | -329.574 |
250 | - | - | - | -92.299 | -223.889 | -295.226 |
200 | - | - | 37.142 | -128.047 | -266.961 | - |
150 | - | - | 8.190 | -189.755 | - | - |
100 | - | 196.017 | -32.853 | - | - | - |
50 | - | 167.775 | - | - | - | - |
0 | 547.157 | - | - | - | - | - |
Comparing Table 4 with Table 2 you can see that playing with two consecutive zilches is almost identical to playing without any consecutive zilches while pretending you have 500 more points for the turn than you really do. To see this compare the 500 point line in Table 4 with the 1000 point line in the Table 2. They are identical. This remains true until you get down to point values below 300 at which time the 300 point minimum bank rule forces you to roll even though rolling gives a negative expected change in your score.
Software
The software I wrote to find optimized Zilch strategies is 718 lines of java code (or 322 lines comments stripped). Please observe the GNU public license copyright protection or I may have to introduce you to my friend Guido. You can download with either zip or tgz compression as convenient:
Downloads: zilch.zip OR zilch.tgz
The compile command is simply:
javac Zilch.java
Then to run it type:
java Zilch
You can optionally add a zilch penalty to the command line. For example, to run the program with y = 500 type:
java Zilch 500
To find the best strategy for variations of the game that use different scoring rules, just change the scoring constants at the top of the file. If you set a score to zero, then that score combination is effectively eliminated from the game and is instead treated as a zilch. So if in your Farkle variant, the six-die nothing roll is just a zilch, you need only set NOTHING_SCORE = 0. The software will then interpret this as a zilching roll.
E_{BIG6} is calculated for you. If you set the NOTHING_SCORE to 0, (giving you a non-zero chance of zilching on a 6 die roll) then E_{BIG6} will be correctly initialized to 0. There's a chicken-and-egg problem associated with the calculation of E_{BIG6} which required a bit of finger work to resolve reliably in the face of various possible scoring changes. Check out the comments for method initEBIG6 if you're interested.
The smallest valid value for S_{BIG} is also determined through a binary search, so you need not worry about changing that for different scoring options.
On my 10 year old home computer, the strategy for Zilch is determined in about 7 seconds. Farkle strategies take about 30 seconds. (Farkle is much slower because S_{BIG} has to be set big enough that the chance of a 6 die farkle out-weighs the potential gains of a 6 die roll.) No doubt you could solve these same problems in a tiny fraction of a second with appropriate optimizations, but I personally don't have a need for better performance.
Conclusions
This was a fun problem. The trick is to work the problem backwards: finding the expected scores for high point states first, and then working your way back down to lower and lower scores until finally you get the expected score from the starting state. Everything else is just details (which hopefully I've gotten correct).
One thing I found surprising about the results is just how incredibly insensitive the corrected expected turn score is to the zilch penalty. The optimal strategy for the case of an infinite zilch penalty drops the probability of zilching from .193326 down to .126959 (the minimum zilch probability you can achieve for a turn). Playing that same strategy on a turn where the zilch penalty is actually zero drops your expected score from 623.017 down to 605.851 — it only costs you 17 points per turn! That's less than 300 points over the course of a typical game, and that's nothing in a game of Zilch. I think this is true because almost all the big points in Zilch come from 6 die rolls where there's no chance to zilch. So, playing to reach 300 points as reliably as you can and then banking as soon as you face a roll of less than six dice reduces your expected scores very little compared to playing for maximum expected points. I found this very surprising and somehow unsatisfying.
I'd be pleased to know if you found this document comprehensible; or if you found any errors in the analysis or the software. Leave a comment or send me an email. If you're lucky, you might even meet me masquerading as pips in a game of Zilch. Just don't expect to win.
References
- FARKLE, Wikipedia.
- Multinomial Coefficients and Farkle, Cap Khoury, Jul. 2009.
- Farkle Odds, Gregory Graham, August 2009.
- Study of the game Zilch part 1, Leadhyena Inrandomtan, November 2008.
- FARKLE, Expectation, and Knowing What You Want, Cap Khoury, August 2009.
I’ve discovered a very tiny error: because I was only printing out zilch probabilities and corrected expected scores to six decimal places, the script I ran the data through picked the wrong strategy for turn type T0: it turns out that you should really play a turn when you have no consecutive zilches as if you’ll lose an extra 10 points. This corresponds to the second strategy in Table 1. The error is only on the order of a millionth of a point per turn played and so is perhaps not worth mentioning, but in the interest of correctness I mention it anyway! I’m not going to bother modifying this document to correct it. The search algorithm I use in the Farkle Strategy Generator does not suffer from this rounding error.
Thats quite a nice article. The Math behind let u proof the sense for your strategy
Are you sure that that’s right? On conclusions you say that if when you zilch you get an infinite penalty your average roll remains positive: isn’t that impossible since there is always a chance not infinitely small of zilching, so your average score should be negative infinite?
Hello Lebossle,
Thank you for your comment. The only thing I’m sure of is death and taxes.
In that paragraph of my conclusions, I was talking about the corrected expected score, but I can definitely see how it was confusing especially if you didn’t read the entirety of the article. I’ve taken liberty to rewrite that paragraph to make it (hopefully) more clear. For that discussion, the zilch penalty is zero, but I’m telling the equations that the zilch penalty is infinite to trick them into working very very hard to avoid zilching. By doing this I produce the most conservative strategy you can possibly play. (I.e., the strategy that gets you to 300 points with the smallest probability of zilching.) If you play THAT strategy when there is no zilch penalty at all, you will find yourself getting on average 17 points per turn LESS than you would if you play the strategy that simply maximizes expected score.
I purposefully glossed over some of my claims in the section “Maximizing expected scores across all turns”, because I thought the mathematics behind them too tedious (or perhaps it is my limited mathematical skill that makes them too tedious) for a blog entry. But I’ll say a little more here as it pertains to your comment.
By setting the zilch penalty to some value y, equation (3) will produce a particular strategy G(y) that produces the highest possible expected score given that the zilch penalty is y. Now here’s the funny part: what happens if you play strategy G(y) when in actuality the zilch penalty is zero? It may not be obvious why you’d ever want to do that, but the interesting thing is that if you use G(y) for a turn where there is no zilch penalty, then you will be playing the strategy that gives the best possible expected score with the constraint that you are not allowed to zilch with higher probability than the probability of zilching with strategy G(y). If this were not the case, then it’s easy to show that G(y) isn’t actually the best strategy for the situation where the zilch penalty is y, but we know that it is the best. So, if you consider all other possible strategies having a zilch probability the same or less than the zilch probability of G(y), none of them will give a better expected score than G(y). That’s very useful because for purposes of finding the strategies that maximize expected scores across all turns, the only thing we care about is their expected score and their zilch probability.
So in the section “Maximizing expected scores across all turns”, the zilch penalty y is fictitious for turn types T0 and T1. I only introduce it as a means of producing strategies G(y) that maximize expectation for various inferred zilch probabilities. It turns out that from the infinitude of possible strategies, there are only a few hundred strategies G(y) for 0 ≤ y < ∞; and it becomes quite possible then, to find the two particular strategies that are best to use for turn types T0 and T1.
If you plot the expected scores E(G(y)) vs. the zilch probabilities z(G(y)); you’ll see that E(G(y)) is strictly increasing in z(G(y)). Furthermore, if you connect the data points in this plot with straight line segments; you’ll see the slope of these segments is strictly decreasing. It is perhaps noteworthy that between any two neighboring strategies G(y_{i}) and G(y_{i+1}), there could exist other strategies with intermediate zilch probabilities and intermediate expected scores, but such strategies will always appear below (or conceivably on) the straight line joining G(y_{i}) and G(y_{i+1}) and are never a superior strategy to play for any possible zilch penalty.
As a notable aside, you can set the minimum bank threshold to, say, 1000 points and again let the zilch penalty go to infinity and produce the strategy that gets you to 1000 points with the minimum probability of zilching.
I hope that helps.
Matt
Lovely article about Zilch, really. I didn’t know it came from Farkle. Thanks!
This was an excellent article – I very much appreciated all the effort put into this! In particular, I was trying to formulate an optimal Farkle strategy for myself, until I came across your analysis. Having read everything very thoroughly, and played with your equations myself, I do have a query regarding your estimate of E(BIG6) for use in Farkle – not Zilch. I think one of the biggest differences between the two games appears to be the non-zero probability of getting a non-scoring roll with 6 dice. As I understand the two games, this is not possible with Zilch, whereas it is with Farkle. I have spent a lot of time trying to come up with an estimate of E(BIG6) for Farkle, because Equation (7) does not apply. When I changed the settings in your model to Facebook Farkle and generated the corresponding strategy, I noticed that the possibilities ran to scores of over 16,000! Yet, I doubt if any Farkle player would risk a 16,000 point score with a 2.3% chance of losing it all. I believe the “stopping score” would be much lower, but I’m having difficulty formulating the equation for this. I have not looked at your java code (I am not a programmer in java), but I suspect that my issues arise from what you describe as your chicken-and-egg problem for initializing E(BIG6). I would love to get your feedback and to extend discussion on this issue.
Tom,
Let me first tackle the insanity of rolling when you have 16,000 points. As I stated in Limitations, the strategy that maximizes expected score is NOT always the same strategy that maximizes your chance of winning the game. This is one of those situations. If you’re out to win, then yeah, you’d definitely bank the 16,000 points since that assures the win. But if you’re trying to maximize expected score, then (surprisingly enough) it’s actually better to roll 6 dice into 16,000 points. I’ll calculate that by hand here.
There are 6^{6} = 46656 different ways to roll six dice. Of these 1080 are farkles. So, as you noted, the chance of farkling = 1080/46656 = 1 / 43.2 = 2.3%. Then the negative expectation component in our sum is just -16,000 / 43.2 = -370.3703. Now the other 45576 rolls are not farkles and yield points. If you add up all the highest scoring combos from each of these rolls you get 17,709,000 points. So the average score (given that you don’t farkle) is just 17,709,000 / 45576 = 388.5598 points. Just as we multiplied the -16,000 by the chance of farkling, we need to multiply this average score by the chance of NOT farkling; so our positive expectation component is 388.5598 * (1 – 1/43.2) = 379.5656. And our net expectation is 379.5656 – 370.3703 = 9.1953. So on average if you roll 6 dice into 16,000 points, you’ll gain 9.1953 points. Now run the Farkle Strategy Generator for Facebook Farkle scoring, flip to the Expected Score table for turn type T0, and examine the table entry corresponding to 16000 turn points with 6 dice to roll. You’ll see the final expected turn score of 16009.195 points. Voila!
You are right that for Facebook Farkle scoring rules there is always a non-zero probability of farkling, whereas in Zilch a throw of 6 dice always yields positive points. In zilch, you always throw 6 dice when you get the chance, no matter how high your score. This leads to an infinite series of increasingly unlikely game states which must be added to the total expectation of turn score. E_{BIG6} is introduced to deal specifically with this infinite series. Things are actually simpler in Facebook Farkle since rolling 6 dice into anything more than 16350 points always yields negative expectation to your score. So you must simply bank 16400 or more points. There is no infinite series to sum and accordingly E_{BIG6} doesn’t enter into the equations for Facebook Farkle at all. You shouldn’t be trying to calculate it. The software just sets E_{BIG6} to zero for Facebook Farkle scoring.
For Facebook Farkle, all you need worry about is finding S_{BIG}. To find it, you just make a guess, start running your calculations down from your chosen value of S_{BIG}, and verify that E(S_{BIG}-50, 6) is negative. If it is, then you’ve picked an S_{BIG} that is big enough. If not, increase it. In the software, I use a binary search to zero in on the minimum value for S_{BIG}. (Well, actually it picks a value for S_{BIG} that is 50 points bigger than it needs to be, but that results in the last row of produced strategy tables being all banking states — which I think rather nice anyway.)
I hope that helps.
Matt
To what are referring when you say ‘strategy finding software’?
Kayen,
In the Software section of this blog post is a link to my original java software used to find the strategies that maximize expected scores in the game of Zilch. This software is open-source and is protected by GPL 3.
Subsequently, I rewrote the strategy generation tool in C++. The new version is perhaps 3 orders of magnitude faster, solves for 3 turn strategies, and is in general far more flexible. The C++ version of the strategy finder is not shared, but you can run it through use of the Farkle Strategy Generator.
Matt
Pingback: Analysis of Farkle | Possibly Wrong
The analysis of Farkle found at Possibly Wrong which was done for a particular set of scoring rules produces an expected turn score of 542.063 points. The results of the FSG for these same score settings are identical giving strong evidence of correctness. You can see for yourself by running the FSG with these settings:
http://www.mattbusche.org/projects/farkle/strategy.php?set1=100,200,300,1000,2000,3000&set2=0,0,200,1000,2000,3000&set3=0,0,300,1000,2000,3000&set4=0,0,400,1000,2000,3000&set5=50,100,500,1000,2000,3000&set6=0,0,600,1000,2000,3000&straight=1500&threepair=1500&flexpairs=true&twotriplet=2500¬hing=0&penalty=0&minbank=0