← labopen markovs chains →

Markovs Chains

A game of finite probabilities, on a standard poker deck. Two to four players, one counter, one d6, 54 cards. This page is the digital prototype of a physical game: play it at one phone (passed round, a curtain hiding the hand between turns) or against bots, and print the deck.

The deck

Every card has a job on the table (client/markovs/deck.ts):

cardsjob
3–10, four suitsthirty-two junctions in play, every one different. The rank is the shape, the suit its temperament. A junction's six die faces each name an exit (north, east, south, west) or a stay; the faces turn with the card.
Twosthe commissions: shuffled face down, one dealt to each player — its suit is their King, their secret; the rest back in the box unseen
Kingsthe four destinations, one a suit, laid at the middle of each edge
Aceswild junctions: a cross (1 north, 2–3 east, 4 south, 5–6 west), laid on any empty square and turned like any card. The Ace of spades is START, in the centre
Jacksreroute: instead of rolling, walk the counter one square your way
Queensswap: exchange two junctions on the table; the counter stays on its square
Jokerschaos: instead of rolling, ignore the faces — the counter takes one of its card's outward exits at random (north, east, south, west; two exits 1–3/4–6, three 1–2/3–4/5–6, four 1–4 and reroll 5–6)

The temperaments: ♥ the River leans one way (four faces on its main exit); ♦ the mirror is even-handed; ♣ the thicket grows one more branch than the shape has; ♠ the well holds a while (three or four faces stay). The shapes, by rank, with each suit's faces as up / right / down / left / stay:

rankshape♥ River♦ mirror♣ thicket♠ well
2THROUGH↑4 ↓2↑3 ↓3↑3 →1 ↓2↑2 ↓1 ·3
3TURN↑4 →2↑3 →3↑3 →2 ←1↑2 →1 ·3
4TEE↑4 →1 ←1↑2 →2 ←2↑2 →2 ↓1 ←1↑1 →1 ←1 ·3
5CROSS↑3 →1 ↓1 ←1↑2 →1 ↓2 ←1↑2 →1 ↓1 ←1 ·1↑1 →1 ↓1 ←1 ·2
6EDDY↑5 ·1↑3 ·3↑3 →1 ·2↑2 ·4
7SWITCH↑4 →1 ·1↑2 →2 ·2↑2 →2 ←1 ·1↑1 →1 ·4
8WEIR↑4 ↓1 ·1↑2 ↓2 ·2↑2 →1 ↓2 ·1↑1 ↓1 ·4
9FORK↑3 →1 ←1 ·1↑2 →1 ←1 ·2↑1 →3 ←1 ·1↑1 →2 ←1 ·2
10BACKTURN↑2 →4↑3 ←2 ·1↑2 →1 ←3↑2 ←1 ·3

The dress (static/markovs/, served by the cell as the page's assets): the four suits are painted places — the River, the Mirror, the Thicket, the Well — and each junction wears its suit's scene above the arrows, the frame, a sigil in the margin, a divider, and the suit's plate with the shape's name. The court is painted whole: the Jacks are the Wayfinders, the Queens the Exchange, the Kings the four places. Jokers and the plain fallback (no assets) stay drawn.

No two are the same card turned (the test checks all thirty-six; the Twos, the simplest, are the ones dealt as commissions). Nobody memorises them: the faces are printed, and read off the card under the counter at the moment of the roll. What the thirty-six buy is depth in planning — what might still come out of the pile — and a table whose character you can read from across the room: a line of hearts is a chute, a corner of spades a bog.

The rules

The full text is client/markovs/text.ts (the print sheet, the insert in the box and the page all read it). In short:

  1. Deal. The Ace of spades in the centre of a 5 × 5 table of squares (about 9 cm each, so a card fits either way up), the counter on it. The four Twos shuffled face down, one each: its suit is your King, your secret; the rest back in the box. The four Kings shuffled and dealt one each face up: the King you will place, not necessarily the one you want (with fewer than four players the undealt King stands one square clockwise of its edge's middle, a destination nobody holds). Three cards each.
  2. The court. In turns, place your dealt King on an empty square of the outer ring: never the middle of an edge, not beside the counter, not beside another King — so every King is at least three steps from the centre. Nothing else happens until every King is placed; the last to place one takes the first turn.
  3. Race. A turn is one landscape action and one movement, in either order. The landscape action: lay one card, turned any way, on an empty square touching a laid card or anywhere on the outer ring (an Ace on any empty square) or on top of a junction (not a King); or play a Queen to swap two junctions; or hold. The movement: roll; only the card under the counter decides the move: that face's arrow, one square; off the edge, in on the far side; a stay face stays. Instead of rolling you may play a Jack or a Joker. Draw back to three; an empty pile means play on with what you hold.
  4. Winning. When the counter reaches a King someone holds, that player shows their Two and wins — whoever moved the counter. A King nobody holds sends the counter back to the centre. Thirty movement turns without an arrival is a draw.

Don't say which King is yours. Every card you lay says a little — and so does where you put a King.

(This is v4.2, the playtest head. The build-then-race game of v3.2 — Kings fixed at the edge middles, the table built full before any roll — is what the simulation below plays; devtools/markovs-sim.mjs keeps it for the sweeps.)

Why these rules (the simulation)

devtools/markovs-sim.mjs plays rule sets against each other with the same bots (random, and one action ahead judged by a short forecast of its own King's chances) and scores draws, length, first-player edge and the gap between the bot and a random player. What it found, on the way here:

The page

client/markovs/table.ts holds the deal, every legal action and the bot; page.ts draws the table — square parking spaces, so a card fits either way up — and the poker cards as SVG; the card under the counter is read out in plain faces ("1–4 north · 5 east · 6 stays"), and so is a card in the hand as you turn it. ?players=2..4&bots=0111&seed=1941&wrap=1&rim=1. "Peek at my King" shows your suit; "use your own die" takes a real roll. ?mode=physical is the earlier grid prototype; ?mode=challenge|duel|workshop the four-state chain. Tests: node cells/lab/devtools/markovs.test.mjs.

The print set ("print cards + rules", A4, nine pages, nothing split or clipped): a page of rules; the tuck box as a die-line (65 × 90 × 19 mm inside, for card stock: cut the solid line, fold the dashed, glue the flap); the rules as a folded insert for the box (six panels of 60 × 85 mm on one 180 × 170 mm sheet — fold in half so the lower row, printed upside down, turns up behind, then in three); and six sheets of nine cards at 63 × 88 mm. devtools/markovs-print.mjs <dir> renders it to PDF and PNGs and measures every page.

After the review

A review of the previous version asked for the written and implemented rules to be reconciled before any more mechanics, and for the print export to be repaired. Done, as above: the Twos as commissions (one suit each, guaranteed distinct, the same deal at the table and on the page), Aces that turn like any card (their cross is not symmetric), a Joker procedure for a die, the counter staying put through a Queen's swap, the centre square as the reset, "thirty movement turns" rather than rolls, the empty pile, and the two sentences that matter most — only the card under the counter decides a move; the King's owner wins whoever moved the counter — in the rules and the insert. The bot's forecast now counts a decoy King as a return to the start (in expectation, knowing only its own suit) and measures distance round the wrap. The review's hypothesis about covering is answered above, in simulation; it still wants a table of people.

The judge

The same rules are a definition in the playtest cell (static/markovs-rules.md, game markovs-chains), played by Jev through the junction_chain engine mechanic (cells/playtest/engine/mechanics/junction-chain.ts): the table, the counter, the build and the race, the court cards and the decoy rule. A race turn is two steps there (lay, swap or hold; then roll, Jack or Joker) so that the judge sees the consequences of a lay as a forecast of each King's chances and never a simulated roll (harness h11). Hands refill at the start of a turn, so the deck never moves during an action. Suite: seeds 1–6 and 101–106 at three and four players.

The judge's score turned out too coarse for the changes a rules edit makes: sixteen rated dimensions averaged into a 0.55–0.66 band, mechanical terms saturated at 1, twelve paired games with a standard error near 0.01 and a 0.02 gate — so a court moved off the cardinals, which the sim and the pace numbers both liked, was reverted twice for +0.004. Since score v4.3 the mechanic measures each game itself (off-turn win, forecast lead changes, whether the halfway favourite won, contenders with a live route at the end, lays, covers, court plays, draw, rounds), the rules declare targets bands on those measures, their suite means score a targets term (a quarter of the suite score), every climb round reports each measure's paired delta with its standard error, and the free screen plays hundreds of bot games through the same engine and reports the same measures with standard errors — the fine instrument, with the judge suite kept for health and critique.

That instrument kept the first change the coarse one had rejected three times. v4.2 (round 5): the court keeps off the four edge middles, so no King is a two-step chute from the centre. Paired on sixty bot games: movement turns 8.7 → 13.0 (±1.1), lead changes 2.6 → 3.8 (±0.5), the halfway favourite winning 73% → 48% (±8), draws 2% → 7% (±3); on the twelve judged games, one over in two rounds instead of eight. Train +0.026, test +0.021.

Round 6 tested the reviewer's hypothesis that unrestricted covering makes preparation disposable: the card under the counter may never be covered or swapped. Measured on sixty bot games against the v4.2 head: covers of the counter's card 45% → 0 by construction; race lays the counter later reaches 35% → 39% (±2); games decided by someone else's roll 37% → 62% (±9); Jack wins, draws and length unchanged. The judged games fell 0.04 and the judge's players noticed fewer threats (0.85 → 0.30 of the engine's). So preparation pays a little more, but the roller loses the one answer they had, and most games end on someone else's turn. Reverted; the measures are the finding.

Round 7 tried the concealed court: dealt Kings placed face down (the placer knows which), one free reveal a turn before anything else, the counter turning up any King it enters. Measured against the v4.2 head: the judge's players revealed 2.8 Kings a game and 55% of those were their own (signal, not bluff); hindering an opponent appeared as a stated intention for the first time (0 → 10% of probed turns); false alarms about threats fell from 34% to 3%; but threats seen fell too (76% → 53%), the urgency error rose, and on sixty bot games draws doubled (5% → 13%) and lead changes fell (4.1 → 2.9) because nobody can steer at a King they cannot name. One judged game ran to the thirty-move draw. Judge score −0.011, targets 1.00 → 0.94. Reverted.

The round's measure health, which every round now reports: eleven measures moved beyond two standard errors; four of six target bands were met on both sides, so the targets term was blind there; and the greedy stand-in never takes a reveal (0.18 a game, against Jev's 2.8), so the bot split measured the rule as if it did not exist. That last is the finding about the instrument: a rule that adds an action needs a stand-in that values it before the bot split can speak to it.

Round 8 ran the concealed court again with a stand-in that reveals: the bot split now saw it (four reveals a game, draws 5% → 13%, two more movement turns, Jack wins down a third), the judged players again named hindering as an intention, and the climb stalled at three reverts. The meta-evaluation read the instrument rather than the game: one judged run came back without a judgement and was scored as a bad game (now counted as incomplete, harness h22); five of six target bands were met by every version, so the gate was blind; reveals were constant on the bot split. The targets gained two bands on what the critique and the measures still call wrong — preparation that pays (prepPayoff ≥ 0.4, head 0.33) and wins not cashed in with a Jack (jackWin ≤ 0.2, head 0.33). A cheap screen then chose between two Jack rules before paying for a round: a Jack along the card's own exits changed nothing (Jack wins 37% either way); a Jack that may not step onto a King took them to zero.

The questionnaire (h18–h19): on every second judged decision the acting player is asked, after choosing and before the move resolves, what they were trying to do, whether anyone is close to winning (checked against the engine's own forecast), how much better the move was than the next best, and how likely someone wins before their next turn; and about their last probed turn, whether the table went their way, whether the counter's movement was expected or surprising or confusing, how much of it was the cards rather than the die, and whether they changed their plan. The answers are q_* measures beside the engine's, so targets can band them and rounds report their deltas. The first version taught which questions discriminate: threat calls against the engine (v4.2 cut false alarms 69% → 38% and the urgency error 0.37 → 0.23) and the revised plan do; "several alternatives", "as I expected" and "earlier moves mattered" sat at a ceiling, so v2 asks those as scores with a concrete reference.

The transition sweep

devtools/markovs-sweep.mjs rewrites the suits' die faces along four axes and plays the poker game under the sim's bots (120 games a line, four greedy; a skill line with one random player); BUILD=0|10 plays the court game with no build or a short one, KINGS=corners|rim moves the Kings. The scorecard adds the forecast's lead changes per game, whether the halfway leader won, and off-turn wins: games decided by someone else's roll.

So: Kings on the rim, off the cardinals, as the next rules change (interaction and draws); a stay reduction of one face per card, spades keeping their character, as the one after; and diagonals, if at all, only on the Aces.

Open

The junctions as seals

The junction cards are now engraved seals, from the lab's Seals experiment: each suit a family (hearts and spades filigree, clubs and diamonds lattice), each card its own seal from the deck's seed and its number, the number as pips and as the star's points. A direction's faces are one label ("4–6") and its line's weight says its chance; the stays are a closed loop off the hub. On the table a turned card is redrawn with its faces turned, so its labels stay upright. The court cards keep their paintings.