Merge relaxed two-tile limits and hand size option

This commit is contained in:
Mike Isom 2026-11-04 07:03:19 -07:00
commit d8dd85060a
34 changed files with 526 additions and 92 deletions

View file

@ -143,10 +143,34 @@
},
{
"name": "twoTiles",
"label": "Two tiles per turn (hands of 8)",
"label": "Two tiles per turn",
"type": "checkbox",
"default": false
},
{
"name": "handSize",
"label": "Tiles in hand",
"type": "select",
"default": "6",
"items": [
{
"name": "6",
"label": "6 (standard)"
},
{
"name": "8",
"label": "8"
},
{
"name": "10",
"label": "10"
},
{
"name": "12",
"label": "12"
}
]
},
{
"name": "limitedLog",
"label": "Limited game log (only last round)",

View file

@ -14,7 +14,7 @@ There are 7 hotel chains, in three price tiers:
- **Medium:** Worldwide, American, Festival
- **Major:** Imperial, Continental
Each chain has 25 shares. Everyone starts with $6,000 and a hand of 6 tiles. Before the game, each player places one tile from the pool; the lowest tile (by number, then letter) goes first, and play continues in seat order.
Each chain has 25 shares. Everyone starts with $6,000 and a hand of 6 tiles (or 8, 10 or 12 with the Tiles in hand option). Before the game, each player places one tile from the pool; the lowest tile (by number, then letter) goes first, and play continues in seat order.
A chain of 11 or more tiles is **safe**: it can never be taken over.
@ -22,7 +22,7 @@ A chain of 11 or more tiles is **safe**: it can never be taken over.
1. **Place one tile** from your hand.
2. **Buy up to 3 shares** by default, in any active chains (optional; see Shares per turn below).
3. **Draw** back up to 6 tiles.
3. **Draw** back up to 6 tiles (or the game’s hand size).
### What a tile does
@ -39,17 +39,19 @@ A chain of 11 or more tiles is **safe**: it can never be taken over.
### Two tiles per turn
If the game uses **Two tiles per turn**, each player holds 8 tiles instead of 6 and places two tiles every turn.
If the game uses **Two tiles per turn**, each player places two tiles every turn. The number of tiles in hand is a separate option, so you can combine two tiles per turn with any hand size. (Two-tile games started before that option existed use hands of 8.)
At the start of your turn, swap out any dead tiles. Then place your first tile and settle anything it causes, including a full merger with everyone's sell, trade or keep decisions, before placing your second. After both tiles, buy shares up to the game’s per-turn limit (3 by default) at the prices on the board, then draw back up to 8.
At the start of your turn, swap out any dead tiles. Then place your first tile and settle anything it causes, including a full merger with everyone's sell, trade or keep decisions, before placing your second. After both tiles, buy shares up to the game’s per-turn limit (3 by default) at the prices on the board, then draw back up to your hand size.
You may found only one chain per turn, and you can't found a chain and cause a merger in the same turn, in either order. You can cause two mergers, one with each tile. Example: your first tile merges Luxor into Tower, so your second tile can merge again or grow a chain, but it can't found a new one.
You may found only one chain per turn, and your second tile can't cause a merger involving the chain your first tile founded. Otherwise each tile follows the usual rules: you can merge and then found a chain, found a chain and then merge two other chains, or cause two mergers, one with each tile. Example: your first tile founds Worldwide, so your second tile can merge Luxor into Tower or grow Worldwide, but it can't found another chain or cause a merger involving Worldwide.
You must play a second tile if any tile in your hand is legal after the first. If none is, go straight to buying. A tile that becomes dead during your turn, for example because your first tile made a chain safe, can't be your second tile; it's swapped out at the start of your next turn.
You can announce the end of the game before your first tile, between your two tiles, or while buying, as long as an end condition holds at that moment.
In a two-player game, the bank's tiles are placed right after the merger that drew them, so between your two tiles if your first tile caused it. Mergers caused by the bank's tiles don't count toward your two mergers or the founding rule. If a player leaves, the game places their first two legal tiles for them.
Two-tile games started before this rule was relaxed keep the earlier limit: a turn can't both found a chain and cause a merger, in either order (mergers caused by the bank's tiles don't count).
In a two-player game, the bank's tiles are placed right after the merger that drew them, so between your two tiles if your first tile caused it. If a player leaves, the game places their first two legal tiles for them.
## Mergers
@ -145,7 +147,8 @@ Because replaying the game would show the full history, replay is only available
## Game options
- **Limited game log:** the log shows only what happened since your last turn, until the game ends (see above).
- **Two tiles per turn:** hands of 8 tiles and two tiles placed every turn (see above).
- **Two tiles per turn:** two tiles placed every turn (see above).
- **Tiles in hand:** 6 (standard), 8, 10 or 12 tiles in each hand, with or without two tiles per turn.
- **Shares per turn:** buy up to 3 (standard), 4 or 5 shares in total per turn, independently of stock swaps.
- **Stock swap:** optional 1:1 exchanges with the bank before buying; Off / 3 / 5 / 7 / Unlimited shares per turn (see above).
- **Public holdings:** everyone's cash and shares are visible.

View file

@ -19,4 +19,10 @@ export * from "./src/replay.js";
export * from "./src/position.js";
export * from "./src/simple.js";
export { logWindowStart } from "./src/limited-log.js";
export { blockedThisTurn, secondPlacementDue, turnPlacements } from "./src/two-tiles.js";
export {
blockedThisTurn,
secondPlacementDue,
turnPlacements,
twoTileLimit,
type TwoTileLimit,
} from "./src/two-tiles.js";

View file

@ -0,0 +1,106 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { legalMoves } from "./legal.js";
import { applyMove } from "./moves.js";
import { positionAt } from "./position.js";
import { initGame } from "./setup.js";
import { chainAt, checkInvariants, row, scenario, t } from "./test/helpers.js";
import type { GameState, Move } from "./types.js";
import * as wrapper from "../wrapper.js";
const place = (tile: string): Move => ({ type: "place", tile });
const buy: Move = { type: "buy", shares: {} };
function play(state: GameState, seat: number, move: Move): GameState {
applyMove(state, move, seat);
checkInvariants(state);
return state;
}
test("§15 handSize: every seat is dealt the chosen hand in every mode and player count", () => {
for (const handSize of ["6", "8", "10", "12"]) {
for (const twoTiles of [false, true]) {
for (let players = 2; players <= 6; players++) {
const modes = players === 2 ? ["bank", "fourHands"] : ["bank"];
for (const twoPlayerMode of modes) {
const state = initGame(
players,
{ ...(twoTiles && { twoTiles }), ...(players === 4 && { teamPlay: true }), twoPlayerMode, handSize },
`deal-${handSize}-${players}-${twoPlayerMode}-${twoTiles}`
);
checkInvariants(state);
const size = Number(handSize);
assert.ok(state.seats.every((seat) => seat.hand.length === size));
assert.ok(positionAt(state, state.log.length).seats.every((seat) => seat.tiles === size));
const view = wrapper.stripSecret(state, 0);
assert.ok(
view.seats.every((seat) => seat.hand.length === size),
"masked hands keep their size"
);
}
}
}
}
// Six hands of 12 plus six turn-order tiles still leave 30 of the 108 tiles to draw.
assert.equal(initGame(6, { handSize: "12" }, "deal-max").pool.length, 30);
});
test("§15 handSize: the hand refills to the chosen size after a turn", () => {
const hand = ["5E", "9G", "11G", "3I", "6I", "9I", "1G", "1I", "12A", "12C"];
const state = scenario({ hands: [hand, ["12E"]], poolTop: ["12G", "12I"], options: { handSize: "10" } });
play(state, 0, place("5E"));
assert.equal(state.seats[0]!.hand.length, 10);
assert.ok(state.seats[0]!.hand.includes(t("12G")));
assert.ok(!state.seats[0]!.hand.includes(t("12I")));
});
test("§15 handSize: dead tiles are replaced up to the chosen size", () => {
const state = scenario({
board: { ...chainAt("tower", row("A", 1, 11)), ...chainAt("continental", row("C", 1, 11)) },
hands: [["1B", "10G", "12E", "12G", "12I", "10I", "8I", "6I", "4I", "2I", "8G", "6G"], ["5E"]],
options: { handSize: "12" },
});
play(state, 0, place("10G"));
play(state, 0, buy);
assert.ok(state.removed.includes(t("1B")));
assert.equal(state.seats[0]!.hand.length, 12);
assert.deepEqual(state.log.filter((entry) => entry.type === "drew").at(-1), { type: "drew", seat: 0, count: 2 });
});
test("§15 handSize with twoTiles: both tiles are placed, then the hand refills to the chosen size", () => {
const state = scenario({
board: chainAt("tower", ["1A", "2A"]),
hands: [["5E", "9I", "12A", "12C", "12E", "12G"], ["10C"], ["10E"]],
poolTop: ["7G", "7I"],
options: { twoTiles: true, handSize: "6" },
});
assert.equal(state.options.handSize, 6);
play(state, 0, place("5E"));
play(state, 0, place("9I"));
play(state, 0, buy);
assert.equal(state.seats[0]!.hand.length, 6);
assert.deepEqual(state.seats[0]!.hand.slice(-2), [t("7G"), t("7I")]);
});
/** Plays a random game to the end, checking invariants after every move, and replays it. */
function playToEnd(players: number, options: Record<string, unknown>, seed: string): GameState {
const state = wrapper.init(players, [], options, seed);
for (let step = 0; !state.ended; step++) {
assert.ok(step < 5000, `${seed} did not finish`);
const moves = legalMoves(state);
const others = moves.filter((move) => move.type !== "announce");
const choices = others.length > 0 && step % 23 !== 0 ? others : moves;
wrapper.move(state, choices[(step * 7919) % choices.length]!, wrapper.currentPlayer(state)!);
checkInvariants(state);
}
assert.deepEqual(wrapper.replay(structuredClone(state)), state, `§14.7 ${seed} replays exactly`);
return state;
}
test("§14.8 handSize 12: full games finish and replay with 6 players, two-player bank mode and four hands", () => {
playToEnd(6, { handSize: "12" }, "hand-12-six");
playToEnd(6, { handSize: "12", twoTiles: true }, "hand-12-six-two-tiles");
playToEnd(2, { handSize: "12", twoPlayerMode: "bank" }, "hand-12-bank");
playToEnd(2, { handSize: "12", twoPlayerMode: "fourHands", twoTiles: true }, "hand-12-four-hands");
playToEnd(4, { handSize: "10", teamPlay: true, publicHoldings: true }, "hand-10-teams");
});

View file

@ -17,9 +17,15 @@ import { sharePrice } from "./prices.js";
import { canAnnounce, endGame } from "./scoring.js";
import { parseTile, tileLabel, type Tile } from "./tiles.js";
import { afterPlacement, endTurn, enterBuyPhase } from "./turn.js";
import { blockedThisTurn } from "./two-tiles.js";
import { twoTileLimit, type TwoTileLimit } from "./two-tiles.js";
import type { GameState, Move, Shares } from "./types.js";
const TWO_TILE_LIMIT_ERRORS: Record<TwoTileLimit, string> = {
oneFounding: "A turn cannot found two chains",
mergeFounded: "A turn cannot merge the chain it founded",
foundOrMerge: "A turn cannot both found a chain and cause a merger",
};
export function currentSeat(state: GameState): number | undefined {
if (state.ended) {
return undefined;
@ -88,8 +94,9 @@ export function sanitizeMove(state: GameState, raw: unknown, seat: number): Move
if (tileLegality(state.board, tile) !== "playable") {
throw new Error(`Tile ${tileLabel(tile)} cannot be played now`);
}
if (blockedThisTurn(state, tile)) {
throw new Error("A turn cannot found two chains, or both found a chain and cause a merger");
const limit = twoTileLimit(state, tile);
if (limit !== undefined) {
throw new Error(TWO_TILE_LIMIT_ERRORS[limit]);
}
return { type: "place", tile: tileLabel(tile) };
}

View file

@ -2,7 +2,7 @@ import assert from "node:assert/strict";
import { test } from "node:test";
import { endConditionHolds } from "./board.js";
import { applyMove } from "./moves.js";
import { DEFAULT_OPTIONS, normalizeOptions } from "./options.js";
import { DEFAULT_OPTIONS, handSize, normalizeOptions } from "./options.js";
import { sharePrice } from "./prices.js";
import { initGame } from "./setup.js";
import { chainAt, checkInvariants, row, scenario } from "./test/helpers.js";
@ -93,6 +93,45 @@ test("§3.5 options are never rejected: unknown values are ignored and logged",
assert.doesNotThrow(() => wrapper.init(2, [], { teamPlay: true, twoPlayerMode: "fourHands", endSize: 7 }, "x"));
});
test("§15 handSize: missing keeps the legacy hand of 6, or 8 with twoTiles, and leaves the init log unchanged", () => {
assert.equal("handSize" in normalizeOptions(3, {}).options, false);
assert.equal(handSize(normalizeOptions(3, {}).options), 6);
assert.equal("handSize" in normalizeOptions(3, { twoTiles: true }).options, false);
assert.equal(handSize(normalizeOptions(3, { twoTiles: true }).options), 8);
const init = initGame(3, {}, "no-hand-size").log[0] as Extract<LogEntry, { type: "init" }>;
assert.deepEqual(init.options, DEFAULT_OPTIONS);
});
test("§15 handSize: every size is read as BGS sends it, alone or with twoTiles; the legacy size is omitted", () => {
for (const twoTiles of [false, true]) {
const legacy = twoTiles ? 8 : 6;
for (const size of [6, 8, 10, 12]) {
for (const sent of [String(size), size]) {
const { options, ignored } = normalizeOptions(3, { ...(twoTiles && { twoTiles }), handSize: sent });
assert.deepEqual(ignored, []);
assert.equal(handSize(options), size);
assert.equal(options.handSize, size === legacy ? undefined : size);
assert.equal("handSize" in options, size !== legacy, `handSize ${sent} with twoTiles ${twoTiles}`);
}
}
}
assert.deepEqual(normalizeOptions(3, { handSize: "10" }).options, { ...DEFAULT_OPTIONS, handSize: 10 });
});
test("§15 handSize: unknown values are ignored and logged, keeping the legacy size", () => {
for (const value of ["7", 7, "", "eight", "08", " 8", 6.5, 14, true, null, ["8"]]) {
for (const twoTiles of [false, true]) {
const state = initGame(3, { ...(twoTiles && { twoTiles }), handSize: value }, "bad-hand-size");
assert.equal("handSize" in state.options, false);
assert.deepEqual(
ignoredLog(state).map((e) => [e.option, e.value, e.reason]),
[["handSize", value, "unknown value"]]
);
assert.ok(state.seats.every((seat) => seat.hand.length === (twoTiles ? 8 : 6)));
}
}
});
test("§15 endSize 31: a 31-tile chain meets the end condition; safe size and prices are unchanged", () => {
const tiles = [...row("A", 1, 12), ...row("B", 1, 12), ...row("C", 1, 7)];
const board = scenario({ board: chainAt("tower", tiles), hands: [["9I"]] }).board;

View file

@ -13,6 +13,13 @@ export interface GameOptions {
sharesPerTurn?: 4 | 5;
/** Omitted when off, like stockSwap. */
twoTiles?: true;
/** Omitted at the legacy size (6, or 8 with twoTiles), so games created before it replay. */
handSize?: 6 | 8 | 10 | 12;
/**
* Set with twoTiles in games created under the relaxed founding/merger limits (rules.md
* §4.1). Two-tile games logged before them lack it and keep the original limits.
*/
twoTilesRelaxed?: true;
/** Omitted when off, like stockSwap. */
limitedLog?: true;
}
@ -32,16 +39,19 @@ export const DEFAULT_OPTIONS: GameOptions = {
};
const END_SIZES = [41, 31];
const HAND_SIZES = [6, 8, 10, 12, "6", "8", "10", "12"];
/**
* Reads the creator's options defensively. BGS omits unticked checkboxes and always sends
* selects (as strings), so a missing checkbox means false. Options are never rejected
* (rules.md §3.5/§15): anything that does not apply, or has an unknown value, is ignored
* and reported so the log can say so.
* and reported so the log can say so. Replay passes the options `recorded` in the game's
* init log, so games created under an earlier rule revision rebuild with that revision.
*/
export function normalizeOptions(
players: number,
raw: Record<string, unknown>
raw: Record<string, unknown>,
recorded?: Partial<GameOptions>
): { options: GameOptions; ignored: IgnoredOption[] } {
const options: GameOptions = { ...DEFAULT_OPTIONS };
const ignored: IgnoredOption[] = [];
@ -96,6 +106,19 @@ export function normalizeOptions(
if (raw.twoTiles === true) {
options.twoTiles = true;
if (recorded === undefined || recorded.twoTilesRelaxed === true) {
options.twoTilesRelaxed = true;
}
}
if (raw.handSize !== undefined) {
if (HAND_SIZES.includes(raw.handSize as number | string)) {
const size = Number(raw.handSize) as 6 | 8 | 10 | 12;
if (size !== legacyHandSize(options)) {
options.handSize = size;
}
} else {
ignored.push({ option: "handSize", value: raw.handSize, reason: "unknown value" });
}
}
if (raw.limitedLog === true) {
options.limitedLog = true;
@ -109,11 +132,16 @@ export function sharePurchaseLimit(options: GameOptions): number {
return options.sharesPerTurn ?? MAX_BUY;
}
/** rules.md §15 twoTiles: hands hold 8 tiles instead of 6. */
export function handSize(options: GameOptions): number {
/** Games created before the handSize option hold 6 tiles, or 8 with twoTiles. */
function legacyHandSize(options: GameOptions): number {
return options.twoTiles ? TWO_TILE_HAND_SIZE : HAND_SIZE;
}
/** rules.md §15 handSize: the number of tiles each seat draws up to. */
export function handSize(options: GameOptions): number {
return options.handSize ?? legacyHandSize(options);
}
/** Internal seats per real player: fourHands gives each of the 2 players two seats. */
export function seatOwners(players: number, options: GameOptions): number[] {
if (players === 2 && options.twoPlayerMode === "fourHands") {

View file

@ -15,7 +15,7 @@ export function replayGame(data: GameState, to: number = data.log.length): GameS
if (!data.seed || first?.type !== "init") {
throw new Error("Replay needs the full game state, including the seed");
}
const state = initGame(first.players, first.rawOptions, data.seed);
const state = initGame(first.players, first.rawOptions, data.seed, first.options);
checkLog(state, data, 0);
while (state.log.length < to) {
const checked = state.log.length;

View file

@ -1,5 +1,5 @@
import { CHAIN_IDS, MAX_PLAYERS, MIN_PLAYERS, SHARES_PER_CHAIN, STARTING_CASH } from "./config.js";
import { handSize, normalizeOptions, seatOwners } from "./options.js";
import { handSize, normalizeOptions, seatOwners, type GameOptions } from "./options.js";
import { shuffle } from "./prng.js";
import { allTiles } from "./tiles.js";
import { drawTile, startTurn } from "./turn.js";
@ -9,12 +9,20 @@ function sharesOf(count: number): Shares {
return Object.fromEntries(CHAIN_IDS.map((chain) => [chain, count])) as Shares;
}
/** Creates a game for `players` real players; fourHands gives each of them two seats. */
export function initGame(players: number, rawOptions: Record<string, unknown>, seed: string): GameState {
/**
* Creates a game for `players` real players; fourHands gives each of them two seats. Replay
* passes the init log's `recorded` options to keep the rules the game was created with.
*/
export function initGame(
players: number,
rawOptions: Record<string, unknown>,
seed: string,
recorded?: Partial<GameOptions>
): GameState {
if (!Number.isInteger(players) || players < MIN_PLAYERS || players > MAX_PLAYERS) {
throw new Error(`Acquire needs ${MIN_PLAYERS} to ${MAX_PLAYERS} players`);
}
const { options, ignored } = normalizeOptions(players, rawOptions);
const { options, ignored } = normalizeOptions(players, rawOptions, recorded);
const seatOwner = seatOwners(players, options);
const seats = seatOwner.length;
const state: GameState = {

View file

@ -4,6 +4,7 @@ import * as wrapper from "../wrapper.js";
import { legalMoves } from "./legal.js";
import { applyMove, currentSeat, dropPlayerSeats } from "./moves.js";
import { normalizeOptions } from "./options.js";
import { blockedThisTurn, turnPlacements, twoTileLimit } from "./two-tiles.js";
import { positionAt } from "./position.js";
import { initGame } from "./setup.js";
import { turnSummary } from "./simple.js";
@ -82,41 +83,61 @@ test("§15 twoTiles: the second tile is skipped when none is playable", () => {
assert.deepEqual(placeable(state), []);
});
test("§15 twoTiles: after founding, a tile that would found or merge is blocked; growing is allowed", () => {
const state = scenario({
board: { ...chainAt("tower", ["1E", "2E"]), ...chainAt("luxor", ["4E", "5E"]), "8A": "loose", "1A": "loose" },
hands: [["9A", "3E", "6E", "2A"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
assert.deepEqual(placeable(state), ["9A", "3E", "6E", "2A"]);
play(state, 0, place("9A"));
play(state, 0, { type: "found", chain: "american" });
assert.deepEqual(placeable(state), ["6E"]);
for (const tile of ["3E", "2A"]) {
assert.throws(() => applyMove(state, place(tile), 0), /cannot found two chains/);
}
play(state, 0, place("6E"));
assert.equal(state.phase, "buy");
});
// Two pairs of chains to merge, and loose tiles to found a chain next to.
const LIMITS_BOARD = {
...chainAt("tower", ["1A", "2A"]),
...chainAt("luxor", ["4A", "5A"]),
...chainAt("american", ["1E", "2E"]),
...chainAt("festival", ["4E", "5E"]),
"8G": "loose",
"1I": "loose",
} as const;
test("§15 twoTiles: a turn may cause two mergers, but not a merger and a founding", () => {
test("§4.1 twoTiles: a merger with the first tile, then a founding with the second, is allowed", () => {
const state = scenario({
board: {
...chainAt("tower", ["1A", "2A"]),
...chainAt("luxor", ["4A", "5A"]),
...chainAt("american", ["1E", "2E"]),
...chainAt("festival", ["4E", "5E"]),
"8G": "loose",
},
hands: [["3A", "3E", "9G"], ["12C"], ["12E"]],
board: LIMITS_BOARD,
hands: [["3A", "9G"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
play(state, 0, place("3A"));
play(state, 0, { type: "survivor", chain: "tower" });
assert.equal(state.phase, "place");
assert.deepEqual(placeable(state), ["3E"], "9G would found a chain after a merger");
assert.deepEqual(placeable(state), ["9G"]);
play(state, 0, place("9G"));
play(state, 0, { type: "found", chain: "worldwide" });
assert.equal(state.phase, "buy");
play(state, 0, buy);
assert.equal(turnSummary(state, state.log.length - 1), "Player 1 merged Luxor into Tower, founded Worldwide");
});
test("§4.1 twoTiles: a founding with the first tile, then a merger of two other chains, is allowed", () => {
const state = scenario({
board: LIMITS_BOARD,
hands: [["9G", "3A", "3E"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
play(state, 0, place("9G"));
play(state, 0, { type: "found", chain: "worldwide" });
assert.deepEqual(placeable(state), ["3A", "3E"]);
play(state, 0, place("3E"));
play(state, 0, { type: "survivor", chain: "american" });
assert.equal(state.phase, "buy");
play(state, 0, buy);
assert.equal(turnSummary(state, state.log.length - 1), "Player 1 founded Worldwide, merged Festival into American");
});
test("§4.1 twoTiles: a merger, then another merger, is allowed", () => {
const state = scenario({
board: LIMITS_BOARD,
hands: [["3A", "3E", "9G"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
play(state, 0, place("3A"));
play(state, 0, { type: "survivor", chain: "tower" });
assert.deepEqual(placeable(state), ["3E", "9G"]);
play(state, 0, place("3E"));
play(state, 0, { type: "survivor", chain: "american" });
assert.equal(state.phase, "buy");
@ -127,16 +148,53 @@ test("§15 twoTiles: a turn may cause two mergers, but not a merger and a foundi
);
});
test("§15 twoTiles: a founding first rules out a merger with the second tile", () => {
test("§4.1 twoTiles: a turn cannot found two chains; growing the new chain is allowed", () => {
const state = scenario({
board: { ...chainAt("tower", ["1A", "2A"]), ...chainAt("luxor", ["4A", "5A"]), "8G": "loose" },
hands: [["9G", "3A"], ["12C"], ["12E"]],
board: LIMITS_BOARD,
hands: [["9G", "2I", "10G"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
play(state, 0, place("9G"));
play(state, 0, { type: "found", chain: "american" });
assert.deepEqual(placeable(state), [], "3A would merge after a founding");
play(state, 0, { type: "found", chain: "worldwide" });
assert.equal(twoTileLimit(state, t("2I")), "oneFounding");
assert.throws(() => applyMove(state, place("2I"), 0), /cannot found two chains/);
assert.deepEqual(placeable(state), ["10G"]);
play(state, 0, place("10G"));
assert.equal(state.phase, "buy");
});
test("§4.1 twoTiles: the second tile cannot merge the chain founded this turn", () => {
// 9G founds a chain with 8G; 7G would then merge it with Imperial.
const state = scenario({
board: { ...LIMITS_BOARD, ...chainAt("imperial", ["6G", "6H"]) },
hands: [["9G", "7G", "3A"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
assert.equal(twoTileLimit(state, t("7G")), undefined);
play(state, 0, place("9G"));
play(state, 0, { type: "found", chain: "worldwide" });
assert.equal(twoTileLimit(state, t("7G")), "mergeFounded");
assert.equal(twoTileLimit(state, t("3A")), undefined);
assert.throws(() => applyMove(state, place("7G"), 0), /cannot merge the chain it founded/);
assert.deepEqual(placeable(state), ["3A"]);
play(state, 0, place("3A"));
play(state, 0, { type: "survivor", chain: "luxor" });
play(state, 0, buy);
assert.equal(twoTileLimit(state, t("7G")), undefined, "the limit ends with the turn");
});
test("§4.1 twoTiles: the second tile is skipped when only a merger with the new chain remains", () => {
const state = scenario({
board: { ...LIMITS_BOARD, ...chainAt("imperial", ["6G", "6H"]) },
hands: [["9G", "7G"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
});
play(state, 0, place("9G"));
play(state, 0, { type: "found", chain: "worldwide" });
assert.deepEqual(placeable(state), []);
assert.equal(state.phase, "buy");
});
@ -275,3 +333,76 @@ test("§14.7 twoTiles games replay exactly", () => {
}
assert.deepEqual(wrapper.replay(state), state);
});
/** Two-tile games created before the relaxed limits have no `twoTilesRelaxed` option. */
function legacy(state: GameState): GameState {
delete state.options.twoTilesRelaxed;
const init = state.log[0];
if (init?.type === "init") {
delete init.options.twoTilesRelaxed;
}
return state;
}
test("§4.1 twoTiles: new games record the relaxed limits; replay keeps a game's own revision", () => {
assert.equal(normalizeOptions(3, TWO_TILES).options.twoTilesRelaxed, true);
assert.equal("twoTilesRelaxed" in normalizeOptions(3, {}).options, false);
assert.equal("twoTilesRelaxed" in normalizeOptions(3, TWO_TILES, { twoTiles: true }).options, false);
assert.equal(normalizeOptions(3, TWO_TILES, { twoTiles: true, twoTilesRelaxed: true }).options.twoTilesRelaxed, true);
assert.equal("twoTilesRelaxed" in normalizeOptions(3, {}, { twoTilesRelaxed: true }).options, false);
});
test("§4.1 twoTiles in games created before the relaxed limits: no founding and merger in one turn", () => {
const foundThenMerge = legacy(
scenario({
board: LIMITS_BOARD,
hands: [["9G", "3A", "12A"], ["12C"], ["12E"]],
poolOnly: true,
options: TWO_TILES,
})
);
play(foundThenMerge, 0, place("9G"));
play(foundThenMerge, 0, { type: "found", chain: "worldwide" });
assert.equal(twoTileLimit(foundThenMerge, t("3A")), "foundOrMerge");
assert.throws(() => applyMove(foundThenMerge, place("3A"), 0), /cannot both found a chain and cause a merger/);
assert.deepEqual(placeable(foundThenMerge), ["12A"]);
const mergeThenFound = legacy(
scenario({ board: LIMITS_BOARD, hands: [["3A", "9G", "3E"], ["12C"], ["12E"]], poolOnly: true, options: TWO_TILES })
);
play(mergeThenFound, 0, place("3A"));
play(mergeThenFound, 0, { type: "survivor", chain: "tower" });
assert.equal(twoTileLimit(mergeThenFound, t("9G")), "foundOrMerge");
assert.deepEqual(placeable(mergeThenFound), ["3E"], "two mergers are still allowed");
});
test("§4.1 twoTiles in games created before the relaxed limits: bank-caused mergers do not count", () => {
const state = legacy(
scenario({ board: LIMITS_BOARD, hands: [["12A", "9G"], ["12C"], ["12E"]], poolOnly: true, options: TWO_TILES })
);
play(state, 0, place("12A"));
state.log.push({ type: "merger", seat: 0, tile: t("3A"), sizes: { tower: 2, luxor: 2 }, byBank: true });
assert.equal(turnPlacements(state).merged, false);
assert.equal(twoTileLimit(state, t("9G")), undefined);
state.log.push({ type: "merger", seat: 0, tile: t("3E"), sizes: { american: 2, festival: 2 } });
assert.equal(turnPlacements(state).merged, true);
assert.equal(twoTileLimit(state, t("9G")), "foundOrMerge");
});
test("§14.7 twoTiles games created before the relaxed limits replay under them", () => {
const state = legacy(initGame(3, TWO_TILES, "legacy-two-tiles"));
let differs = false;
for (let i = 0; i < 400 && !state.ended; i++) {
if (state.phase === "place") {
const relaxed = { ...state, options: { ...state.options, twoTilesRelaxed: true as const } };
differs ||= state.seats[state.activeSeat]!.hand.some(
(tile) => blockedThisTurn(state, tile) && !blockedThisTurn(relaxed, tile)
);
}
const moves = legalMoves(state).filter((move) => move.type !== "announce");
play(state, currentSeat(state)!, moves[(i * 7919) % moves.length]!);
}
assert.ok(differs, "the game reaches a turn where the original limits block a tile");
assert.equal("twoTilesRelaxed" in state.options, false);
assert.deepEqual(wrapper.replay(structuredClone(state)), state);
});

View file

@ -1,10 +1,25 @@
import { placementEffect } from "./board.js";
import type { ChainId } from "./config.js";
import type { Tile } from "./tiles.js";
import type { GameState } from "./types.js";
/** What the active seat's placements have done so far this turn, read from the log. */
export function turnPlacements(state: GameState): { placed: number; founded: boolean; merged: boolean } {
const result = { placed: 0, founded: false, merged: false };
/**
* Why rules.md §15 twoTiles rules out a tile this turn: `oneFounding` (a second founding),
* `mergeFounded` (a merger involving the chain founded this turn), or, in games created
* under the original limits, `foundOrMerge` (a founding and a merger in one turn).
*/
export type TwoTileLimit = "oneFounding" | "mergeFounded" | "foundOrMerge";
/**
* What the active seat's placements have done so far this turn, read from the log: how many
* tiles it placed, the chain it founded (if any) and whether it caused a merger.
*/
export function turnPlacements(state: GameState): { placed: number; founded: ChainId | null; merged: boolean } {
const result: { placed: number; founded: ChainId | null; merged: boolean } = {
placed: 0,
founded: null,
merged: false,
};
for (let i = state.log.length - 1; i >= 0; i--) {
const entry = state.log[i]!;
if (entry.type === "turn") {
@ -13,7 +28,7 @@ export function turnPlacements(state: GameState): { placed: number; founded: boo
if (entry.type === "move" && entry.move.type === "place") {
result.placed++;
} else if (entry.type === "founded") {
result.founded = true;
result.founded = entry.chain;
} else if (entry.type === "merger" && !entry.byBank) {
// rules.md §15 twoTiles: mergers caused by bank tiles do not count.
result.merged = true;
@ -23,16 +38,30 @@ export function turnPlacements(state: GameState): { placed: number; founded: boo
}
/**
* rules.md §15 twoTiles: a turn founds at most one chain, and never both founds a chain and
* causes a merger. Whether `tile` is ruled out by what this turn's placements already did.
* rules.md §4.1: a turn founds at most one chain, and its second tile cannot merge the chain
* its first tile founded. Games created before the relaxed limits (no `twoTilesRelaxed`)
* also forbid founding and merging in the same turn, in either order.
*/
export function blockedThisTurn(state: GameState, tile: Tile): boolean {
export function twoTileLimit(state: GameState, tile: Tile): TwoTileLimit | undefined {
if (!state.options.twoTiles) {
return false;
return undefined;
}
const { founded, merged } = turnPlacements(state);
const effect = placementEffect(state.board, tile).kind;
return (effect === "found" && (founded || merged)) || (effect === "merge" && founded);
const effect = placementEffect(state.board, tile);
if (effect.kind === "found" && founded !== null) {
return "oneFounding";
}
if (!state.options.twoTilesRelaxed) {
return (effect.kind === "found" && merged) || (effect.kind === "merge" && founded !== null)
? "foundOrMerge"
: undefined;
}
return effect.kind === "merge" && founded !== null && effect.chains.includes(founded) ? "mergeFounded" : undefined;
}
/** Whether `tile` is ruled out by what this turn's placements already did (rules.md §4.1). */
export function blockedThisTurn(state: GameState, tile: Tile): boolean {
return twoTileLimit(state, tile) !== undefined;
}
/** rules.md §15 twoTiles: whether the active seat places another tile before buying. */

View file

@ -1,7 +1,7 @@
// Local dev harness (not part of the BGS bundle): runs the real engine in the page, plays
// random moves on request, and lets you view the game as any player or as a spectator.
// URL parameters: players=2..6, seed=..., view=N, hotseat=0, theme=light|dark, locale=de, and any game option, e.g. publicHoldings=1,
// twoPlayerMode=fourHands, teamPlay=1, autoEnd=1, endSize=31. For reproducible screenshots: moves=N plays N random moves,
// twoPlayerMode=fourHands, teamPlay=1, autoEnd=1, endSize=31, twoTiles=1, handSize=12. For reproducible screenshots: moves=N plays N random moves,
// merger=1 then plays on to the next merger decision, bar=0 hides this toolbar.
import * as rules from "acquire-engine";
import { currentSeat, legalMoves, type GameState } from "acquire-engine";
@ -34,7 +34,7 @@ for (const key of ["publicHoldings", "teamPlay", "autoEnd", "twoTiles", "limited
options[key] = true;
}
}
for (const key of ["twoPlayerMode", "endSize", "stockSwap", "sharesPerTurn"]) {
for (const key of ["twoPlayerMode", "endSize", "stockSwap", "sharesPerTurn", "handSize"]) {
const value = params.get(key);
if (value) {
options[key] = value;

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { HIDDEN, parseTile, sortTiles, tileLabel, tileLegality, type Tile } from "acquire-engine";
import { handSize, HIDDEN, parseTile, sortTiles, tileLabel, tileLegality, type Tile } from "acquire-engine";
import { ofType, turnLimit } from "./decisions";
import { seatName } from "./format";
import type { ViewerStore } from "./store.svelte";
@ -40,7 +40,7 @@
{@const limited = hand.filter((tile) => turnLimit(state, seat, tile) !== undefined)}
<section class="hand" aria-label={t("hand.of", { name: seatName(state, seat, store.lang) })}>
<h2>{store.seats.length > 1 ? t("hand.seat", { seat: seat + 1 }) : t("hand.yours")}</h2>
<div class="tiles" class:eight={state.options.twoTiles}>
<div class="tiles" data-size={handSize(state.options)}>
{#each hand as tile, index (index)}
{@const permanent = dead.includes(tile)}
{@const blocked = permanent || paused.includes(tile) || limited.includes(tile)}
@ -85,7 +85,7 @@
<span><bdi>{paused.map(tileLabel).join(", ")}</bdi> — {t("hand.eighth")}</span>
</li>
{/if}
{#each ["oneFounding", "foundOrMerge"] as const as limit (limit)}
{#each ["oneFounding", "mergeFounded", "foundOrMerge"] as const as limit (limit)}
{@const tiles = limited.filter((tile) => turnLimit(state, seat, tile) === limit)}
{#if tiles.length}
<li class="paused-note">
@ -102,27 +102,52 @@
<style>
.hand {
margin: 12px 0 0;
container-type: inline-size;
}
.hand:first-child {
margin-top: 0;
}
/* Six tiles fit on one row; the 12px gaps leave room for outlines drawn outside the tiles. */
/* Six tiles fit on one row; the 12px gaps leave room for outlines drawn outside the tiles.
A row of n 52px tiles needs 64n + 4px; 44px tiles need 56n + 4px. */
.tiles {
--columns: 6;
display: grid;
grid-template-columns: repeat(6, minmax(0, 52px));
grid-template-columns: repeat(var(--columns), minmax(0, 52px));
gap: 12px;
padding: 8px;
background: var(--rack);
width: max-content;
max-width: 100%;
}
/* Eight tiles (two tiles per turn) take one row where it fits and two rows of four on phones. */
.tiles.eight {
grid-template-columns: repeat(8, minmax(0, 52px));
/* Larger hands take one row where the rack's column fits it, otherwise two even rows. */
.tiles[data-size="8"] {
--columns: 4;
}
@media (max-width: 560px) {
.tiles.eight {
grid-template-columns: repeat(4, minmax(0, 52px));
.tiles[data-size="10"] {
--columns: 5;
}
.tiles[data-size="12"] {
--columns: 6;
}
@container (min-width: 516px) {
.tiles[data-size="8"] {
--columns: 8;
}
}
@container (min-width: 644px) {
.tiles[data-size="10"] {
--columns: 10;
}
}
@container (min-width: 772px) {
.tiles[data-size="12"] {
--columns: 12;
}
}
/* Narrow phones: three rows of four rather than tiles below the 44px touch size. */
@container (max-width: 339px) {
.tiles[data-size="12"] {
--columns: 4;
}
}
.tile {

View file

@ -137,8 +137,15 @@ test("two-tile limits explain exactly the tiles the engine blocks this turn", ()
continue;
}
assert.ok(!placeable.includes(tileLabel(tile)));
const founding = placementEffect(state.board, tile).kind === "found";
assert.equal(limit, founding && turnPlacements(state).founded ? "oneFounding" : "foundOrMerge");
const effect = placementEffect(state.board, tile);
const { founded } = turnPlacements(state);
assert.ok(founded, "only a founding earlier this turn limits the second tile");
if (effect.kind === "merge") {
assert.equal(limit, "mergeFounded");
assert.ok(effect.chains.includes(founded));
} else {
assert.deepEqual([effect.kind, limit], ["found", "oneFounding"]);
}
assert.equal(turnLimit(state, (seat + 1) % 4, tile), undefined, "limits apply only to the active seat");
}
const view = stripSecret(state, seat);

View file

@ -1,18 +1,18 @@
// Which choices the viewer offers. Validity always comes from the engine: these helpers only
// filter and look up engine.legalMoves(), so no rule is re-implemented here.
import {
blockedThisTurn,
CHAIN_IDS,
chainSize,
currentSeat,
legalMoves,
placementEffect,
turnPlacements,
twoTileLimit,
type ChainId,
type GameState,
type Move,
type Shares,
type Tile,
type TwoTileLimit,
} from "acquire-engine";
import { chainName, type Lang } from "./format.ts";
@ -49,13 +49,8 @@ export function describePlacement(state: GameState, tile: Tile, lang: Lang): str
* Why `tile` in `seat`'s hand can't be placed this turn under the two-tiles limits
* (rules.md §4.1), or undefined when they don't block it.
*/
export function turnLimit(state: GameState, seat: number, tile: Tile): "oneFounding" | "foundOrMerge" | undefined {
if (seat !== state.activeSeat || state.ended || !blockedThisTurn(state, tile)) {
return undefined;
}
return placementEffect(state.board, tile).kind === "found" && turnPlacements(state).founded
? "oneFounding"
: "foundOrMerge";
export function turnLimit(state: GameState, seat: number, tile: Tile): TwoTileLimit | undefined {
return seat === state.activeSeat && !state.ended ? twoTileLimit(state, tile) : undefined;
}
function sameShares(a: Partial<Shares>, b: Partial<Shares>): boolean {

View file

@ -92,6 +92,7 @@ export const da: Catalog = {
"hand.eighth": "kan ikke grundlægge en 8. kæde",
"hand.deadNextTurn": "Udskiftes ved starten af din næste tur",
"hand.oneFounding": "kan ikke grundlægge en kæde mere i denne tur",
"hand.mergeFounded": "kan ikke fusionere kæden, du grundlagde i denne tur",
"hand.foundOrMerge": "kan ikke både grundlægge en kæde og fusionere i samme tur",
"chains.label": "Hotelkæder",
"chains.title": "Kæder",

View file

@ -92,6 +92,7 @@ export const de: Catalog = {
"hand.eighth": "keine 8. Kette möglich",
"hand.deadNextTurn": "Werden zu Beginn deines nächsten Zuges ersetzt",
"hand.oneFounding": "keine zweite Kettengründung in diesem Zug",
"hand.mergeFounded": "keine Fusion mit der in diesem Zug gegründeten Kette",
"hand.foundOrMerge": "nicht Gründung und Fusion im selben Zug",
"chains.label": "Hotelketten",
"chains.title": "Ketten",

View file

@ -92,6 +92,7 @@ export const el: Catalog = {
"hand.eighth": "δεν ιδρύεται 8η αλυσίδα",
"hand.deadNextTurn": "Αντικατάσταση στην αρχή του επόμενου γύρου σου",
"hand.oneFounding": "δεν ιδρύεται δεύτερη αλυσίδα σε αυτόν τον γύρο",
"hand.mergeFounded": "όχι συγχώνευση της αλυσίδας που ιδρύθηκε σε αυτόν τον γύρο",
"hand.foundOrMerge": "όχι ίδρυση αλυσίδας και συγχώνευση στον ίδιο γύρο",
"chains.label": "Αλυσίδες ξενοδοχείων",
"chains.title": "Αλυσίδες",

View file

@ -99,6 +99,7 @@ export const en = {
"hand.eighth": "can't found an 8th chain",
"hand.deadNextTurn": "Replaced at the start of your next turn",
"hand.oneFounding": "can't found a second chain this turn",
"hand.mergeFounded": "can't merge the chain you founded this turn",
"hand.foundOrMerge": "can't both found a chain and merge in one turn",
// Chain and price tables

View file

@ -92,6 +92,7 @@ export const fa: Catalog = {
"hand.eighth": "زنجیره‌ی هشتم ممکن نیست",
"hand.deadNextTurn": "در آغاز نوبت بعدی شما جایگزین می‌شوند",
"hand.oneFounding": "در این نوبت زنجیره‌ی دوم ممکن نیست",
"hand.mergeFounded": "ادغام زنجیره‌ای که در این نوبت تأسیس شد ممکن نیست",
"hand.foundOrMerge": "تأسیس زنجیره و ادغام در یک نوبت ممکن نیست",
"chains.label": "زنجیره‌های هتل",
"chains.title": "زنجیره‌ها",

View file

@ -97,6 +97,7 @@ export const fr: Catalog = {
"hand.eighth": "impossible de fonder une 8e chaîne",
"hand.deadNextTurn": "Remplacement au début de votre prochain tour",
"hand.oneFounding": "impossible de fonder une deuxième chaîne ce tour-ci",
"hand.mergeFounded": "impossible de fusionner la chaîne fondée ce tour-ci",
"hand.foundOrMerge": "impossible de fonder une chaîne et de fusionner dans le même tour",
"chains.label": "Chaînes d’hôtels",
"chains.title": "Chaînes",

View file

@ -91,6 +91,7 @@ export const hi: Catalog = {
"hand.eighth": "8वीं श्रृंखला स्थापित नहीं हो सकती",
"hand.deadNextTurn": "आपकी अगली बारी की शुरुआत में बदल दी जाएँगी",
"hand.oneFounding": "इस बारी में दूसरी श्रृंखला स्थापित नहीं हो सकती",
"hand.mergeFounded": "इस बारी में स्थापित श्रृंखला का विलय नहीं हो सकता",
"hand.foundOrMerge": "एक ही बारी में श्रृंखला स्थापित करना और विलय दोनों नहीं हो सकते",
"chains.label": "होटल श्रृंखलाएँ",
"chains.title": "श्रृंखलाएँ",

View file

@ -96,6 +96,7 @@ export const it: Catalog = {
"hand.eighth": "non si può fondare un'8ª catena",
"hand.deadNextTurn": "Sostituite all'inizio del tuo prossimo turno",
"hand.oneFounding": "non si può fondare una seconda catena in questo turno",
"hand.mergeFounded": "non si può fondere la catena fondata in questo turno",
"hand.foundOrMerge": "non si può fondare una catena e fondere nello stesso turno",
"chains.label": "Catene alberghiere",
"chains.title": "Catene",

View file

@ -92,6 +92,7 @@ export const ko: Catalog = {
"hand.eighth": "8번째 체인은 세울 수 없음",
"hand.deadNextTurn": "다음 차례가 시작될 때 교체됩니다",
"hand.oneFounding": "이번 차례에 두 번째 체인은 세울 수 없음",
"hand.mergeFounded": "이번 차례에 세운 체인은 합병할 수 없음",
"hand.foundOrMerge": "한 차례에 체인 설립과 합병을 모두 할 수 없음",
"chains.label": "호텔 체인",
"chains.title": "체인",

View file

@ -92,6 +92,7 @@ export const nl: Catalog = {
"hand.eighth": "kan geen 8e keten stichten",
"hand.deadNextTurn": "Worden aan het begin van je volgende beurt vervangen",
"hand.oneFounding": "kan deze beurt geen tweede keten stichten",
"hand.mergeFounded": "kan de keten die je deze beurt stichtte niet laten fuseren",
"hand.foundOrMerge": "kan niet in één beurt een keten stichten én fuseren",
"chains.label": "Hotelketens",
"chains.title": "Ketens",

View file

@ -97,6 +97,7 @@ export const pl: Catalog = {
"hand.eighth": "nie można założyć 8. sieci",
"hand.deadNextTurn": "Wymiana na początku twojej następnej tury",
"hand.oneFounding": "nie można założyć drugiej sieci w tej turze",
"hand.mergeFounded": "nie można połączyć sieci założonej w tej turze",
"hand.foundOrMerge": "nie można w jednej turze założyć sieci i połączyć sieci",
"chains.label": "Sieci hoteli",
"chains.title": "Sieci",

View file

@ -96,6 +96,7 @@ export const ptBR: Catalog = {
"hand.eighth": "não dá para fundar uma 8ª rede",
"hand.deadNextTurn": "Substituição no início do seu próximo turno",
"hand.oneFounding": "não dá para fundar uma segunda rede neste turno",
"hand.mergeFounded": "não dá para fundir a rede fundada neste turno",
"hand.foundOrMerge": "não dá para fundar uma rede e fundir no mesmo turno",
"chains.label": "Redes de hotéis",
"chains.title": "Redes",

View file

@ -97,6 +97,7 @@ export const ro: Catalog = {
"hand.eighth": "nu se poate înființa un al 8-lea lanț",
"hand.deadNextTurn": "Înlocuire la începutul turei tale următoare",
"hand.oneFounding": "nu se poate înființa un al doilea lanț în această tură",
"hand.mergeFounded": "nu se poate face fuziunea lanțului înființat în această tură",
"hand.foundOrMerge": "nu se poate înființa un lanț și face o fuziune în aceeași tură",
"chains.label": "Lanțuri hoteliere",
"chains.title": "Lanțuri",

View file

@ -97,6 +97,7 @@ export const ru: Catalog = {
"hand.eighth": "нельзя основать 8-ю сеть",
"hand.deadNextTurn": "Заменяются в начале вашего следующего хода",
"hand.oneFounding": "нельзя основать вторую сеть за этот ход",
"hand.mergeFounded": "нельзя слить сеть, основанную в этот ход",
"hand.foundOrMerge": "нельзя за один ход и основать сеть, и провести слияние",
"chains.label": "Гостиничные сети",
"chains.title": "Сети",

View file

@ -92,6 +92,7 @@ export const vi: Catalog = {
"hand.eighth": "không thể lập chuỗi thứ 8",
"hand.deadNextTurn": "Được thay khi bắt đầu lượt sau của bạn",
"hand.oneFounding": "không thể lập chuỗi thứ hai trong lượt này",
"hand.mergeFounded": "không thể sáp nhập chuỗi vừa lập trong lượt này",
"hand.foundOrMerge": "không thể vừa lập chuỗi vừa sáp nhập trong cùng một lượt",
"chains.label": "Chuỗi khách sạn",
"chains.title": "Chuỗi",

View file

@ -91,6 +91,7 @@ export const zhCN: Catalog = {
"hand.eighth": "无法创立第 8 个连锁",
"hand.deadNextTurn": "在你下一回合开始时更换",
"hand.oneFounding": "本回合不能再创立第二个连锁",
"hand.mergeFounded": "不能合并本回合创立的连锁",
"hand.foundOrMerge": "同一回合内不能既创立连锁又进行合并",
"chains.label": "酒店连锁",
"chains.title": "连锁",

View file

@ -91,6 +91,7 @@ export const zhTW: Catalog = {
"hand.eighth": "無法創立第 8 個連鎖",
"hand.deadNextTurn": "在你下一回合開始時更換",
"hand.oneFounding": "本回合不能再創立第二個連鎖",
"hand.mergeFounded": "不能合併本回合創立的連鎖",
"hand.foundOrMerge": "同一回合內不能既創立連鎖又進行合併",
"chains.label": "飯店連鎖",
"chains.title": "連鎖",

View file

@ -41,7 +41,8 @@ original 1976 rules were silent or ambiguous, the choice made here is marked
3. The player who placed the **lowest** tile goes first. Compare by number first, then
letter: `2B` beats `2E` and `3A`. Play then proceeds clockwise (in seat order) from
that player. **[DECISION]** "Clockwise" means ascending seat order, wrapping around.
4. Each player then draws **6** tiles into their private hand.
4. Each player then draws **6** tiles into their private hand (the `handSize` option, §15,
may set 8, 10 or 12).
5. **[DECISION]** Options are never rejected at setup. An option that does not apply to
the player count (see §15) is ignored, and the game log records that it was ignored.
@ -57,7 +58,8 @@ player.
3. **End-of-game announcement** (§11). Optional. **[DECISION]** Allowed at exactly two
points: before placing a tile, and during the buy step (§11.1).
4. **Replace dead tiles** (§5.3).
5. **Draw** one tile to bring the hand back to 6, if the pool is not empty.
5. **Draw** one tile to bring the hand back to 6 (or the `handSize`, §15), if the pool is
not empty.
If the game was announced as over during this turn, run final scoring (§11.2) after
the turn completes instead of passing to the next player.
@ -70,8 +72,7 @@ they cannot buy anything.
### 4.1 Two tiles per turn (house rule)
With `twoTiles` enabled (§15), hands hold **8** tiles instead of 6 (at setup and when
drawing), and each turn places two tiles:
With `twoTiles` enabled (§15), each turn places two tiles:
1. At the start of the turn, the active seat discards its permanently unplayable tiles
(§5.2) and draws replacements. They are not replaced at the end of the turn.
@ -81,13 +82,19 @@ drawing), and each turn places two tiles:
3. Place the second tile if any tile in hand is playable now; otherwise go straight to
buying. A tile that became permanently unplayable during this turn cannot be placed and
is replaced at the start of the seat's next turn.
4. A turn founds at most one chain, and never both founds a chain and causes a merger, in
either order. It may cause two mergers, one per tile. Mergers caused by bank tiles do
not count towards these limits.
5. Buy (§9, including §9.1 swaps) once, after both tiles, then draw back up to 8.
4. A turn founds at most one chain, and the second tile cannot cause a merger involving the
chain the first tile founded (as survivor or defunct). Otherwise each tile follows the
usual rules: a merger may be followed by a founding or another merger, and a founding by
a merger of other chains. **[DECISION]** Games created before this revision (init
options without `twoTilesRelaxed`) keep the earlier limit, also when replayed: a turn
never both founds a chain and causes a merger, in either order, and mergers caused by
bank tiles do not count towards it.
5. Buy (§9, including §9.1 swaps) once, after both tiles, then draw back up to the hand size.
The end may also be announced between the two tiles, if an end condition holds at that
moment. Dropped seats place their first two playable tiles by the §16 default.
moment. Dropped seats place their first two playable tiles by the §16 default. The hand
size is the separate `handSize` option (§15); games created before it hold **8** tiles with
`twoTiles`.
## 5. Placing a Tile
@ -385,7 +392,8 @@ switches on one engine, not as separate code paths. Defaults reproduce the stand
| `autoEnd` | true / false | false | When true, the game ends automatically at the end of the turn in which an end condition (§11.1) first holds, instead of waiting for an announcement. |
| `sharesPerTurn` | 3 / 4 / 5 | 3 | Maximum shares purchased per turn in total across all active chains (house rule). Independent of stock swaps; see §9. |
| `stockSwap` | `off` / 3 / 5 / 7 / `unlimited` | `off` | Optional 1:1 exchanges with the bank before buying, paying or receiving the price difference. See §9.1. |
| `twoTiles` | true / false | false | Hands of 8 tiles and two placements per turn (house rule). See §4.1. |
| `twoTiles` | true / false | false | Two placements per turn (house rule). See §4.1. |
| `handSize` | 6 / 8 / 10 / 12 | 6 | Tiles each seat draws at setup and refills to (house rule), with or without `twoTiles`. **[DECISION]** Without `handSize` in the init options (games created before it), hands hold 6, or 8 with `twoTiles`; normalized options omit `handSize` at that legacy size so those games replay identically. Twelve tiles for each of 6 players use 78 of the 108 tiles at setup, counting turn-order tiles. |
| `limitedLog` | true / false | false | The log shows only what happened since your last turn until the game ends (house rule). See §13. |
| `endSize` | 41 / 31 | 41 | The chain size that triggers the end condition in §11.1. Setting 31 gives a shorter game (house rule). Does not change the safe size (11) or the price table. |

View file

@ -170,6 +170,7 @@ try {
await page.evaluate((state) => {
const { parseTile, allTiles } = window.acquireDev.rules;
state.options.twoTiles = true;
state.options.twoTilesRelaxed = true;
state.options.limitedLog = true;
state.board[parseTile("1C")] = "loose";
state.seats[0].hand = ["2A", "3A", "2C", "5E", "7E", "9E", "7G", "9G"].map(parseTile);