Add an optional limited game log

With limitedLog on, each player's view and log slices replace entries from
before the start of their last turn with placeholders, keeping the log's
length. The current turn, including a merger in progress, is always visible,
spectators see what the active player sees, and the full log is revealed at
game end. The viewer shows one note for each withheld run and holds replay at
the live position until the game ends (rules.md §13).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mike Isom 2026-10-27 16:46:18 -06:00
commit 62e3c99a65
34 changed files with 279 additions and 22 deletions

View file

@ -36,7 +36,7 @@ play every seat. The toolbar plays random moves, jumps to the next merger, and s
player, theme and language.
URL parameters: `players=2..6`, `seed=...`, `publicHoldings=1`, `teamPlay=1`, `autoEnd=1`,
`endSize=31`, `twoPlayerMode=fourHands`, `stockSwap=3` (or `5`, `7`, `unlimited`), `theme=light|dark`, `locale=de`, `moves=50` (random
`endSize=31`, `twoPlayerMode=fourHands`, `stockSwap=3` (or `5`, `7`, `unlimited`), `twoTiles=1`, `limitedLog=1`, `theme=light|dark`, `locale=de`, `moves=50` (random
moves on load), `merger=1` (continue to the next merger).
## What ships

View file

@ -127,6 +127,12 @@
"label": "Two tiles per turn (hands of 8, optional variant)",
"type": "checkbox",
"default": false
},
{
"name": "limitedLog",
"label": "Limited game log (only since your last turn until the game ends)",
"type": "checkbox",
"default": false
}
],
"settings": [],

View file

@ -126,10 +126,17 @@ With two players, the bank also acts as a shareholder whenever bonuses are paid.
## What you can see
Your tiles are private. Unless the game was created with **public holdings**, each player's cash and shares are private too; the game log is always public, so a careful player can work them out.
Your tiles are private. Unless the game was created with **public holdings**, each player's cash and shares are private too; the game log is public (unless the game uses a limited game log, below), so a careful player can work them out.
### Limited game log
Much of Acquire is remembering who bought what. If the game uses **Limited game log**, the log only shows what has happened since your last turn. During a merger, the log still shows everything about that merger, even if it started before your last turn. The full log opens up once the game ends.
Because replaying the game would show the full history, replay is only available after the game ends when this setting is on.
## 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).
- **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

@ -18,4 +18,5 @@ export * from "./src/view.js";
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";

View file

@ -0,0 +1,139 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import * as wrapper from "../wrapper.js";
import { legalMoves } from "./legal.js";
import { logWindowStart } from "./limited-log.js";
import { applyMove, currentSeat } from "./moves.js";
import { normalizeOptions } from "./options.js";
import { initGame } from "./setup.js";
import type { GameState, LogEntry } from "./types.js";
const LIMITED = { limitedLog: true };
function lcg(seed: number): () => number {
let s = seed >>> 0;
return () => {
s = (Math.imul(s, 1664525) + 1013904223) >>> 0;
return s / 2 ** 32;
};
}
/** Plays random legal moves (never announcing) until `done` holds or the game ends. */
function playUntil(state: GameState, random: () => number, done: (state: GameState) => boolean = () => false) {
while (!state.ended && !done(state)) {
const moves = legalMoves(state).filter((move) => move.type !== "announce");
applyMove(state, moves[Math.floor(random() * moves.length)]!, currentSeat(state)!);
}
}
function turnIndexes(state: GameState, seat: number): number[] {
return state.log.flatMap((entry, index) => (entry.type === "turn" && entry.seat === seat ? [index] : []));
}
const hiddenCount = (log: LogEntry[]) => log.filter((entry) => entry.type === "hidden").length;
test("§15 limitedLog defaults off: every viewer gets the whole log", () => {
assert.equal("limitedLog" in normalizeOptions(3, {}).options, false);
assert.equal(normalizeOptions(3, { limitedLog: "true" }).options.limitedLog, undefined);
assert.equal(normalizeOptions(3, LIMITED).options.limitedLog, true);
const state = initGame(3, {}, "full-log");
playUntil(state, lcg(1), (s) => s.turn > 12);
for (const player of [0, 1, 2, undefined]) {
assert.deepEqual(wrapper.stripSecret(state, player).log, state.log);
}
});
test("§13 limitedLog: a player sees the log from the start of their last turn, with setup kept", () => {
const state = initGame(4, LIMITED, "window");
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
const active = state.activeSeat;
for (let player = 0; player < 4; player++) {
const view = wrapper.stripSecret(state, player);
assert.equal(view.log.length, state.log.length, "the log keeps its length for turn drafts");
const turns = turnIndexes(state, player);
// While it is your turn, the window starts at your previous one.
const start = player === active ? turns.at(-2)! : turns.at(-1)!;
assert.equal(logWindowStart(state, player), start);
view.log.forEach((entry, index) => {
const setup = ["init", "optionIgnored", "turnOrder"].includes(state.log[index]!.type);
assert.deepEqual(entry, index >= start || setup ? state.log[index] : { type: "hidden" }, `entry ${index}`);
});
assert.ok(hiddenCount(view.log) > 0);
}
assert.deepEqual(
wrapper.stripSecret(state, undefined).log,
wrapper.stripSecret(state, active).log,
"spectators see what the active player sees"
);
});
test("§13 limitedLog: a merger in progress stays fully visible to every disposer", () => {
const state = initGame(4, LIMITED, "mergers");
const random = lcg(6);
let disposals = 0;
while (!state.ended && disposals < 20) {
if (state.phase === "dispose") {
const current = state.log.map((entry) => entry.type).lastIndexOf("turn");
const view = wrapper.stripSecret(state, state.seatOwner[currentSeat(state)!]);
assert.deepEqual(view.log.slice(current), state.log.slice(current));
disposals++;
}
const moves = legalMoves(state).filter((move) => move.type !== "announce");
applyMove(state, moves[Math.floor(random() * moves.length)]!, currentSeat(state)!);
}
assert.ok(disposals > 0, "the game reached a stock disposal");
});
test("§13 limitedLog: the whole log is revealed once the game ends", () => {
const state = initGame(3, LIMITED, "revealed");
playUntil(state, lcg(3));
assert.equal(state.ended, true);
for (const player of [0, 1, 2, undefined]) {
assert.deepEqual(wrapper.stripSecret(state, player).log, state.log);
assert.equal(hiddenCount(wrapper.logSlice(state, { player }).log), 0);
}
});
test("§13 limitedLog: logSlice hides the same entries, and new entries are never hidden", () => {
const state = initGame(3, LIMITED, "slice");
const random = lcg(4);
playUntil(state, random, (s) => s.turn > 10);
for (const player of [0, 1, 2, undefined]) {
const { log } = wrapper.logSlice(state, { player });
assert.deepEqual(
log.map(({ simple: _simple, ...entry }) => entry),
wrapper.stripSecret(state, player).log
);
for (const entry of log) {
assert.ok(entry.simple.length > 0);
}
}
const before = state.log.length;
playUntil(state, random, (s) => s.log.length > before + 5);
for (const player of [0, 1, 2]) {
assert.equal(hiddenCount(wrapper.logSlice(state, { player, start: before }).log), 0);
}
});
test("§13 limitedLog: legal moves and turn drafts work from a player's limited view", () => {
for (let players = 2; players <= 6; players++) {
for (const options of [LIMITED, { ...LIMITED, twoTiles: true, stockSwap: "unlimited" }]) {
const state = initGame(players, options, `view-${players}`);
const random = lcg(players);
for (let i = 0; i < 300 && !state.ended; i++) {
const seat = currentSeat(state)!;
const view = wrapper.stripSecret(state, state.seatOwner[seat]);
assert.deepEqual(legalMoves(view), legalMoves(state), `${players} players, move ${i}`);
const moves = legalMoves(state).filter((move) => move.type !== "announce");
applyMove(state, moves[Math.floor(random() * moves.length)]!, seat);
}
}
}
const state = initGame(3, LIMITED, "draft");
playUntil(state, lcg(5), (s) => s.turn > 9 && s.phase === "place");
const player = wrapper.currentPlayer(state)!;
const view = wrapper.stripSecret(state, player);
const move = legalMoves(view).find((m) => m.type === "place")!;
const result = wrapper.move(state, { type: "turn", from: view.log.length, moves: [move] }, player);
assert.equal(result.log.length > state.log.length || result.tentative !== undefined, true);
});

View file

@ -0,0 +1,38 @@
import type { GameState, LogEntry } from "./types.js";
import { seatsOf } from "./view.js";
/** Setup entries describe options and turn order, not play, so they always stay visible. */
const SETUP: LogEntry["type"][] = ["init", "optionIgnored", "turnOrder"];
/**
* rules.md §13 limitedLog: the first log index `player` may read (undefined for a
* spectator). Players see from the start of their own last turn before the current one, so
* the current turn, including a merger in progress, is always visible. Spectators see as much
* as the active player. The whole log is visible when the option is off or the game is over.
*/
export function logWindowStart(state: GameState, player: number | undefined): number {
if (!state.options.limitedLog || state.ended) {
return 0;
}
const own = player === undefined ? [state.activeSeat] : seatsOf(state, player);
let current = true;
for (let index = state.log.length - 1; index >= 0; index--) {
const entry = state.log[index]!;
if (entry.type !== "turn") {
continue;
}
if (!current && own.includes(entry.seat)) {
return index;
}
current = false;
}
return 0;
}
/** The log as `player` may read it: earlier entries become placeholders, keeping its length. */
export function visibleLog(state: GameState, player: number | undefined): LogEntry[] {
const start = logWindowStart(state, player);
return state.log.map((entry, index) =>
index >= start || SETUP.includes(entry.type) ? structuredClone(entry) : { type: "hidden" }
);
}

View file

@ -11,6 +11,8 @@ export interface GameOptions {
stockSwap?: 3 | 5 | 7 | "unlimited";
/** Omitted when off, like stockSwap. */
twoTiles?: true;
/** Omitted when off, like stockSwap. */
limitedLog?: true;
}
export interface IgnoredOption {
@ -85,6 +87,9 @@ export function normalizeOptions(
if (raw.twoTiles === true) {
options.twoTiles = true;
}
if (raw.limitedLog === true) {
options.limitedLog = true;
}
return { options, ignored };
}

View file

@ -202,6 +202,8 @@ export function simpleLine(state: GameState, entry: LogEntry): string {
return `${seat(entry.seat)} sold ${entry.shares} ${chainName(entry.chain)} for ${money(entry.proceeds)}`;
case "result":
return `Final cash: ${list(entry.cash.map((cash, s) => `${seat(s)} ${money(cash)}`))}`;
case "hidden":
return "An earlier move (hidden until the game ends)";
}
return "";
}

View file

@ -78,7 +78,9 @@ export type LogEntry =
| { type: "announced"; seat: number }
| { type: "gameEnd"; reason: "announced" | "condition" | "stall" | "dropped" }
| { type: "finalSale"; seat: number; chain: ChainId; shares: number; proceeds: number }
| { type: "result"; cash: number[]; ranks: number[] };
| { type: "result"; cash: number[]; ranks: number[] }
/** Only in a player's view: an entry from before the limitedLog window (rules.md §13). */
| { type: "hidden" };
export interface GameState {
/** Transient response only; toSave never persists this private draft. */

View file

@ -1,4 +1,5 @@
import { CHAIN_IDS } from "./config.js";
import { visibleLog } from "./limited-log.js";
import type { GameState, Shares } from "./types.js";
/** Value sent in place of anything the viewer may not see. */
@ -15,7 +16,8 @@ export function seatsOf(state: GameState, player: number | undefined): number[]
* rules.md §13: the state as `player` may see it (undefined for a spectator). Hidden numbers
* are replaced by HIDDEN so the shape stays the same. Hands and the pool order are always
* private; holdings and cash are private unless publicHoldings is on or the game has ended.
* The seed is removed because it determines the pool order.
* With limitedLog, older log entries are replaced. The seed is removed because it determines
* the pool order.
*/
export function viewFor(state: GameState, player: number | undefined): GameState {
const own = seatsOf(state, player);
@ -25,6 +27,7 @@ export function viewFor(state: GameState, player: number | undefined): GameState
seed: "",
rngCounter: 0,
pool: state.pool.map(() => HIDDEN),
log: visibleLog(state, player),
seats: state.seats.map((seat, index) => {
if (own.includes(index)) {
return structuredClone(seat);

View file

@ -1,9 +1,10 @@
import { applyTurnRequest, earnedTimeIncrements, isTurnRequest } from "./src/turn-draft.js";
import { visibleLog } from "./src/limited-log.js";
import { applyMove, currentSeat, dropPlayerSeats } from "./src/moves.js";
import { replayGame } from "./src/replay.js";
import { playerRankings, playerScores } from "./src/scoring.js";
import { initGame } from "./src/setup.js";
import { simpleLineAt } from "./src/simple.js";
import { simpleLine, simpleLineAt } from "./src/simple.js";
import type { GameState, LogEntry } from "./src/types.js";
import { seatsOf, viewFor } from "./src/view.js";
@ -71,8 +72,9 @@ export interface LogSliceOptions {
end?: number;
}
// Both endpoints are inclusive. The log is public (rules.md §13), so every viewer gets the same
// slice. Each entry gets a `simple` line for BGS's last-move display.
// Both endpoints are inclusive. The log is public (rules.md §13) except with limitedLog, where
// entries before the player's window are placeholders. Each entry gets a `simple` line for
// BGS's last-move display.
export function logSlice(
data: GameState,
options?: LogSliceOptions
@ -82,8 +84,12 @@ export function logSlice(
} {
const start = Math.max(0, options?.start ?? 0);
const end = options?.end ?? data.log.length - 1;
const log = visibleLog(data, options?.player);
return {
log: data.log.slice(start, end + 1).map((entry, i) => ({ ...entry, simple: simpleLineAt(data, start + i) })),
log: log.slice(start, end + 1).map((entry, i) => ({
...entry,
simple: entry.type === "hidden" ? simpleLine(data, entry) : simpleLineAt(data, start + i),
})),
...(data.tentative && data.tentative.player === options?.player
? { preview: stripSecret(data, options.player) }
: {}),

View file

@ -29,7 +29,7 @@ async function loadBuiltViewer(): Promise<typeof import("./viewer").viewer> {
const players = Math.min(6, Math.max(2, Number(params.get("players") ?? 4)));
const seed = params.get("seed") ?? "dev";
const options: Record<string, unknown> = {};
for (const key of ["publicHoldings", "teamPlay", "autoEnd", "twoTiles"]) {
for (const key of ["publicHoldings", "teamPlay", "autoEnd", "twoTiles", "limitedLog"]) {
if (params.get(key) === "1") {
options[key] = true;
}

View file

@ -14,15 +14,24 @@
const t = $derived(store.lang.t);
let showAll = $state(false);
// Newest first; "turn" entries become headings that group the lines below them.
// Newest first; "turn" entries become headings that group the lines below them. With a
// limited log (rules.md §13), each run of entries the engine withheld becomes one note.
const lines = $derived(
game.log
.map((entry, index) => ({
index,
turn: entry.type === "turn",
parts: describeEntryParts(game, entry, store.lang),
hidden: entry.type === "hidden",
parts:
entry.type === "hidden"
? game.log[index - 1]?.type === "hidden"
? undefined
: [{ kind: "text" as const, text: t("log.limited") }]
: describeEntryParts(game, entry, store.lang),
}))
.filter((line): line is { index: number; turn: boolean; parts: LogPart[] } => line.parts !== undefined)
.filter(
(line): line is { index: number; turn: boolean; hidden: boolean; parts: LogPart[] } => line.parts !== undefined
)
.reverse()
);
</script>
@ -31,7 +40,7 @@
<h2>{t("log.title")}</h2>
<ol class="log">
{#each showAll ? lines : lines.slice(0, RECENT) as line (line.index)}
<li class:turn={line.turn}>
<li class:turn={line.turn} class:hidden={line.hidden}>
{#each line.parts as part}
{#if part.kind === "player" || part.kind === "chain"}
{@const color =
@ -72,6 +81,11 @@
font-weight: 600;
background: var(--panel-alt);
}
.log li.hidden {
margin-top: 6px;
color: var(--ink-muted);
font-style: italic;
}
.name,
.money {
font-weight: 600;

View file

@ -210,6 +210,8 @@ export function describeEntry(
});
case "result":
return t("log.result", { results: list(entry.cash.map((cash, s) => `${seat(s)} ${money(cash)}`)) });
case "hidden":
return undefined;
}
}

View file

@ -136,6 +136,7 @@ export const da: Catalog = {
"seat.name": "{name} (plads {seat})",
"log.label": "Spillets log",
"log.title": "Log",
"log.limited": "Tidligere træk er skjult, indtil spillet slutter.",
"log.recent": "Vis kun de seneste linjer",
"log.all": { one: "Vis hele loggen ({count} mere)", other: "Vis hele loggen ({count} mere)" },
"log.init": { one: "Nyt spil for {count} spiller", other: "Nyt spil for {count} spillere" },

View file

@ -136,6 +136,7 @@ export const de: Catalog = {
"seat.name": "{name} (Platz {seat})",
"log.label": "Spielprotokoll",
"log.title": "Protokoll",
"log.limited": "Frühere Züge bleiben bis zum Spielende verborgen.",
"log.recent": "Nur die letzten Zeilen zeigen",
"log.all": { one: "Ganzes Protokoll zeigen ({count} weitere)", other: "Ganzes Protokoll zeigen ({count} weitere)" },
"log.init": { one: "Neues Spiel für {count} Spieler", other: "Neues Spiel für {count} Spieler" },

View file

@ -136,6 +136,7 @@ export const el: Catalog = {
"seat.name": "{name} (θέση {seat})",
"log.label": "Ημερολόγιο παιχνιδιού",
"log.title": "Ημερολόγιο",
"log.limited": "Οι προηγούμενες κινήσεις κρύβονται μέχρι το τέλος του παιχνιδιού.",
"log.recent": "Μόνο οι τελευταίες γραμμές",
"log.all": { one: "Όλο το ημερολόγιο ({count} ακόμη)", other: "Όλο το ημερολόγιο ({count} ακόμη)" },
"log.init": { one: "Νέο παιχνίδι για {count} παίκτη", other: "Νέο παιχνίδι για {count} παίκτες" },

View file

@ -148,6 +148,7 @@ export const en = {
// Log
"log.label": "Game log",
"log.title": "Log",
"log.limited": "Earlier moves are hidden until the game ends.",
"log.recent": "Show recent lines only",
"log.all": { one: "Show the whole log ({count} more)", other: "Show the whole log ({count} more)" },
"log.init": { one: "New game for {count} player", other: "New game for {count} players" },

View file

@ -135,6 +135,7 @@ export const fa: Catalog = {
"seat.name": "{name} (جایگاه {seat})",
"log.label": "گزارش بازی",
"log.title": "گزارش",
"log.limited": "حرکت‌های قبلی تا پایان بازی پنهان هستند.",
"log.recent": "فقط خط‌های اخیر",
"log.all": { one: "نمایش کل گزارش ({count} خط دیگر)", other: "نمایش کل گزارش ({count} خط دیگر)" },
"log.init": { one: "بازی جدید برای {count} بازیکن", other: "بازی جدید برای {count} بازیکن" },

View file

@ -140,6 +140,7 @@ export const fr: Catalog = {
"seat.name": "{name} (place {seat})",
"log.label": "Journal de la partie",
"log.title": "Journal",
"log.limited": "Les coups précédents sont masqués jusqu'à la fin de la partie.",
"log.recent": "Afficher seulement les dernières lignes",
"log.all": {
one: "Afficher tout le journal ({count} de plus)",

View file

@ -133,6 +133,7 @@ export const hi: Catalog = {
"seat.name": "{name} (सीट {seat})",
"log.label": "खेल का लॉग",
"log.title": "लॉग",
"log.limited": "पिछली चालें खेल समाप्त होने तक छिपी रहती हैं।",
"log.recent": "केवल हाल की पंक्तियाँ दिखाएँ",
"log.all": { one: "पूरा लॉग दिखाएँ ({count} और)", other: "पूरा लॉग दिखाएँ ({count} और)" },
"log.init": { one: "{count} खिलाड़ी के लिए नया खेल", other: "{count} खिलाड़ियों के लिए नया खेल" },

View file

@ -141,6 +141,7 @@ export const it: Catalog = {
"seat.name": "{name} (posto {seat})",
"log.label": "Registro della partita",
"log.title": "Registro",
"log.limited": "Le mosse precedenti restano nascoste fino alla fine della partita.",
"log.recent": "Mostra solo le righe recenti",
"log.all": {
one: "Mostra tutto il registro (altre {count})",

View file

@ -135,6 +135,7 @@ export const ko: Catalog = {
"seat.name": "{name} ({seat}번 자리)",
"log.label": "게임 기록",
"log.title": "기록",
"log.limited": "이전 수는 게임이 끝날 때까지 숨겨집니다.",
"log.recent": "최근 줄만 보기",
"log.all": { other: "전체 기록 보기 ({count}줄 더)" },
"log.init": { other: "{count}인 새 게임" },

View file

@ -136,6 +136,7 @@ export const nl: Catalog = {
"seat.name": "{name} (plaats {seat})",
"log.label": "Spelverslag",
"log.title": "Verslag",
"log.limited": "Eerdere zetten blijven verborgen tot het einde van het spel.",
"log.recent": "Alleen recente regels tonen",
"log.all": { one: "Hele verslag tonen (nog {count})", other: "Hele verslag tonen (nog {count})" },
"log.init": { one: "Nieuw spel voor {count} speler", other: "Nieuw spel voor {count} spelers" },

View file

@ -140,6 +140,7 @@ export const pl: Catalog = {
"seat.name": "{name} (miejsce {seat})",
"log.label": "Dziennik gry",
"log.title": "Dziennik",
"log.limited": "Wcześniejsze ruchy są ukryte do końca gry.",
"log.recent": "Pokaż tylko ostatnie wpisy",
"log.all": {
one: "Pokaż cały dziennik (jeszcze {count})",

View file

@ -140,6 +140,7 @@ export const ptBR: Catalog = {
"seat.name": "{name} (lugar {seat})",
"log.label": "Registro do jogo",
"log.title": "Registro",
"log.limited": "As jogadas anteriores ficam ocultas até o fim da partida.",
"log.recent": "Mostrar só as linhas recentes",
"log.all": {
one: "Mostrar o registro inteiro (mais {count})",

View file

@ -140,6 +140,7 @@ export const ro: Catalog = {
"seat.name": "{name} (locul {seat})",
"log.label": "Jurnalul jocului",
"log.title": "Jurnal",
"log.limited": "Mutările anterioare sunt ascunse până la sfârșitul jocului.",
"log.recent": "Arată doar ultimele rânduri",
"log.all": {
one: "Arată tot jurnalul (încă {count})",

View file

@ -140,6 +140,7 @@ export const ru: Catalog = {
"seat.name": "{name} (место {seat})",
"log.label": "Журнал игры",
"log.title": "Журнал",
"log.limited": "Предыдущие ходы скрыты до конца игры.",
"log.recent": "Показать только последние строки",
"log.all": {
one: "Показать весь журнал (ещё {count})",

View file

@ -136,6 +136,7 @@ export const vi: Catalog = {
"seat.name": "{name} (ghế {seat})",
"log.label": "Nhật ký ván chơi",
"log.title": "Nhật ký",
"log.limited": "Các nước đi trước bị ẩn cho đến khi ván chơi kết thúc.",
"log.recent": "Chỉ hiện các dòng gần đây",
"log.all": { other: "Hiện toàn bộ nhật ký (thêm {count})" },
"log.init": { other: "Ván mới cho {count} người chơi" },

View file

@ -133,6 +133,7 @@ export const zhCN: Catalog = {
"seat.name": "{name}(座位 {seat})",
"log.label": "游戏记录",
"log.title": "记录",
"log.limited": "更早的行动在游戏结束前隐藏。",
"log.recent": "只显示最近几行",
"log.all": { other: "显示全部记录(还有 {count} 行)" },
"log.init": { other: "{count} 人新游戏" },

View file

@ -133,6 +133,7 @@ export const zhTW: Catalog = {
"seat.name": "{name}(座位 {seat})",
"log.label": "遊戲紀錄",
"log.title": "紀錄",
"log.limited": "更早的行動在遊戲結束前隱藏。",
"log.recent": "只顯示最近幾行",
"log.all": { other: "顯示全部紀錄(還有 {count} 行)" },
"log.init": { other: "{count} 人新遊戲" },

View file

@ -107,9 +107,13 @@ export class ViewerStore {
}
}
/** With a limited log (rules.md §13), replay waits until the game ends and the log is whole. */
replayable = $derived(!this.state?.log.some((entry) => entry.type === "hidden"));
/** The replay range BGS shows in its controls: setup done, up to the live position. */
replayRange(): { start: number; end: number } {
return { start: replayStart(this.state!), end: this.state!.log.length };
const end = this.state!.log.length;
return { start: this.replayable ? replayStart(this.state!) : end, end };
}
send(move: Move): void {

View file

@ -50,15 +50,19 @@ export const viewer = registerViewer<GameState, Move | TurnRequest>(
store.theme = dark ? "dark" : "light";
},
onReplayStart() {
sounds.onReplayStart();
const { start, end } = store.replayRange();
store.replayAt = end;
if (store.replayable) {
sounds.onReplayStart();
store.replayAt = end;
}
setReplayInfo({ start, current: end, end });
},
onReplayTo(index) {
const { start, end } = store.replayRange();
store.replayAt = Math.min(end, Math.max(start, index));
setReplayInfo({ start, current: store.replayAt, end });
if (store.replayable) {
store.replayAt = Math.min(end, Math.max(start, index));
}
setReplayInfo({ start, current: store.replayAt ?? end, end });
},
onReplayEnd() {
sounds.onReplayEnd();

View file

@ -331,10 +331,16 @@ Each viewer must only receive information their player is entitled to.
- **[DECISION] Game option `publicHoldings` (default: `false`):** When off, each player's
current share holdings and cash are visible only to that player. When on, they are
public.
- **[DECISION] The game log is always public.** It records every action: tile
placements, stock purchases, bonuses paid, and each player's disposal choices. Only
the *current* holdings and cash are hidden, even though they can be reconstructed
from the log.
- **[DECISION] The game log is public** unless `limitedLog` is on (below). It records
every action: tile placements, stock purchases, bonuses paid, and each player's disposal
choices. Only the *current* holdings and cash are hidden, even though they can be
reconstructed from the log.
- **Game option `limitedLog` (default: `false`):** each player sees only the log from the
start of their own last turn before the current one, so the current turn, including a
merger in progress, is always shown. Spectators see as much as the active player.
Setup entries (options, turn order) stay visible. Earlier entries are replaced by
placeholders, keeping the log's length. The whole log is revealed when the game ends,
and replay is only available after that.
- **[DECISION] Scores during play:** When `publicHoldings` is off, every player's score
is 0 until the game ends. When it is on, the score is projected net worth: cash,
current share sale values and majority/minority bonuses at current holdings (including
@ -376,6 +382,7 @@ 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. |
| `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. |
| `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. |
**[DECISION]** Invalid combinations are never rejected. An option that does not apply to