Audamir

part 06

How deep is dice poker? An exact calculation that comes before building

Five dice, two re-rolls and nine payout tables. An exact calculation shows how much better optimal play is than a simple rule, and that it depends on the table more than expected. The tool and the tables are given in full.

· 18 min read

The article From the tavern to Knucklebones says that dice poker is good for one evening: after an hour of play there is nothing left to discover in it. That sentence comes from a measurement made in Audamir before anything was built for the casino. The table from which the measurement came was not preserved, so its numbers cannot be verified. This article repeats the measurement from the beginning: with a tool that is given in full in it, and with nine payout tables that are written out. The result is less clear-cut than that sentence and depends on the table, which is why it is written up separately.

What the depth of a game is and why measure it before building

A game is deep when the road is long from a game without decisions to a game with the best decisions. Three points on that road are enough: chance (a player who does not decide), a simple rule (a player who always follows one sentence) and the optimum (a player who in every situation makes the best possible decision). If a simple rule reaches almost the optimum, there is nothing new to discover after the first hour of play. If it reaches only half, there is room to grow.

It can be found out before building: it is enough to calculate what the optimum achieves, what the rule and what chance. In the article on dice in games this became the criterion for the planned dice game with a boss: a difference between the optimum and chance of at least 25 percentage points (pp) and between the optimum and the simple rule of at least 5 pp; if the prototype does not meet these limits, the idea is dropped. There it was about the chance to win a duel. Here the same measure is applied to the share of the expected payout of the optimum, so it is a similar measurement, not the same one. The limits of 25 and 5 are a proposal, not proof.

The game that is measured

Five six-sided dice. The player rolls all of them and then twice may keep any dice and re-roll the others. After the last roll, according to the combination, the payout table pays: five of a kind, four of a kind, full house (three and a pair), straight (1 to 5 or 2 to 6), three of a kind, two pairs and a pair; everything else pays 0. The payout is per unit of bet: 3 means three bets back. There is no opponent here, the player plays against the table. So it is dice poker as a casino screen in the game would have it, not a duel of two players as in The Witcher.

Five dice have 7,776 possible rolls. On the first roll they come out like this (counted by hand and verified in the tests of the tool):

CombinationRolls out of 7,776Chance
five of a kind (5 the same)60.08%
four of a kind (4 + 1)1501.93%
full house (3 + 2)3003.86%
straight (1 to 5 or 2 to 6)2403.09%
three of a kind (3 + 1 + 1)1,20015.43%
two pairs (2 + 2 + 1)1,80023.15%
pair (2 + 1 + 1 + 1)3,60046.30%
nothing (no pair and no straight)4806.17%

Four ways to play

  1. The optimum. In every hand and with any number of re-rolls left it keeps what gives the highest expected payout.
  2. "Keep the most frequent value". It keeps all dice with the value that is on the most dice and re-rolls the rest. In a tie the higher value wins (two pairs: the higher pair; all dice different: the highest die). The tie is a rule that had to be set, but with these tables it changes nothing: both versions give the same numbers, because the tables do not change when the dice are turned over (1 becomes 6, 2 becomes 5, 3 becomes 4).
  3. No re-rolling. The player takes the first roll.
  4. Random. It keeps each die with a chance of 1/2, whatever it shows. It is computed exactly, not by simulation. It comes out exactly the same as no re-rolling, and by a principle: the decision does not depend on what the dice show, so a die that is kept and a die that is re-rolled are both, after the step, uniform and independent of the others. The hand at the end has the distribution as after a single roll, whatever the chance of keeping a die. That is why the table below has one column for both.

Payout tables

Nine tables, in the order five of a kind, four of a kind, full house, straight, three of a kind, two pairs, pair (nothing always pays 0). The last column is the return of the optimum: how many bets come back on average with the best play.

Tablefive of a kindfour of a kindfull housestraightthree of a kindtwo pairspairReturn of the optimum
A1054321.51326.1%
B10643210.5332.9%
C8533211288.5%
D20854321489.0%
E532.521.510.5202.7%
F4210.50.50095.1%
G511110094.2%
H51.51.51.500093.6%
I10640210.5330.1%

Tables A to E are generous: with the best play 2.0 to 4.9 bets come back for one bet staked. Nobody would put such tables in a casino; they serve to show how the result depends on the shape of the table (a ladder from five of a kind to a pair, a flat ladder, a steep top). Tables F, G and H are casino tables: the return of the optimum is 93.6 to 95.1%, so with the best play one loses. G is flat from four of a kind to three of a kind, H pays a straight the same as four of a kind and a full house. Table I is table B without the straight. The tables were chosen by hand, not exhaustively.

How it was calculated

It is calculated exactly, not by sampling. A hand is a multiset of dice (the order does not matter, only how many dice show which face), so for five dice and six faces there are only 252 of them. For every hand and for everything that can be kept from it (a sub-multiset) it is known which hands arise after re-rolling the other dice and with what chance. Then one goes backwards, by dynamic programming:

  • with no re-roll left the value of a hand is its payout;
  • with one more re-roll the value of a hand is the best keep: the average of the values of the hands that arise from it after re-rolling, weighted by their chance;
  • with two it is the same one level up;
  • the value of the game is the average of the values of all 252 hands after the first roll, weighted by their chance.

The rule "most frequent", no re-rolling and the random strategy use the same backward pass, only instead of the best keep they use a fixed one. The whole calculation takes about a third of a second. Here is the core in full; it runs in Node 18 or later and prints three values for table B:

// Dice poker, exact: five dice, two re-rolls.
// A hand is a vector of counts (h[f] = how many dice show the face f), hands are multisets.
// payouts: five of a kind, four of a kind, full house, straight, three of a kind, two pairs, pair
const TABLE = [10, 6, 4, 3, 2, 1, 0.5];

function payout(h) { // nothing pays 0
  const shape = h.filter((c) => c > 0).sort((a, b) => b - a).join('');
  const faces = h.map((c, f) => (c ? f : -1)).filter((f) => f >= 0);
  const straight = faces.at(-1) - faces[0] === 4 ? 3 : -1;
  const kind = { 5: 0, 41: 1, 32: 2, 311: 4, 221: 5, 2111: 6 }[shape] ?? straight;
  return kind < 0 ? 0 : TABLE[kind];
}

function solve(payout, { dice = 5, sides = 6, rerolls = 2 } = {}) {
  const fact = (n) => (n <= 1 ? 1 : n * fact(n - 1));
  const sum = (a) => a.reduce((x, y) => x + y, 0);
  // all multisets of m dice as vectors of counts, and the chance of each
  const multisets = (m, k = sides) => (k === 1 ? [[m]] :
    Array.from({ length: m + 1 }, (_, c) => multisets(m - c, k - 1).map((h) => [c, ...h])).flat());
  const chance = (h) => fact(sum(h)) / h.reduce((p, c) => p * fact(c), 1) / sides ** sum(h);
  const rolls = Array.from({ length: dice + 1 }, (_, m) => multisets(m).map((h) => [h, chance(h)]));
  const hands = multisets(dice);
  const at = new Map(hands.map((h, i) => [h.join(), i]));
  // everything that can be kept from a hand (sub-multisets)
  const subsets = (h) => h.reduce((all, c) =>
    all.flatMap((k) => Array.from({ length: c + 1 }, (_, x) => [...k, x])), [[]]);
  // for every hand and keep: the hands that arise after re-rolling the other dice, with their chances
  const keeps = hands.map((h) => subsets(h).map((keep) => [keep, rolls[dice - sum(keep)].map(
    ([r, p]) => [at.get(keep.map((c, f) => c + r[f]).join()), p])]));
  // the value of every hand under the strategy `pick`, backwards: first no re-roll, then one, then two
  const value = (pick) => {
    let V = hands.map(payout);
    for (let left = 1; left <= rerolls; left++) {
      V = hands.map((h, i) => pick(h, keeps[i].map(
        ([keep, next]) => [keep, next.reduce((e, [j, p]) => e + p * V[j], 0)])));
    }
    return rolls[dice].reduce((e, [h, p]) => e + p * V[at.get(h.join())], 0);
  };
  const best = (h, options) => Math.max(...options.map(([, e]) => e)); // the optimum: the best keep
  const rule = (h, options) => { // "keep the most frequent value": a tie goes to the higher value
    const top = h.lastIndexOf(Math.max(...h));
    return options.find(([keep]) => keep.every((c, f) => c === (f === top ? h[f] : 0)))[1];
  };
  return {
    optimal: value(best),
    rule: value(rule),
    none: rolls[dice].reduce((e, [h, p]) => e + p * payout(h), 0), // no re-rolling
  };
}

console.log(solve(payout)); // { optimal: 3.3295…, rule: 3.2233…, none: 1.1419… }

The tool in the repository of the site (tools/dice-poker/dice-poker.js, no dependencies) does the same and in addition prints all the tables, the criterion and the places where the optimum and the rule differ. The code above is run in the tests and its results are compared with the tool for all nine tables.

How it was verified that it calculates correctly

A measurement that has no check is an opinion with decimal places. That is why the tool was verified in several ways, none of which uses its insides:

  • Brute force. A separate version that does not know multisets: dice are a list of values, every keep is a set of dice, all possible outcomes are re-rolled. On small games (1 to 4 dice, 2 to 6 faces, 0 to 3 re-rolls) with payouts that are not symmetric it agrees in the optimum, in both versions of the tie, in no re-rolling and in the random strategy (to 10⁻⁹).
  • All strategies. In three small games every fixed strategy was evaluated (in the largest there were 1,728 of them). The best of them is the optimum from the program, and none beats it.
  • Sums. The chances of the rolls, of every keep, of the hands at the end and of the combinations add up to 1. The combinations of the 7,776 rolls were counted by hand (6, 150, 300, 240, 1,200, 1,800, 3,600, 480) and from the values of the dice.
  • A number from outside. The chance of five of a kind in three rolls (the first roll and two re-rolls), when the most frequent value is always kept, is according to the solutions of Yahtzee problems from a probability course at Cornell University 0.046029 (4.6%). For a payout of five of a kind only, the tool gives 0.0460286, and the same number comes out for the optimum and for both versions of the tie. For one re-roll it is compared with the closed formula from the hand-counted rolls (0.0126315).
  • Playing. A million hands for every table and strategy with a generator with a fixed seed, 36 averages; the largest difference from the exact value is 3.06 standard errors (table A, the rule), with two other seeds of the same value −1.0 and 0.8, so random fluctuation. The frequencies of the combinations at the end for table B also agree. The run takes about a minute and is not part of the ordinary tests.
  • Broken versions. 31 deliberately broken versions of the tool (the payout, the tie, the number of re-rolls, the number of hands and others), and each one fails at least one test.
  • The first independent calculation. Before the tool, a separate calculation was done for tables A to E, and it gave 326, 333, 289, 489 and 203% return of the optimum and 95.3, 96.8, 98.9, 98.5 and 95.4% for the rule. The tool gives the same numbers.

Results

The column "Optimum" is the return of the optimum. "Most frequent" and "No re-rolling" (the random one comes out the same) are the share of the optimum: the expected payout of the strategy divided by the expected payout of the optimum. "Gap" is the difference from the optimum in percentage points (pp). The last column is the criterion from the article on dice in games: the optimum at least 25 pp above chance and at least 5 pp above the rule.

TableOptimum"Most frequent"No re-rollingGap: ruleGap: chanceCriterion
A326.1%95.3%45.1%4.754.9no
B332.9%96.8%34.3%3.265.7no
C288.5%98.9%45.5%1.154.5no
D489.0%98.5%38.3%1.561.7no
E202.7%95.4%45.1%4.654.9no
F95.1%99.9%18.2%0.181.8no
G94.2%98.5%26.2%1.573.8no
H93.6%79.7%14.6%20.385.4yes
I330.1%97.6%31.8%2.468.2no

What can be seen:

  • With tables that pay from five of a kind down to a pair (A to E), the rule reaches 95.3 to 98.9% of the optimum. The gap is 1.1 to 4.7 pp, under the limit of 5. With no re-rolling it is 34.3 to 45.5%.
  • The casino tables F and G are even closer: the rule has 99.9 and 98.5% of the optimum, with no re-rolling only 18.2 and 26.2%.
  • Table H is the exception and shows why. A straight pays the same as four of a kind and a full house, and the rule never tries for a straight; indeed it breaks a ready-made straight. The rule has 79.7% of the optimum, the gap is 20.3 pp and the criterion is met.
  • The straight does not explain the whole gap even with table B. Without the straight (table I) the rule has 97.6% instead of 96.8%: the gap falls from 3.2 to 2.4 pp, so the straight explains only 0.8 pp of it.
  • The optimum and the rule do different things not in one hand but in many. With table B the optimum at the first re-roll keeps different dice than the rule in 38 of 252 hands (21.6% of the rolls), with table F in 6 (9.3%), with table H in 100 (39.4%). The most frequent change: a ready-made straight 1 2 3 4 5 or 2 3 4 5 6, which the optimum keeps whole while the rule keeps one die.
  • The optimum does not chase the highest combination. With table B the rule reaches five of a kind in 4.60% of cases, the optimum only in 4.21%; the optimum gets more full houses (22.6% against 9.9%) and straights (3.3% against 0.02%).

What follows

By the criterion from the article on dice in games, an idea that does not meet the gap of 5 pp is dropped. Of the nine tables only one met it, H. For the tables that pay a ladder from five of a kind to a pair, what stood in the article on dice in games holds: the simple rule is near the optimum and after an hour of play there is nothing to discover. The measurement makes that more precise, however:

  • The result is a property of the table, not of the dice. The depth in dice poker is one thing that the rule cannot do: keeping and drawing to a straight. A table that pays a straight highly gives the depth back.
  • A deep table is not a good table. H meets the criterion, but it pays four of a kind, a full house and a straight the same and nothing lower; a player who follows the rule loses a fifth of what they would get with the best play. Whether it is a more interesting game or only a table that people do not understand, this measurement cannot say.
  • Dice as flavour, not as a foundation. A dice game for one evening in a tavern is exactly what that poker is. It is not enough for the foundation of a game.
  • The old numbers. The first measurement (stated in the article on dice in games as 98% and 34%) came from a table that was not preserved. The new numbers for the generous tables (95 to 99% and 34 to 46%) are of the same order of magnitude, but they are not the same numbers and they do not replace the old ones retroactively.

What the documents of the game say about it

The reason why a casino with poker is not being built in Audamir was not the measurement. The documents say this:

  • The decision of 18 Oct 2026. The author of the game considers poker too contentious a way to spend Golden Dice, and replaced it with a system of boxes and merging for the Avatar[1]. What that system looks like is told in the article on boxes (forthcoming article no. 12). The number of the chapter about the casino stayed in the document as a placeholder, because other documents refer to it.
  • The rules of the portals. A document on the distribution of the game (a draft of 18 Oct 2026, not an approved plan) recommends, on the rules for portal content (CrazyGames: PEGI 12, Poki: no in-game purchases), not to put the casino with dice poker into the version for the portals, because it is gambling.
  • A note for the record. The working document said this about the measurement in one sentence: a simplified table, five dice, two re-rolls, exact dynamic programming; the simple strategy "keep the most frequent value" reaches 98% of the optimum (250% against 254% on a trial table), with no re-rolling only 34%, so the depth of dice poker is shallow and after an hour of play there is nothing to discover. The numbers in that sentence come from a table that was not preserved and cannot be verified from this article; they serve as a record, not as a claim.
  • A condition, if a casino were ever wanted. The payout table must give optimal play a negative expected value (return ≈ 92 – 96%), with a bet limit and a daily limit. Tables F, G and H are examples with a return of the optimum of 93.6 to 95.1%; the bet limit and the daily limit are not the subject of the measurement.

What was not measured

  • A duel of two players as in The Witcher (bets, an opponent who sees your decisions). The measurement was simpler: one player against a payout table.
  • Other dice games: Yahtzee with thirteen categories, Farkle, Liar's Dice and others. The tool can change the number of dice, faces and re-rolls, but only five dice, six faces and two re-rolls are given here.
  • People. What players actually do, how they err and how a table lures or deters them was not measured, and the calculation says nothing about it.
  • All possible tables. Nine hand-picked ones are not exhaustive, and the result depends on the table, as can be seen above.
  • The precision of the numbers. The calculation uses floating-point numbers, not fractions; the difference is of the order of 10⁻¹⁵ and does not show in the tables.
  • The criterion (25 and 5 pp) is a proposal from the article on dice in games, and here it was applied to a different measurement from the one it was written for.

What I take from it

  • The answer to the question "is it deep?" is a number, not an impression. The optimum, the rule and chance can be calculated before the first line of the game exists.
  • The answer depends on rules that were not measured. The same dice with a different table give a different depth.
  • A measurement must be repeatable. The first measurement of October cannot be repeated, because its table was not preserved. That is why the tables and the code are given here in full.

Sources and notes

  • The criterion and the first measurement: From the tavern to Knucklebones, the section on depth.
  • A number from outside (five of a kind in three rolls): solutions of the Yahtzee problems, Cornell University, probability course 2006 – 2007 (problem 8: 0.046029, "4.6%") and the problem statement. The page at problem 7 (the target does not change after the first roll) gives 0.045211, which does not fit its own numbers; the closed formula gives 0.045294. The number from problem 8, which fits, was used in the tool.
  • The decision about the casino and the rules of the portals: working documents of the game (ROADMAP, chapter 12; the document on distribution, a draft of 18 Oct 2026). They are not public; what follows from them is in the section above.
  • Tables and the tool: node tools/dice-poker/dice-poker.js (all the tables; --table B, --payouts 10,6,4,3,2,1,0.5, --rerolls 2, --diff) and node tools/dice-poker/verify.js (playing, a million hands, seed 20261105). Measured on 5 Nov 2026.
  • Not found or unverified: the original table of the first measurement; the rules and payouts of dice poker in The Witcher; real casino tables for dice poker (tables F to H are examples invented to have a return of 92 to 96%, not documented tables).

Notes

  1. Until version 0.80.1 of 1 November 2026 the Avatar was called Hero Dice (see From Hero Dice to Avatar (forthcoming article no. 39)). ↩︎