# What is your average VP score rolling 2 versus 4 dice after an initial 3322xx roll?

King of Tokyo has a die rolling mechanic similar to Yahtzee, where you get three rolls and may choose to hold or reroll any die you previously held. At the end of third roll, you must keep the resulting die faces. In King of Tokyo, there are three number faces, '1', '2', and '3' and three non-number faces. You only score Victory Points (VP) if you get a 3-of-a-Kind or more, scoring the die face and no points for non-number die faces or numbers with pairs or less. You initiallyscore the die face of the 3-of-a-Kind, and 1 additional point for each matching die face. For example:

-3 '1's score = 1 VP

-4 '1's score = 2 VP

-4 '2's score = 3 VP

-6 '3's score = 6 VP

-3 '3's and 3 '2's score = 5 VP

You have an initial roll of 3322xx, where 'x' isn't a number. Assume that for your third roll, you always choose to roll dice that will result in the greatest average increase in VP.

What is your expected average VP after your third roll if you choose to roll 2 dice versus 4 dice for your second roll? (i.e. Is it better to roll '22xx' or 'xx' if you want to score the most points on average?)

• If you're going to define the strategy of "rerolling 2 vs rerolling 4" you must also define the strategy for the second reroll. I instead think this should be rephrased "What strategy yields the highest expected value for 3322xx?" Feb 12, 2014 at 16:41
• @corsiKa, I already did, "what ever results in the greatest VP on average." For example, if your 2nd roll is 33322x, you would decide to roll 22x. Keeping the 33322 and rolling x results in 3+ (1/3)VP. Keeping 333 and rolling 22x results in 3+ (0.5)VP. Feb 12, 2014 at 17:49
• I've posted a formal analysis, with code, that says you should get more than 2.9 points for an initial roll of `3,3,2,2,x,x`. Feb 12, 2014 at 18:21
• And by 2.9 I really mean 3.1. Feb 12, 2014 at 18:59

### Your overall expected value is what you might expect: 3.1121.

In other words, you should almost always get your 3-set of 3s, or a 4-set of 2s.

I threw together a simulator to help with this. Now, because I am a lamer, I used Java. It requires Java 7 because it uses `<>` notation. If you're using an older version, be warned. Here's the simulator, first off. Please feel free to pick it apart for functionality, but as far as style goes I know there's a million improvements to be made. This is a throw-away script if there ever one. There may be copy/paste typos and what not, but the code is actually fairly readable. I will add comments and edit as necessary, although I will group edits together to delay community-wikization.

``````import java.util.*;
import java.text.*;
class Tokyo {
// shortcut for iterating over the faces of a die roll
static final int[] face = {0,0,0,1,2,3};

public static void main(String...args) {
// the initial roll - there's no control over this
final Roll init = new Roll(3,3,2,2,0,0);

// strat1: reroll all non 3s
// this gets all possible results and their counts from
// using strat 1 as our guide. see rollStrat1 on the Roll class
Map<Roll,Integer> strat1roll1 = init.rollStrat1();
report(strat1roll1);
// now, for each of those rolls, we need to simulate using the same
// strategy - the addTo makes sure we give proper credit to rolls that
// come up more often
Map<Roll,Integer> strat1roll2 = new HashMap<>();
for(Roll roll : strat1roll1.keySet()) { // for each roll from roll 1
Map<Roll,Integer> curr = roll.rollStrat1(); // reroll according to the strat
addTo(strat1roll2, curr); // and store them all in the master map
}
// now count the results
report(strat1roll2);

// strat2: reroll all non doubles - comments ommited because it's the same as above
Map<Roll,Integer> strat2roll1 = init.rollStrat2();
report(strat2roll1);

Map<Roll,Integer> strat2roll2 = new HashMap<>();
for(Roll roll : strat2roll1.keySet()) {
Map<Roll,Integer> curr = roll.rollStrat2();
}

report(strat2roll2);

// strat3: mix the two
Map<Roll,Integer> strat3roll2 = new HashMap<>();
for(Roll roll : strat2roll1.keySet()) {
Map<Roll,Integer> curr = roll.rollStrat3();
}
report(strat3roll2);

}

static DecimalFormat df = new DecimalFormat("###.00000");
static void report(Map<Roll,Integer> map) {
int sum = 0;
int count = 0;
for(Roll roll : map.keySet()) {
sum += roll.score() * map.get(roll);
count += map.get(roll);
}
double exval = ((double)sum) / (double)count;
System.out.println("total: " + sum);
System.out.println("count: " + count);
System.out.println("exval: " + df.format(exval));
}

// just merge the slave map into the master map
static void addTo(Map<Roll,Integer> master, Map<Roll,Integer> slave) {
for(Roll roll : slave.keySet()) {
Integer count = master.get(roll);
if(count == null) count = 0;
master.put(roll, count + slave.get(roll));
}
}

// reroll anything that isn't a 0 in the mask
// if it is a non-0, that is the number that will show up in the roll
// so if you want to re-roll a 2, in your strat method, turn that 2 into a
// 0 so it gets re-rolled
Map<Roll, Integer> rolls = new HashMap<>();
// iterate over every possibly die roll
for(int a = 0; a < 6; a++) {
for(int b = 0; b < 6; b++) {
for(int c = 0; c < 6; c++) {
for(int d = 0; d < 6; d++) {
for(int e = 0; e < 6; e++) {
for(int f = 0; f < 6; f++) {

Roll roll = new Roll(ra, rb, rc, rd, re, rf);
roll = roll.sort();
if(rolls.containsKey(roll)) {
rolls.put(roll, rolls.get(roll) + 1);
} else {
rolls.put(roll, 1);
}
}}}}}} // my code-review spidy sense is very pissed at me for this
return rolls;
}

// unused, YAGNI I know... but this does illustrate all possible rolls
static Map<Roll,Integer> possibleRolls() {
return roll(new Roll(0,0,0,0,0,0));
}

// this represnts a roll, but it also represents a mask - lame, I know
static class Roll {
final int a,b,c,d,e,f; // the dice you have
Roll(int a, int b, int c, int d, int e, int f) {
this.a=a; this.b=b; this.c=c;
this.d=d; this.e=e; this.f=f;
}
// welcome to Java - assumes they are properly sorted - a bad practice that
// should be fixed if this grew beyond its current scope
public boolean equals(Object o) {
Roll ros = (Roll)o;
Roll sor = this;
return ros.a == sor.a && ros.b == sor.b && ros.c == sor.c
&& ros.d == sor.d && ros.e == sor.e && ros.f == sor.f;
}
// order doesn't matter for the result, but this is a perfect hash, that's cool
public int hashCode() {
return (a+1) * (b+1) * (c+1) * (d+1) * (e+1) * (f+1);
}

Roll sort() { // delegate sorting to Arrays =)
int[] p = {a,b,c,d,e,f};
Arrays.sort(p);
return new Roll(p[0],p[1],p[2],p[3],p[4],p[5]);
}

int[] counts() { // convenience method
int[] counts = new int[4];
counts[a]++; counts[b]++; counts[c]++;
counts[d]++; counts[e]++; counts[f]++;
return counts;
}

int score() {
int[] counts = counts();

// trust the math =), or don't and work it out for yourself =)
return (counts[1] > 2 ? counts[1] - 2 : 0)
+ (counts[2] > 2 ? counts[2] - 1 : 0)
+ (counts[3] > 2 ? counts[3] : 0);
}

Map<Roll,Integer> rollStrat1() {
return keepAll(3);
}

Map<Roll,Integer> keepAll(int k) {
// reroll all non ks
int ra = a == k ? k : 0; // the mask will have ks or 0s
int rb = b == k ? k : 0;
int rc = c == k ? k : 0;
int rd = d == k ? k : 0;
int re = e == k ? k : 0;
int rf = f == k ? k : 0;
return roll(new Roll(ra,rb,rc,rd,re,rf));
}

Map<Roll,Integer> rollStrat2() {
// reroll anything that doesn't have 2x of something, except 0 - of course reroll 0s
int[] counts = counts();
int ra = counts[a] > 1 && a > 0 ? a : 0;
int rb = counts[b] > 1 && b > 0 ? b : 0;
int rc = counts[c] > 1 && c > 0 ? c : 0;
int rd = counts[d] > 1 && d > 0 ? d : 0;
int re = counts[e] > 1 && e > 0 ? e : 0;
int rf = counts[f] > 1 && f > 0 ? f : 0;
return roll(new Roll(ra,rb,rc,rd,re,rf));
}

Map<Roll,Integer> rollStrat3() {
int[] counts = counts();
if(counts[3] > 2 && counts[2] > 2) {
Map<Roll,Integer> map = new HashMap<>();
map.put(this,score());
return map;
}
if(counts[3] > 2) {
return keepAll(3);
}
if(counts[2] > 2) {
return keepAll(2);
}
return rollStrat1();
}
}

}
``````

What the results are when it is run is (these values have changed - see edit history).

``````c:\files\j>java Tokyo
total: 81756
count: 46656
exval: 1.75231
total: 5081940
count: 1632960
exval: 3.11210
total: 73872
count: 46656
exval: 1.58333
total: 1283040
count: 466560
exval: 2.75000
total: 1165885
count: 419909
exval: 2.77652
``````

What does this tell us? Well, first it validates the system by coming up with values nearly identical to those calculated by other methods for the first roll. That's excellent news.

Now, let's look at the actual results. The number of different values explodes for strategy 1, mostly because it is rerolling 4 different dice on the first pass, and probably an average of 3.5 or so for the second pass. The count seems so much higher because of the uniqueness, but I adjusted for this 'problem' in the code.

The second strategy starts off less, and does stand for improvement. For example, if you don't get your 2s the second time, would it be better to dump all the 2s and go for 3s? This is where I implement strat 3.

Rather than start off with the results from strat 1, which are only focusing on the 3s, I instead use the first roll of strat 2 to focus on acquiring doubles. Then, I shift focus: if I have both sets, haha, we're done here... thanks... If I have a set of 3s or a set of 2s, I keep it and ditch the other set: after all, it's silly to try to aim for that 1/6 chance to pick up the other set - much better odds in ditching those dice and put them into something that's already bearing fruit. Lastly, if I don't have a set, I default to just rolling all non 3s, which is the same as the original 'strat 1' and is shown to have a higher single-roll result than strat 2. And that yields an excellent result but still not better.

Note the 5 reports:

``````strat 1 roll 1
strat 1 roll 2

strat 2 roll 1
strat 2 roll 2

strat 3 roll 2 (its roll 1 is strat 2's roll 1)
``````

So the end result is that in this scenario, thus far the strategies indicate you should simply keep your 3s and go for it.

• Does strat 2 have an issue on roll 2 if you rolled two 1s? So if you end up with 332211 is it just keeping that? Probably won't make much of a difference, but worth correcting. Also, for strat 3 if you don't end up with either set, shouldn't you default back to strat 1, which has a better 1 roll expected value? Feb 12, 2014 at 18:36
• 332211 is as useful as 3322xx - the 1s get rerolled trying to get either a 3 or a 2 in strat 2 (and in strat 3, actually). So nothing to correct there. As far as strat 3 reverting to strat 2 over strat 1 for the failover: in that scenario, you have 2 2s and 2 3s. You are correct, but the engine does not agree with you. I do agree with you, though - therefore it must be the engine that is incorrect. I'm unable to find the bug, but I suspect it has to do with how it counts the total and the score, and how it weights the more-likely scenarios. Feb 12, 2014 at 18:53
• I removed the continues and commented that out. My results are still in line with the hand-calculated data for the first run, but the second run now appears more accurate. And it changes the result significantly. Feb 12, 2014 at 18:55
• updated to reflect the massive bug that changes the outcome, and increases your odds by .2 :D Feb 12, 2014 at 18:58
• Nice. Rerolling everything but 3s is also better from a non-VP view, as those 2s are completely worthless if you don't match them, but things like energy and hits might be worthwhile. Unless of course you are trying to avoid hitting. Feb 12, 2014 at 19:05

## Summary

You should keep the two threes and rethrow the rest. Your expected score is 2.81 (versus an expected score of 2.64 for keeping all four dice).

I calculated this using a script on my phone, but the values seemed to disagree with everyone else, so I rewrote it in python. Here's the python version for anyone to pick apart.

It takes a long time to run (much longer than the optimised version I wrote for my phone), so here is the output.

## Method

If you've looked at the output then you'll notice the script's doing a lot more than answering just this question. Rather it's calculating the best move for any set of dice showing, and with any number of throws left. It starts from the simple case of "no throws left" and increments the number of throws. This allows it to search all possible sets of kept dice, and compute the highest expected score from each.

## Optimal play

Taking the best moves given by the script I was able to find the optimal play for any given game state. After the first roll it's possible to be in one of 84 positions. Since we're treating claws, hearts and lightning bolts (4s, 5s and 6s) all as X's, you're more likely to have thrown Xs than e.g. 2s. The 84 positions are shown below:

The image has got shrunk a bit small, but if you open it in a new tab or zoom in then it's readable. Each square shows a particular roll you may have got, and highlights the dice you should keep. I've colour-coded the positions by whether you should keep 1s (red), 2s (green) or 3s (blue), some combination (yellow, cyan and magenta), or no dice (grey). The bottom of each square shows your expected score.

Once you have kept some of the dice and rerolled the rest you end up in one of the positions in the figure below. Again, this image shows which dice you should keep and what your expected score is.

After rolling for the third time, you end up in one of the positions in the figure below. This time the diagram shows you the actual score, and the colours correspond to which dice are getting you points.

## Example

Here's an example of how to use the images above. Imagine that for our first roll we get three 1s, two 2s and a 3. We look in the top figure and find the bit that looks like this:

This tells us our best bet is to keep the 2s and 3s, and reroll the 1s. Our expected score is 2.15. Rerolling those three dice, we get two 1s and a claw (an X). We look at the second image from above and find the bit that looks like this:

We are told that our best strategy now is to keep the 2s and reroll the rest. Our expected score has dropped to 1.25. Rerolling we get two more 2s, another 1, and a heart (an X). This puts us in this square from the third diagram above:

We score 3 points for a set of four 2s.

## Other results

While playing around with this problem I found several other interesting results.

The average expected score with three rolls left is 2.24. This drops to 1.34 if you haven't rolled any 1s, 2s or 3s in the first throw. It drops to 0.40 if you've still got nothing with one roll left.

The best strategy is usually to keep a single number and rethrow the rest, but occasionally you should keep more than one number (e.g. for (2,2,3,6,6,6) with 2 throws left you should keep (2,2,3)).

If on your first roll you get (1, 1, 1, 1, 3, 3) you should keep the 3s (expected score 2.81), but if it's your second roll you should keep the 1s (expected score 2.33).

If after the second roll, you have 3322xx:

Re-rolling 4 dice

Chance of one 3 being rolled = 4C1 * 1/6 * 5/6 * 5/6 * 5/6 = 500/1296
Chance of two 3s being rolled = 4C2 * 1/6 * 1/6 * 5/6 * 5/6 = 150/1296
Chance of three 3s being rolled = 4C3 * 1/6 * 1/6 * 1/6 * 5/6 = 20/1296
Chance of four 3s being rolled = 4C4 * 1/6 * 1/6 * 1/6 * 1/6 = 1/1296
Chance of three 1s being rolled = 4C1 * 1/6 * 1/6 * 1/6 * 4/6 = 16/1296
Chance of four 1s being rolled = 4C4 * 1/6 * 1/6 * 1/6 * 1/6 = 1/1296
Chance of three 1s and a 3 being rolled = 4C1 * 1/6 * 1/6 * 1/6 * 1/6 = 4/1296
Chance of three 2s being rolled = 4C1 * 1/6 * 1/6 * 1/6 * 4/6 = 16/1296
Chance of four 2s being rolled = 4C4 * 1/6 * 1/6 * 1/6 * 1/6 = 1/1296
Chance of three 2s and a 3 being rolled = 4C1 * 1/6 * 1/6 * 1/6 * 1/6 = 4/1296
Chance of zero 3s being rolled = 1 - the above probabilities = 583/1296

Expected average is the sum of all probabilities times the VPs that outcome yields:
(500 / 1296) * 3 = 1.157
(150 / 1296) * 4 = 0.463
(20 / 1296) * 5 = 0.077
(1 / 1296) * 6 = 0.005
(16 / 1296) * 1 = 0.012
(1 / 1296) * 2 = 0.001
(4 / 1296) * 4 = 0.012
(16 / 1296) * 2 = 0.025
(1 / 1296) * 3 = 0.002
(4 / 1296) * 5 = 0.015
(583 / 1296) * 0 = 0

Expected value for re-rolling 4 dice is 1.157 + 0.463 + 0.077 + 0.005 + 0.012 + 0.001 + 0.012 + 0.025 + 0.002 + 0.015 = 1.769 VPs

Re-rolling 2 dice

Chance of rolling two 3s = 2C2 * 1/6 * 1/6 = 1/36
Chance of rolling one 3 = 2C1 * 1/6 * 4/6 = 8/36
Chance of rolling two 2s = 2C2 * 1/6 * 1/6 = 1/36
Chance of rolling one 2 = 2C1 * 1/6 * 4/6 = 8/36
Chance of rolling one 3 and one 2 = 2C1 * 1/6 * 1/6 = 2/36
Chance of rolling zero 2s or 3s = 1 - above probabilities = 16/36

Expected average is the sum of all probabilities times the VPs that outcome yields:
(1/36) * 4 = .111
(8/36) * 3 = .666
(1/36) * 3 = .083
(8/36) * 2 = .444
(2/36) * 5 = .278
(16/36) * 0 = 0

Expected value for re-rolling 2 dice is .111 + .666 + .083 + .444 + .278 = 1.582VPs

Summary: On your last reroll in this situation, reroll the 2s. Rerolling 2 dice gives an average of 1.582 VPs compared to 1.769 VPs for rerolling 4 dice.

Note: This only works out which is better for the final reroll. It does not calculate what is better if the two rerolls are available.

• I think you double-counted the one 3 and one 2 scenarios. It should be chance of rolling one 3 and one that isn't a 2 or 3 to avoid that, making them 8/36 instead. Feb 12, 2014 at 14:30
• This question is specifically about the initial first roll, so only answering for the third roll isn't an answer. Additionally, if you roll 111, or 1111, or 222, etc. When rolling 4 dice you still score points. You need to factor those into your answer. Feb 12, 2014 at 14:56
• @user1873 Yes, you are correct about needing to factor those in. I did specify what my answer covers in the hope it's of some help. Feb 12, 2014 at 15:08
• Your expected value for 2 dice still seems wrong. The values for both the 1/36 cases are off. Feb 12, 2014 at 15:16
• updated to account for rolling 1111, 1113, 111, 2222, 2223 and 222. @bwarner updated those values. Good spot. Feb 12, 2014 at 15:31

first let's examine rerolling only 2 dice. since we can't get VPs from 1s, we want 2s and 3s.

there's 1/6 chance of either, so the options we like are:

• 1/36 of 2,2, worth 3 points
• 1/36 of 3,3, worth 4 points
• 2/36 of 2,3, worth 5 points
• 8/36 of 2,X, worth 2 points
• 8/36 of 3,X, worth 3 points

for a total average of 1.5833

rerolling 4 dice is to complicated to do by hand like that, so I wrote a short Python script that returned an average of 1.7523

so, baring any specific evolutions or items, reroll those 2s!

EDIT
assuming we reroll twice, as originally asked

if we know how much every dice pool is worth (on average, with optimal strategy) before final reroll, we can make an educated decision about the first reroll.

it's obvious we want to keep the 3s. we're not sure about the 2s, but definitely keep 3s.
so, we will definitely have 2 3s in the final roll. which options are better to keep then 2 3s?

• obviously any other pair or single number is worse then (3,3), as is 3 1s (to keep before final reroll on average). (3,3,2,2,2) is better the either (3,3) or (2,2,2)
• (3,3) is on average worth 1.7523
• (1,1,1,1) is on average worth 2.3333
• (3,3,2,2,2) is on average worth 2.6666
• (2,2,2,2) is on average worth 3.3333
• (3,3,3) is on average worth 3.5138
• (3,3,3,1,1,1) is on average worth 4
• (3,3,3,2,2,2) is on average worth 5

knowing that, we can write a script that will test all the possibilities if we keep only 3s or keep both, and use the highest average it qualifies for (if we get 3,3,2,2,2,2 we use 3.3333 as our value, despite our roll matching other, lesser options).

running said script I got a value of 2.6834 for keeping only 3s and 2.62024 for keeping both.
they're about 1 more then the case with 1 reroll (quite reasonable), but the numbers are lower then corsiKa's expected 3.1121, which is unexpected.
I will investigate further, as I love King of Tokyo and puzzles that I can play with and not just brute-force

can provide code used for calculations, if desired

• "for a total average of 1.5833," that is only for the 2nd roll. You need to continue the calculation for each of those intermediate steps. (I.e. Starting from (16/36) 3322xx, you get the best odds rolling all 4 dice (AVG 1.7523 supposedly), but that is just one state, you also have 33322x, 333322, 33222x, 332222. For those states you are probably rolling 3/2/3/2 dice respectively on the 3rd roll (haven't worked out the exact math) Feb 12, 2014 at 15:33
• true, I just assumed you're on your final roll. I will update accordingly, but since it's better to reroll 2s on final roll (in other words going for 3s), I would be extremely surprised if 2nd roll would be any different.
– tl.
Feb 12, 2014 at 16:04
• Why do you say "we can't get VPs from 1s"? 3 1s is worth 1 point, 4 1s is worth 2, and 5 1s is worth 3. Feb 13, 2014 at 15:34
• this question wrongly assumed we are rerolling only once. we rolled (3,3,2,2,X,X). if we reroll only Xs ("rerolling only 2 dice"), there will never be more then 2 1s.
– tl.
Feb 13, 2014 at 18:44