# Blending — Rules (current defaults, Round 60)

The rules as the simulation plays them today. Every number is a setting in `shared/ruleset.js`; the setting name is in
brackets. Words in **bold** are the terms used everywhere else.

---

## At a glance

| What | Number |
|---|---|
| Players | **4** (2–8) `players` |
| Tiles in the game | **100**: 60 singles, 30 doubles (all straight), 10 triples, a **6:3:1** ratio `supply.total`, `supply.ratio` |
| Game end | after **10 rounds**, every player having had the same number of turns `endgame: 'rounds'`, `endRounds` (Round 83; 'lastTile' = when the last tile is drawn, the old way) |
| Starting hand | **3** tiles `startingHand` |
| Hand limit | none during a turn; at the **end of your turn** you discard down to **9** (your choice) `handLimitRound` (`handLimit: 0`) |
| Draw | **3** tiles, face down, every turn `gain: 'blind'`, `blindDraw` |
| Free moves per turn | **1** `freeMoves` |
| Extra moves (main action) | **1** tile from hand each `moveCost` |
| Move distance | **1** square (**3** over your home land), diagonals included `moveDistance`, `nativeSpeed`, `moveDiagonal` |
| Tiles placed per turn | **1** anywhere, or **3** next to your hero `nearCount`, `nearReach` |
| Main actions per turn | **1** of 6 (see 3.3) |
| Guardians per player | **3** `flagsPerPlayer`, `guardiansOnly` |
| Guardian pile | born with **3**, bolstered up to **3** times (max **6**) `combat.guardianCards`, `combat.bolsterMax`, `combat.pileMax` |
| Fights | **The match**: the guardian's tiles are washed into a row; match your tiles to them face up, each with the kind you choose; flip left to right; rock, paper, scissors `combat.style: 'match'` (Round 86) · no hero fights for now `combat.pvp: false` |
| Tile kinds | each tile fights as its **top-left land**, no announcing `combat.naming: 'fixed'` · guardian piles are **face up** `guardians.open` |
| Winning a fight | kill a guardian: take **all its tiles + 3** from the stock `combat.victoryTiles`, then keep 3 on a new guardian · beat a hero: nothing `combat.pvpTiles` |
| A lost pair | you discard **1** tile of your choice · a won pair: a base tile is set aside, a bolster tile is yours at once · every tile beaten: it dies |
| Estates | a guardian guards the **3x3** around it; place one where **3** squares of its land lie in the box, no guardian within **2** squares `land: 'estates'`, `estate.*` (Round 85) |
| Fight range | **1** square (diagonals count for guardians) `fightRange`, `duel.range` |
| Matchup edge | **+1 / −1** `combat.edge` |
| Tile points | single **1** · double **2** · triple **3** `points` |
| Guarded bonus | **none** `points.guardedPerTile: 0` |
| Power cards | **off** for now `startPowers`, `guardians.killPower` |
| Bolster cost | **1** tile, onto the guardian's pile `combat.bolsterCost: 0` (extra tiles to the discard pile) |
| Game length | about **10 rounds** with the bots; **6** in a game between four AI players (Round 79) |

---

## 1. Components

- **Tiles** (cards): each shows 1, 2 or 3 lands (Plains, Forest, Mountain) as dots in its four corners.
  - **100 tiles**, split **6:3:1**:
    - **Single** (1 land): **60**, spread over the 3 lands.
    - **Double** (2 lands): **30**, all **straight** (half and half), spread over the 3 land pairs. Bends and diagonals
      are out for now `supply.bendPerDesign`, `supply.diagonalPerPair`.
    - **Triple** (3 lands): **10**, from the 6 designs whose doubled land sits **side by side** (F F / M P). The 3
      diagonal designs (doubled land on opposite corners, F M / M P) are out `supply.diagonalTriples: false`.
- **Pips** on each tile's back: 1 (single), 2 (double), 3 (triple). The holder shows them to everyone: a player's
  firepower, not the kind of attack. Pips are a tile's **power** in a fight.
- **The Dragon** is out: the game ends at the last tile (`endgame: 'dragon'` brings it back).
- **The start square**: a neutral gray tile in the middle `start.tile`.
  - Heroes can walk on it and tiles can touch it.
  - It isn't land: it can't be claimed or blended, and it scores nothing.
- **Heroes**: one per player, with a class:
  - **Warrior**: home land Mountain, attacks as sword.
  - **Amazon**: home land Forest, attacks as arrow.
  - **Mage**: home land Plains, attacks as magic.
  - Seats take them in that order, then repeat.
- **Guardians**: **3** shields per player in their color. They claim land and fight.
- **Tile holder** (Scrabble-style): hands stand with the pips facing the other players.

## 2. Setup

1. **Build the stock:** shuffle all the tiles together `supply.ramp: false` (the old Dragonwood-style ramp, which held
   some doubles back under the stock, is gone).
2. Deal **3** tiles to each player. There are no face-up tiles.
3. **Lay the start square** in the middle.
4. **Heroes walk out.** In turn, each player picks a direction (N, S, E or W; each direction once) and walks **3**
   squares out from the start square. Every square walked gets a random single, which scores for nobody.

## 3. Your turn

### 3.1 Draw (always first)
- **Draw 3 tiles, face down**, from the stock.
- You never go above **9** tiles in hand: a draw stops at 9.

### 3.2 Then, in any order you like
- **Your free move** (1 per turn) `freeMoves`:
  - **1 square**, in any of the 8 directions, diagonals included `moveDistance`, `moveDiagonal`.
  - You walk only over placed tiles (and the start square).
  - A step onto your **home land** costs a third of a step, so up to **3** squares over home land `nativeSpeed`.
- **Place your tile(s)**, either:
  - **1 tile anywhere** on the map, or
  - **up to 3 tiles within 1 square** of your hero (your square or the 8 around it, diagonals included `reachDiagonal`).
    The second and third only if the first was also next to your hero.
  - **How tiles go down:**
    - A **single** goes on blank table and must **share an edge** with a placed tile (Carcassonne rule). It can also go
      on top of a matching single as a primer.
    - A **double** goes where the 4 dots under it match its pattern (any rotation). A **triple** goes on any spot
      showing all 3 lands **where the doubled land sits side by side**, never where it's on opposite corners
      `tripleMatch: 'side'`. Nothing goes on top of a double or triple.
  - Placing is optional.
- **One main action** (3.3), or none.

Your turn ends when you say so (pass).

### 3.3 The main action: one of these six, once per turn
1. **Move more:** each extra move costs **1 tile** from your hand, to the discard pile. Take as many extra moves as you
   can pay.
2. **Fight** a rival guardian (PvM) or a rival hero (PvP) next to your hero (section 4).
3. **Bolster:** costs **1 tile** from your hand `combat.bolsterCost: 0`. Give it to any guardian within 1 square of your hero (yours or a
   rival's): show it to everyone, then put it **face down at the bottom** of that guardian's pile. It stays with that
   guardian until it dies or loses it to wear-down. A guardian can be bolstered
   **3 times** (3 → 6) `combat.bolsterMax`; one already holding **6** can't be bolstered.
4. **Play a power card** (off for now).
5. **Place a guardian** on **your hero's square**, which must be part of a **territory**: an unclaimed patch of connected
   squares of one land, at least **3** tiles `claimAtHero`.
   - You **build the guardian from 3 tiles of your own hand**, face down: its pile `guardians.from: 'hand'`,
     `combat.guardianCards: 3`. You choose which 3 (a triple there is a near-sure round in a fight; on your land it
     would score instead). **No 3 tiles in hand, no claim.** You know your guardians' piles; your rivals see only the
     pips on their backs until a tile is played. A pile always holds 1 to 6 tiles.
   - A territory that already has a guardian can't take another. The only way to share it is by connecting
     territories (below).
6. **Swap:** discard any number of tiles from your hand and **draw as many new tiles, face down**, to replace them
   `discardRefill`. Like the other five, it is your one main action for the turn.

### 3.4 Estates (the rules since Round 85, `land: 'estates'`)
- **A guardian guards the 3x3 around it: its estate.** There are no territories, no merging, no co-owners. Land has no
  owner; guardians do.
- **Placing a guardian** (your main action): your hero stands on a land square (not the start square); no guardian, of
  any colour, within 2 squares (estates may touch along an edge or a corner, never overlap) `estate.spacing`; at least
  **3 squares of that land** already in the 3x3, the one you stand on included, connected or not `estate.minLand`; its pile
  is 3 tiles of your hand, face down. **Its land is the land it stands on.**
- **The start walk is your home land** (3 squares). Nobody starts with a guardian: you place your first like any other
  (the middle of your walk already has 3 home squares in its 3x3). You keep your 3 starting tiles.
- **Growing is painting:** every square of its land inside the estate is worth 1. Another land painted inside fills a
  square and scores nothing. Painting outside any estate is speculation (a future estate) or a road.
- **Blends are borders:** at the end a double or triple counts **in full for every estate it touches** (a double between my
  estate and yours pays us both 2) `estate.blends: 'touching'` ('personal': only for the player who laid it). A blend
  touching two estates of the same player counts once for that player. A blend touching no estate scores nobody.
- **Kills:** the killer's new guardian stands on the dead one's square and inherits the estate.

### 3.4b Territories (`land: 'territories'`, Rounds 41-84)
- **Growing:** a single you paint next to your own territory, of its land, joins it `claimsGrow`.
- **Connecting, like Carcassonne** `dispute.mode: 'carcassonne'`:
  - When territories of the same land come to touch (a painted square joins them, or a new claim lands next to one),
    they become **one territory**.
  - **Every guardian on them stays**, and scoring decides who gets what. No fight.

## 4. Fights

### 4.0 The match (the rules since Round 86, `combat.style: 'match'`)
- **Who:** a rival guardian within 1 square of your hero (your main action). **No hero fights for now** `combat.pvp: false`.
  Guardians never attack: they only defend.
- **The row:** the guardian's tiles (its pile, face up as always) are **washed** and laid out in a row, left to right. Each
  will be **turned at random** when it flips, so its kind is any of its 4 squares' lands: a FFPP tile is an arrow or a
  magic, even odds.
- **Your match:** lay up to as many tiles of your hand as the row is long, **face up**, one against each, each turned the
  way you choose: **its top-left land is its kind**, deliberately. Mountain **Slice** (sword) beats Plains **Cast** (magic),
  Cast beats Forest **Shoot** (arrow), Shoot beats Slice. **Pips don't count.**
- **Flip** the pairs left to right, one at a time:
  - **You win:** the guardian's tile is beaten. One of its first 3 (its base) is **set aside**; a bolster tile (4th to 6th)
    is **yours at once**, into your hand.
  - **You lose:** **discard 1 tile of your choice.**
  - **Same kind:** nothing `combat.ties: 'nothing'`.
  - Your tile goes back to your hand once flipped.
- **Stop whenever you like** (between flips or after a pass). If the guardian survives, its set-aside tiles go back on it
  `combat.setAside: 'return'` ('discard': it stays weakened).
- **After a pass** you may match again against what's left (washed anew), as many passes as you like this turn.
- **Every tile beaten:** the guardian dies. Its set-aside tiles are yours, and you **may** spend 3 tiles of your hand to
  build your own guardian there (it inherits the estate), or leave the land unguarded.

### 4.1 Three Strikes (`combat.style: 'three'`, Rounds 84-85)
- **A fight is exactly 3 rounds.** You commit **3 tiles of your hand, face down, in order**. A guardian answers with the
  **next 3 tiles of its pile**, in pile order; a defending hero with their **3 strongest** tiles.
- **Every guardian's pile is face up** `guardians.open`: you see exactly what it will play before you choose.
- **Each tile fights as its top-left land** `combat.naming: 'fixed'`: Mountain **Slice** (sword), Forest **Shoot** (arrow),
  Plains **Cast** (magic). No announcing. Slice beats Cast, Shoot beats Slice, Cast beats Shoot.
- **Each pair:** pips + 1 for the kind that beats the other's (−1 for the beaten one) `combat.edge`. The higher wins the
  round; equal is nobody's. **Whoever wins more rounds wins the fight**; otherwise it's a draw and nothing happens.
- **Your 3 tiles are spent** (to the discard pile), win or lose. The guardian's tiles stay in its pile, which turns over by
  3 (the next fight meets the tiles after them).
- **Win against a guardian:** strip **3 tiles** off its pile, its bolsters first, never below **3** `combat.healTo`. A bare
  guardian of 3 dies only to a **3-0 sweep** `combat.killOn: 'sweep'` ('win': to any won fight). So a 6-pile takes one win
  to strip and a sweep to kill. A kill pays as before: its pile and **3 tiles** are yours, then you keep 3 on a new guardian.
- **Lose:** you're sent home. **Against a hero:** the loser goes home and both sides' 3 tiles are spent.
- You need **3 tiles** in hand to fight.

### 4.2 Legacy combat (`combat.style: 'legacy'`, Rounds 50-80)

Both kinds work the same way, round by round:
- **PvM** (against a guardian): the guardian plays from its pile, which cycles. Its pile only shrinks by wear-down
  (after the fight, below).
- **PvP** (against a hero): both players play from their hands, and **every tile played is discarded**.

**Who you can fight:** a rival **guardian within 1 square** of your hero (diagonals count), or a rival **hero within 1
square** (up, down, left, right). A hero standing on the start square can't be fought.

**Each round:**
1. **Aggressor:** put one tile from your hand **face down**. Everyone sees its pips (its power).
2. **Defender:** sees the aggressor's pips, then **answers** face down.
   - A **guardian** plays the next tile of its pile, in order. After the last tile it goes back to the first.
   - A **hero** chooses a tile from its hand.
3. **Reveal** both. Each side **announces its kind**: aggressor first, then defender.
   - A single's kind is its land. A double or triple may attack as any of its lands.
   - A guardian's owner announces for it; they're allowed to know its tiles.
   - Kinds: **Mountain = sword (Slice), Forest = arrow (Shoot), Plains = magic (Cast)**. A PPFF can Shoot or Cast, not Slice.
4. **Matchup:** sword beats magic, magic beats arrow, arrow beats sword.
   - The winner of the matchup gets **+1** power and the loser **−1**. The same kind is +0.
5. **Damage:** the side with more power wins the round and deals **1 damage**, whatever the margin
   `combat.damage: 'one'` (with 'difference', the whole power difference). Equal power: no damage.
   - **A hero** taking damage discards that many tiles from their hand.
   - **A guardian** counts the damage for this fight.
6. **Escape:** instead of attacking, the aggressor may play a tile **to escape**, announcing its kind as usual.
   - It **works unless the answer's kind beats yours**: a Mountain (sword) escape fails only against a Forest (arrow).
     A tie (sword against sword) still gets away, whatever the pips.
   - **A failed escape is an ordinary round:** being out-matched, your difference is 0 or less, so you take that damage.
   - `combat.escapeRule`: 'matchup' (this) or 'win' (only a tile that wins the round escapes).

**The fight ends when:**
- **The guardian dies:** its damage this fight reaches its **strength = the number of tiles in its pile**.
  - **A guardian is never "stolen": it is killed and rebuilt.** Its whole pile goes to **your hand**, and you draw
    **3 more** from the stock `combat.victoryTiles`: a pile of 4 pays 4 + 3 = **7 tiles**.
  - Then you **choose 3 tiles of your hand** (any of them) to stay on a new guardian of yours on that land, **face down:
    a secret until someone fights it** `guardians.stolenStrength: 3`. **The territory is yours.** The rest stay in your
    hand. Your turn then goes on. (No guardian left to place: you keep everything and the land is unguarded.)
  - Damage that **didn't** kill only wears the guardian down: the bolsters it loses go to the **discard pile** (not to
    you), from the bottom of its pile.
  - If its pile held **4–6** tiles, you'd also gain a **power tile**, but power cards are off for now `guardians.killPower`, `guardians.killPowerMin`.
  - The killed guardian goes back to its owner, who can place it again.
- **A hero runs out of tiles:** that hero is defeated.
  - They go back to **a territory their player guards** (their choice; the sim picks the biggest), or to the start
    square if they guard none `respawn`.
- **The aggressor escapes.**

**Killing a guardian pays:** the hero who kills it takes the guardian's whole pile, and draws **3 tiles** from the stock,
face down `combat.victoryTiles`. There is no limit on the hand during a turn (Round 81); at the end of the turn a hand
over 9 is cut to 9, and **you choose** what to discard `handLimitRound`. **Hero fights (PvP) pay nothing** `combat.pvpTiles: 0`: the winner only sends the loser home. An
escape or a stalemate wins nothing, and a guardian that wins gets nothing. A hero who loses a PvP fight has lost **all**
their tiles: that's what losing means (their hand ran out).

**One fight a turn:** a fight is your turn's main action, however it ends.

**Wear-down** `combat.wearDown`: a guardian that survives a fight keeps the damage by losing that many tiles from its
pile, its bolsters first (the last added), to the discard pile. But a fight never leaves it below **3** tiles
`combat.healTo`: at 1 or 2 left, it goes back to 3. A guardian of 3 or fewer loses nothing. So a 6-tile guardian hit 2
times keeps 4, hit 4 times keeps 3, and the next hero finds it weaker: one player softens it, another takes it. Each
bolster lost can be bolstered again. Its damage count starts again at 0 in its next fight.

**Example:** your sword single (1 pip) against a guardian's magic single (1 pip): 1 + 1 = **2** against 1 − 1 = **0**.
You win the round: **1 damage**. The same tile against an arrow: 0 against 2, so **you** discard **1**.

## 5. The stock and the discard pile
- Every spent tile (moved with, played or lost in a fight, discarded, a dead guardian's pile) goes to the **discard
  pile**.
- It comes back into play at the end of the stock (section 6).

## 6. End of the game
- **The game lasts 10 rounds** `endgame: 'rounds'`, `endRounds` (Round 83): everyone gets the same number of turns. Then
  score.
- **When the stock runs out**, shuffle the discard pile into a new stock and keep going `lastTileReshuffle: 'always'`.
- (The old way, `endgame: 'lastTile'`: when the last tile is drawn and the discard pile is empty, finish the round.)

## 7. Scoring (everything at the end)
- **Scoring happens only at the end of the game.** The scores the app shows during play are "if the game ended now":
  a debugging aid, not points banked.
- Placing, claiming and killing score **nothing** during the game.
- **Estates (the default):** each living guardian scores its land's squares in its 3x3 (at most 9) + the blends touching
  its 3x3 (2 a double, 3 a triple), each blend once per player. An estate with no living guardian scores nobody. The rest
  of this section is the territories rules (`land: 'territories'`).
- **Each territory is worth the sum of its tiles:**
  - **1** per single (each square, and each primer on top).
  - **2** per double and **3** per triple. **Each territory is scored on its own:** a double or triple lying on two
    territories counts **in full for each** `points.sharedPieces: 'each'`. Neighbors don't matter.
- **No guarded bonus** `points.guardedPerTile: 0` (it was +1 a tile; only guarded territories score anyway).
- **Who scores it:** the player with the **most living guardians** on it takes **all** of it `guardians.holder:
  'majority'`. A **tie for most splits the points** among the tied players, rounded down `guardians.tie: 'split'` (Round 82;
  'full' is the old way: each tied player scores all of it).
  - Example: A has 2 guardians on a 9-point territory, B, C and D one each: **A scores 9**, the others nothing from it.
    If A and B each had 1: **4 each**.
- **Merging:** a tile of a territory's land laid between two territories of that land joins them into one (Carcassonne);
  the guardians on both now count together. A merge you'd lose can be headed off by laying a **different land** on the
  square between them (one tile anywhere is enough). A merging tile can be made to cost extra tiles `dispute.mergeTax`
  (default 0, a Round 82 option to test: the player picks the tiles that pay).
- A territory with **no living guardian** scores for **nobody**.
- Tiles outside territories score nothing.
- Most points wins.

---

## Choices made for you (to review)
- **Tiles given up:** which tiles are discarded to move or as damage, and which a defending hero plays, are a player's
  choice. The sim gives up tiles that fit nowhere first, then the weakest. A defender plays the
  cheapest tile that matches the attacker's pips, else the cheapest.
- **Announcing kinds:** the aggressor announces first, then the defender.
- **Respawn:** the sim sends a defeated hero to its biggest guarded territory, onto that territory's guardian.
- **Bolstering a rival's guardian** is allowed; the bots only bolster their own.

## Seen in the simulation (300 games, the Round 75 defaults)
- **About 10 rounds** (9–12; 15 at most). Lead changes 1.3 a game (0–3), comebacks in 29% of games.
- **Fights** 4.9 a game, **steals** 2.6, bolsters 5.9; the biggest guardian reaches 5–6 tiles.
- **Fair seats and classes:** 24–26% wins each (classes rotated to check).
- **Too much (to fix):** hands sit at the limit (every player reaches 9; 22 draws a game are lost to full hands); 75% of
  games end with a player on **0** (no guarded territory left); the winner takes over half of all points in half the
  games; one territory can change hands 6 times in a row (a steal carousel).

## Seen earlier (40 games, the Round 68 defaults)
- **About 11 rounds** (14 at most), about **27 minutes** at the assumed 2.5 a round; the discard pile comes back about
  twice. About 23 tiles are still in hands at the end; 73% of the 100 reach the map.
- **Territories:** about 3.6 a game, the largest about 5 tiles; 56 squares of map.
- **Fights:** about 4.8 a game, 2.1 steals, 5.8 bolsters; **1.2 lead changes**.
- With `lastTileReshuffle: 'never'` instead: about 8 rounds, 54% of tiles used, 3.2 fights, 1.4 steals, 0.8 lead
  changes.

## Play it, or simulate your own rules
- **Simulate** (the builder's ⚙ Simulate button): every setting in this file, editable. Run 1–50 bot games in the
  background, read the fun numbers, watch any game, or **Play with these rules**. Your settings stay on your device.
  A full game takes about 5 seconds. **Save** a set of settings under a name, and **Load** or **Delete** saved ones.
- Open `play.html` on the site, or `builder/play.html` locally: you against 3 bots, Standard (100) or Long (200).
- **From the command line** (a person or an AI such as Claude): `node sims/cli/blending.js new`, then `show`, `play N
  [--why "…"]`, `swap ids`, `log`. Each choice is numbered; strikes come with "name the best kind after the reveal" (the
  written rule) or a kind named before it. Finished games land in the builder's Watch list. `sims/cli/session.js` is the
  same game as plain functions, ready to become an MCP server.
- **Zoom:** scroll to zoom, right-drag to pan, or the − / + / Fit buttons on the map (phone: pinch and drag). Fit shows
  the whole map and follows it as it grows.
- **In a fight** you pick a tile, then **Slice**, **Shoot** or **Cast**; only the kinds on that tile are lit. **Escape** is
  a toggle: the next Slice / Shoot / Cast is your escape. The log shows what each side announced and the damage.
- **Paying for a move:** after your free move, Move costs a tile. Click the tile in your hand to pay with (it's outlined),
  then the green square.
- **The engine still decides** which tiles you discard as damage or for a bolster, your hero's answer when attacked, and the
  bots' kinds (the best answer to yours). Playing against Claude is reserved as a later option.
