Merge holdings visibility levels and shared limited-log window
# Conflicts: # docs/admin/rules.md # packages/engine/src/options.spec.ts # packages/viewer/src/dev.ts # rules.md
This commit is contained in:
commit
2ddf04aa88
43 changed files with 576 additions and 128 deletions
|
|
@ -56,7 +56,8 @@ Use Node 24 and pnpm 11. Inspect the working tree before editing and preserve un
|
||||||
after all merger resolution. Keep the default Off.
|
after all merger resolution. Keep the default Off.
|
||||||
- Two tiles per turn and limited game log are optional, default Off. Two-tile turns retain
|
- Two tiles per turn and limited game log are optional, default Off. Two-tile turns retain
|
||||||
private undo and one turn increment. Limited logs must filter both entries and BGS summaries;
|
private undo and one turn increment. Limited logs must filter both entries and BGS summaries;
|
||||||
four-hands spectators use the active player's window. Replay unlocks at game end.
|
every viewer sees the same window (current turn plus the previous round, one turn per seat).
|
||||||
|
Replay unlocks at game end.
|
||||||
|
|
||||||
## Setup options and player preferences
|
## Setup options and player preferences
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ as each player sees it. With hot seat on, it switches to whoever must act, so on
|
||||||
play every seat. The toolbar plays random moves, jumps to the next merger, and switches
|
play every seat. The toolbar plays random moves, jumps to the next merger, and switches
|
||||||
player, theme and language.
|
player, theme and language.
|
||||||
|
|
||||||
URL parameters: `players=2..6`, `seed=...`, `publicHoldings=1`, `teamPlay=1`, `autoEnd=1`,
|
URL parameters: `players=2..6`, `seed=...`, `holdingsVisibility=cash` (or `cashAndShareCount`, `public`; legacy `publicHoldings=1`), `teamPlay=1`, `autoEnd=1`,
|
||||||
`endSize=31`, `twoPlayerMode=fourHands`, `stockSwap=3` (or `5`, `7`, `unlimited`), `twoTiles=1`, `limitedLog=1`, `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).
|
moves on load), `merger=1` (continue to the next merger).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,28 @@
|
||||||
],
|
],
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"name": "publicHoldings",
|
"name": "holdingsVisibility",
|
||||||
"label": "Public holdings (everyone sees all stock and cash)",
|
"label": "What players see of each other's cash and stock",
|
||||||
"type": "checkbox",
|
"type": "select",
|
||||||
"default": false
|
"default": "private",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "private",
|
||||||
|
"label": "Private (standard)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cash",
|
||||||
|
"label": "Cash only"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cashAndShareCount",
|
||||||
|
"label": "Cash and total share count"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "public",
|
||||||
|
"label": "Everything (public holdings)"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "teamPlay",
|
"name": "teamPlay",
|
||||||
|
|
|
||||||
|
|
@ -136,22 +136,28 @@ With two players, the bank also acts as a shareholder whenever bonuses are paid.
|
||||||
|
|
||||||
## What you can see
|
## 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 public (unless the game uses a limited game log, below), so a careful player can work them out.
|
Your tiles are private. By default, 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. The game's creator can make more visible:
|
||||||
|
|
||||||
|
- **Cash only:** everyone's exact cash is shown.
|
||||||
|
- **Cash and total share count:** everyone's exact cash and how many shares they hold in total are shown, but not which chains they are in.
|
||||||
|
- **Everything (public holdings):** everyone's cash and shares are shown, along with an estimated net worth.
|
||||||
|
|
||||||
|
Everything is shown once the game ends.
|
||||||
|
|
||||||
### Limited game log
|
### 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.
|
Much of Acquire is remembering who bought what. If the game uses **Limited game log**, the log only shows the current turn and the full round of turns before it: one turn for each seat, so you always see what every other player did since your last turn. Everyone, including spectators, sees the same part of the log. A merger in progress is always shown in full. 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.
|
Because replaying the game would show the full history, replay is only available after the game ends when this setting is on.
|
||||||
|
|
||||||
## Game options
|
## Game options
|
||||||
|
|
||||||
- **Limited game log:** the log shows only what happened since your last turn, until the game ends (see above).
|
- **Limited game log:** the log shows only the current turn and the round before it, until the game ends (see above).
|
||||||
- **Two tiles per turn:** 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.
|
- **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.
|
- **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).
|
- **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.
|
- **What players see of each other's cash and stock:** private (standard), cash only, cash and total share count, or everything (see above).
|
||||||
- **Team play** (4 players only): seats 1 and 3 play against seats 2 and 4; each team's money is added together at the end.
|
- **Team play** (4 players only): seats 1 and 3 play against seats 2 and 4; each team's money is added together at the end.
|
||||||
- **Two-player mode:** *Bank as third shareholder* (above) or *Four hands*, where each player controls two seats in a normal four-seat game and the player with the single richest seat wins.
|
- **Two-player mode:** *Bank as third shareholder* (above) or *Four hands*, where each player controls two seats in a normal four-seat game and the player with the single richest seat wins.
|
||||||
- **End automatically when an end condition is met:** the game ends at the end of that turn, with no announcement.
|
- **End automatically when an end condition is met:** the game ends at the end of that turn, with no announcement.
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ do not replace other declarations from an old local snapshot.
|
||||||
|
|
||||||
Current declaration sources are in [admin/gameinfo.json](admin/gameinfo.json):
|
Current declaration sources are in [admin/gameinfo.json](admin/gameinfo.json):
|
||||||
|
|
||||||
- Setup options include public holdings, team play, two-player mode, automatic ending, end size,
|
- Setup options include holdings visibility (private / cash / cash and share count / public), team play, two-player mode, automatic ending, end size,
|
||||||
**Shares per turn: 3 (standard) / 4 / 5**, **Stock swap: Off / 3 / 5 / 7 / Unlimited**,
|
**Shares per turn: 3 (standard) / 4 / 5**, **Stock swap: Off / 3 / 5 / 7 / Unlimited**,
|
||||||
two tiles per turn and limited game log.
|
two tiles per turn and limited game log.
|
||||||
Stock swaps, two tiles per turn and limited logs default Off.
|
Stock swaps, two tiles per turn and limited logs default Off.
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { parseTile } from "./tiles.js";
|
||||||
import { chainAt, scenario } from "./test/helpers.js";
|
import { chainAt, scenario } from "./test/helpers.js";
|
||||||
import type { GameState, LogEntry } from "./types.js";
|
import type { GameState, LogEntry } from "./types.js";
|
||||||
import { simpleLine } from "./simple.js";
|
import { simpleLine } from "./simple.js";
|
||||||
import { HIDDEN, seatsOf } from "./view.js";
|
import { HIDDEN, seatsOf, visibilityNow } from "./view.js";
|
||||||
import * as wrapper from "../wrapper.js";
|
import * as wrapper from "../wrapper.js";
|
||||||
|
|
||||||
const OPTION_SETS: Record<string, unknown>[] = [
|
const OPTION_SETS: Record<string, unknown>[] = [
|
||||||
|
|
@ -17,8 +17,14 @@ const OPTION_SETS: Record<string, unknown>[] = [
|
||||||
{ teamPlay: true },
|
{ teamPlay: true },
|
||||||
{ twoPlayerMode: "fourHands" },
|
{ twoPlayerMode: "fourHands" },
|
||||||
{ twoPlayerMode: "fourHands", publicHoldings: true },
|
{ twoPlayerMode: "fourHands", publicHoldings: true },
|
||||||
|
{ holdingsVisibility: "cash" },
|
||||||
|
{ holdingsVisibility: "cashAndShareCount" },
|
||||||
|
{ holdingsVisibility: "cashAndShareCount", teamPlay: true },
|
||||||
|
{ holdingsVisibility: "cashAndShareCount", twoPlayerMode: "fourHands" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const totalShares = (shares: Record<string, number>) => Object.values(shares).reduce((sum, count) => sum + count, 0);
|
||||||
|
|
||||||
function lcg(seed: number): () => number {
|
function lcg(seed: number): () => number {
|
||||||
let s = seed >>> 0;
|
let s = seed >>> 0;
|
||||||
return () => {
|
return () => {
|
||||||
|
|
@ -61,21 +67,24 @@ function viewers(state: GameState): (number | undefined)[] {
|
||||||
/** The state with every field the viewer may not see replaced by a fixed marker, for comparison. */
|
/** The state with every field the viewer may not see replaced by a fixed marker, for comparison. */
|
||||||
function withoutSecrets(state: GameState, player: number | undefined): unknown {
|
function withoutSecrets(state: GameState, player: number | undefined): unknown {
|
||||||
const own = seatsOf(state, player);
|
const own = seatsOf(state, player);
|
||||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
const level = visibilityNow(state);
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
seed: "",
|
seed: "",
|
||||||
rngCounter: 0,
|
rngCounter: 0,
|
||||||
pool: state.pool.length,
|
pool: state.pool.length,
|
||||||
seats: state.seats.map((seat, index) =>
|
seats: state.seats.map((seat, index) => {
|
||||||
own.includes(index)
|
if (own.includes(index)) {
|
||||||
? seat
|
return seat;
|
||||||
: {
|
}
|
||||||
...seat,
|
const { shareCount: _, ...rest } = seat;
|
||||||
hand: seat.hand.length,
|
return {
|
||||||
...(holdingsPublic ? {} : { cash: "hidden", shares: "hidden" }),
|
...rest,
|
||||||
}
|
hand: seat.hand.length,
|
||||||
),
|
...(level === "private" ? { cash: "hidden" } : {}),
|
||||||
|
...(level === "public" ? {} : { shares: "hidden" }),
|
||||||
|
};
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +100,7 @@ test("§13 each viewer's state hides exactly the private fields and passes every
|
||||||
for (const player of viewers(state)) {
|
for (const player of viewers(state)) {
|
||||||
const view = wrapper.stripSecret(state, player);
|
const view = wrapper.stripSecret(state, player);
|
||||||
const own = seatsOf(state, player);
|
const own = seatsOf(state, player);
|
||||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
const level = visibilityNow(state);
|
||||||
|
|
||||||
assert.equal(view.seed, "", "§13 the seed (which fixes the pool order) is never sent");
|
assert.equal(view.seed, "", "§13 the seed (which fixes the pool order) is never sent");
|
||||||
assert.equal(view.rngCounter, 0);
|
assert.equal(view.rngCounter, 0);
|
||||||
|
|
@ -111,16 +120,24 @@ test("§13 each viewer's state hides exactly the private fields and passes every
|
||||||
seat.hand.every((tile) => tile === HIDDEN),
|
seat.hand.every((tile) => tile === HIDDEN),
|
||||||
"§13 other players' hands are private"
|
"§13 other players' hands are private"
|
||||||
);
|
);
|
||||||
if (holdingsPublic) {
|
if (level === "private") {
|
||||||
assert.equal(seat.cash, state.seats[index]!.cash);
|
assert.equal(seat.cash, HIDDEN, "§13 other players' cash is private");
|
||||||
|
} else {
|
||||||
|
assert.equal(seat.cash, state.seats[index]!.cash, "§13 cash is public above the private level");
|
||||||
|
}
|
||||||
|
if (level === "public") {
|
||||||
assert.deepEqual(seat.shares, state.seats[index]!.shares);
|
assert.deepEqual(seat.shares, state.seats[index]!.shares);
|
||||||
} else {
|
} else {
|
||||||
assert.equal(seat.cash, HIDDEN, "§13 other players' cash is private");
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
CHAIN_IDS.every((chain) => seat.shares[chain] === HIDDEN),
|
CHAIN_IDS.every((chain) => seat.shares[chain] === HIDDEN),
|
||||||
"§13 other players' stock is private"
|
"§13 other players' stock is private"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
assert.equal(
|
||||||
|
seat.shareCount,
|
||||||
|
level === "cashAndShareCount" ? totalShares(state.seats[index]!.shares) : undefined,
|
||||||
|
"§13 only the share-count level adds the total"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const masked = withoutSecrets(view, player) as Record<string, unknown>;
|
const masked = withoutSecrets(view, player) as Record<string, unknown>;
|
||||||
|
|
@ -154,14 +171,25 @@ test("§13 a viewer cannot tell apart games that differ only in what is hidden f
|
||||||
const opponent = variant.seats[other]!;
|
const opponent = variant.seats[other]!;
|
||||||
[opponent.hand[0], variant.pool[0]] = [variant.pool[0]!, opponent.hand[0]!];
|
[opponent.hand[0], variant.pool[0]] = [variant.pool[0]!, opponent.hand[0]!];
|
||||||
}
|
}
|
||||||
if (!state.options.publicHoldings && !state.ended) {
|
const level = visibilityNow(state);
|
||||||
variant.seats.forEach((seat, index) => {
|
variant.seats.forEach((seat, index) => {
|
||||||
if (!own.includes(index)) {
|
if (own.includes(index) || level === "public") {
|
||||||
seat.cash += 100;
|
return;
|
||||||
seat.shares.tower += 1;
|
}
|
||||||
|
if (level === "private") {
|
||||||
|
seat.cash += 100;
|
||||||
|
}
|
||||||
|
if (level === "cashAndShareCount") {
|
||||||
|
// Only the split between chains is hidden: move one share elsewhere.
|
||||||
|
const from = CHAIN_IDS.find((chain) => seat.shares[chain] > 0);
|
||||||
|
if (from) {
|
||||||
|
seat.shares[from] -= 1;
|
||||||
|
seat.shares[from === "tower" ? "luxor" : "tower"] += 1;
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
}
|
seat.shares.tower += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
JSON.stringify(wrapper.stripSecret(variant, player)),
|
JSON.stringify(wrapper.stripSecret(variant, player)),
|
||||||
JSON.stringify(wrapper.stripSecret(state, player)),
|
JSON.stringify(wrapper.stripSecret(state, player)),
|
||||||
|
|
|
||||||
|
|
@ -44,28 +44,71 @@ test("§15 limitedLog defaults off: every viewer gets the whole log", () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("§13 limitedLog: a player sees the log from the start of their last turn, with setup kept", () => {
|
/** Index of the `count`-th last turn entry (1 = the current turn). */
|
||||||
|
function nthLastTurn(state: GameState, count: number): number {
|
||||||
|
return state.log.flatMap((entry, index) => (entry.type === "turn" ? [index] : [])).at(-count)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
test("§13 limitedLog: everyone sees the current turn and the full round before it, with setup kept", () => {
|
||||||
const state = initGame(4, LIMITED, "window");
|
const state = initGame(4, LIMITED, "window");
|
||||||
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
||||||
const active = state.activeSeat;
|
const start = nthLastTurn(state, 5);
|
||||||
for (let player = 0; player < 4; player++) {
|
assert.equal(logWindowStart(state), start);
|
||||||
|
const spectator = wrapper.stripSecret(state, undefined).log;
|
||||||
|
for (const player of [0, 1, 2, 3]) {
|
||||||
const view = wrapper.stripSecret(state, player);
|
const view = wrapper.stripSecret(state, player);
|
||||||
assert.equal(view.log.length, state.log.length, "the log keeps its length for turn drafts");
|
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) => {
|
view.log.forEach((entry, index) => {
|
||||||
const setup = ["init", "optionIgnored", "turnOrder"].includes(state.log[index]!.type);
|
const setup = ["init", "optionIgnored", "turnOrder"].includes(state.log[index]!.type);
|
||||||
assert.deepEqual(entry, index >= start || setup ? state.log[index] : { type: "hidden" }, `entry ${index}`);
|
assert.deepEqual(entry, index >= start || setup ? state.log[index] : { type: "hidden" }, `entry ${index}`);
|
||||||
});
|
});
|
||||||
|
assert.deepEqual(view.log, spectator, "every seat and spectators see the same window");
|
||||||
assert.ok(hiddenCount(view.log) > 0);
|
assert.ok(hiddenCount(view.log) > 0);
|
||||||
|
// The window always reaches back to the start of your own previous turn.
|
||||||
|
assert.ok(start <= turnIndexes(state, player).at(player === state.activeSeat ? -2 : -1)!);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§13 limitedLog: seat 0 sees the full previous round during seat 1's turn (owner's report)", () => {
|
||||||
|
const state = initGame(4, LIMITED, "first-seat");
|
||||||
|
playUntil(state, lcg(7), (s) => s.turn > 8 && s.activeSeat === 1 && s.phase === "place");
|
||||||
|
const start = nthLastTurn(state, 5);
|
||||||
|
const view = wrapper.stripSecret(state, 0).log;
|
||||||
|
assert.deepEqual(view.slice(start), state.log.slice(start));
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
wrapper.stripSecret(state, undefined).log,
|
state.log.slice(start).flatMap((entry) => (entry.type === "turn" ? [entry.seat] : [])),
|
||||||
wrapper.stripSecret(state, active).log,
|
[1, 2, 3, 0, 1],
|
||||||
"spectators see what the active player sees"
|
"seat 0 sees seats 1, 2 and 3's turns as well as its own"
|
||||||
);
|
);
|
||||||
|
assert.ok(start < turnIndexes(state, 0).at(-1)!, "the old rule started at seat 0's own turn, hiding the others");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§13 limitedLog: four-hands uses all four seats for the round, for players and spectators", () => {
|
||||||
|
const state = initGame(2, { ...LIMITED, twoPlayerMode: "fourHands" }, "four-hands-window");
|
||||||
|
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
||||||
|
assert.equal(logWindowStart(state), nthLastTurn(state, 5));
|
||||||
|
assert.deepEqual(wrapper.stripSecret(state).log, wrapper.stripSecret(state, 0).log);
|
||||||
|
assert.deepEqual(wrapper.stripSecret(state, 1).log, wrapper.stripSecret(state, 0).log);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§13 limitedLog: the window is never shorter than the old one from your own last turn", () => {
|
||||||
|
for (let players = 2; players <= 6; players++) {
|
||||||
|
for (const options of [LIMITED, { ...LIMITED, twoPlayerMode: "fourHands" }]) {
|
||||||
|
const state = initGame(players, options, `never-less-${players}`);
|
||||||
|
const random = lcg(players * 13);
|
||||||
|
while (!state.ended) {
|
||||||
|
const start = logWindowStart(state);
|
||||||
|
for (let seat = 0; seat < state.seats.length; seat++) {
|
||||||
|
const own = turnIndexes(state, seat).filter((index) => index < nthLastTurn(state, 1));
|
||||||
|
if (own.length > 0) {
|
||||||
|
assert.ok(start <= own.at(-1)!, `${players} players, seat ${seat}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const moves = legalMoves(state).filter((move) => move.type !== "announce");
|
||||||
|
applyMove(state, moves[Math.floor(random() * moves.length)]!, currentSeat(state)!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("§13 limitedLog: a merger in progress stays fully visible to every disposer", () => {
|
test("§13 limitedLog: a merger in progress stays fully visible to every disposer", () => {
|
||||||
|
|
@ -88,8 +131,8 @@ test("§13 limitedLog: a merger in progress stays fully visible to every dispose
|
||||||
test("§13 limitedLog: visible turn summaries cannot reveal an earlier hidden turn", () => {
|
test("§13 limitedLog: visible turn summaries cannot reveal an earlier hidden turn", () => {
|
||||||
const state = initGame(4, LIMITED, "summary-window");
|
const state = initGame(4, LIMITED, "summary-window");
|
||||||
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
||||||
|
const start = logWindowStart(state);
|
||||||
for (const player of [0, 1, 2, 3, undefined]) {
|
for (const player of [0, 1, 2, 3, undefined]) {
|
||||||
const start = logWindowStart(state, player);
|
|
||||||
assert.ok(start > 0);
|
assert.ok(start > 0);
|
||||||
const view = wrapper.stripSecret(state, player);
|
const view = wrapper.stripSecret(state, player);
|
||||||
assert.equal(view.log[start - 1]!.type, "hidden");
|
assert.equal(view.log[start - 1]!.type, "hidden");
|
||||||
|
|
@ -98,13 +141,6 @@ test("§13 limitedLog: visible turn summaries cannot reveal an earlier hidden tu
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("§13 limitedLog: four-hands spectators use both seats of the active player", () => {
|
|
||||||
const state = initGame(2, { ...LIMITED, twoPlayerMode: "fourHands" }, "spectator-window");
|
|
||||||
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
|
||||||
const owner = state.seatOwner[state.activeSeat]!;
|
|
||||||
assert.deepEqual(wrapper.stripSecret(state).log, wrapper.stripSecret(state, owner).log);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("§13 limitedLog: the whole log is revealed once the game ends", () => {
|
test("§13 limitedLog: the whole log is revealed once the game ends", () => {
|
||||||
const state = initGame(3, LIMITED, "revealed");
|
const state = initGame(3, LIMITED, "revealed");
|
||||||
playUntil(state, lcg(3));
|
playUntil(state, lcg(3));
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,31 @@
|
||||||
import type { GameState, LogEntry } from "./types.js";
|
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. */
|
/** Setup entries describe options and turn order, not play, so they always stay visible. */
|
||||||
const SETUP: LogEntry["type"][] = ["init", "optionIgnored", "turnOrder"];
|
const SETUP: LogEntry["type"][] = ["init", "optionIgnored", "turnOrder"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rules.md §13 limitedLog: the first log index `player` may read (undefined for a
|
* rules.md §13 limitedLog: the first log index anyone may read. Every player and spectator
|
||||||
* spectator). Players see from the start of their own last turn before the current one, so
|
* sees the same window: the current turn, including a merger in progress, and the full round
|
||||||
* the current turn, including a merger in progress, is always visible. Spectators see as much
|
* of turns before it (one turn per seat, so four in fourHands). It always reaches back at least
|
||||||
* as the active player. The whole log is visible when the option is off or the game is over.
|
* to the start of each player's own previous turn, wherever they sit. The whole log is visible
|
||||||
|
* when the option is off or the game is over.
|
||||||
*/
|
*/
|
||||||
export function logWindowStart(state: GameState, player: number | undefined): number {
|
export function logWindowStart(state: GameState): number {
|
||||||
if (!state.options.limitedLog || state.ended) {
|
if (!state.options.limitedLog || state.ended) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const own = seatsOf(state, player ?? state.seatOwner[state.activeSeat]);
|
let turns = 0;
|
||||||
let current = true;
|
|
||||||
for (let index = state.log.length - 1; index >= 0; index--) {
|
for (let index = state.log.length - 1; index >= 0; index--) {
|
||||||
const entry = state.log[index]!;
|
if (state.log[index]!.type === "turn" && ++turns > state.seats.length) {
|
||||||
if (entry.type !== "turn") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!current && own.includes(entry.seat)) {
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
current = false;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The log as `player` may read it: earlier entries become placeholders, keeping its length. */
|
/** The log as anyone may read it: earlier entries become placeholders, keeping its length. */
|
||||||
export function visibleLog(state: GameState, player: number | undefined): LogEntry[] {
|
export function visibleLog(state: GameState): LogEntry[] {
|
||||||
const start = logWindowStart(state, player);
|
const start = logWindowStart(state);
|
||||||
return state.log.map((entry, index) =>
|
return state.log.map((entry, index) =>
|
||||||
index >= start || SETUP.includes(entry.type) ? structuredClone(entry) : { type: "hidden" }
|
index >= start || SETUP.includes(entry.type) ? structuredClone(entry) : { type: "hidden" }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,21 @@ test("private or masked holdings cannot reveal net worth through helpers or publ
|
||||||
assert.deepEqual(total(state), [6000, 6000, 6000], "inactive shares have no liquidation value");
|
assert.deepEqual(total(state), [6000, 6000, 6000], "inactive shares have no liquidation value");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("§13 the cash and share-count levels show no net worth or scores during play", () => {
|
||||||
|
for (const holdingsVisibility of ["cash", "cashAndShareCount"]) {
|
||||||
|
const state = scenario({
|
||||||
|
board: chainAt("tower", ["1A", "2A"]),
|
||||||
|
shares: [{ tower: 5 }, { tower: 2 }],
|
||||||
|
hands: [["12I"], ["11I"], ["10I"]],
|
||||||
|
options: { holdingsVisibility },
|
||||||
|
});
|
||||||
|
assert.equal(projectedNetWorth(state), undefined, holdingsVisibility);
|
||||||
|
assert.equal(projectedNetWorth(wrapper.stripSecret(state, 0)), undefined);
|
||||||
|
assert.equal(projectedNetWorth(wrapper.stripSecret(state)), undefined);
|
||||||
|
assert.deepEqual(wrapper.scores(state), [0, 0, 0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("bank-mode forecasts omit uncertain bonuses and are independent of secret hands and draws", () => {
|
test("bank-mode forecasts omit uncertain bonuses and are independent of secret hands and draws", () => {
|
||||||
const state = scenario({
|
const state = scenario({
|
||||||
seats: 2,
|
seats: 2,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ export interface NetWorth {
|
||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Public liquidation estimate, without inspecting hands, future draws or random state. */
|
/**
|
||||||
|
* Public liquidation estimate, without inspecting hands, future draws or random state. It needs
|
||||||
|
* per-chain holdings, so it exists only with fully public holdings or after the game.
|
||||||
|
*/
|
||||||
export function projectedNetWorth(state: GameState): NetWorth[] | undefined {
|
export function projectedNetWorth(state: GameState): NetWorth[] | undefined {
|
||||||
if (!state.ended && !state.options.publicHoldings) {
|
if (!state.ended && !state.options.publicHoldings) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,14 @@ import assert from "node:assert/strict";
|
||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import { endConditionHolds } from "./board.js";
|
import { endConditionHolds } from "./board.js";
|
||||||
import { applyMove } from "./moves.js";
|
import { applyMove } from "./moves.js";
|
||||||
import { DEFAULT_OPTIONS, handSize, normalizeOptions } from "./options.js";
|
import { legalMoves } from "./legal.js";
|
||||||
|
import {
|
||||||
|
DEFAULT_OPTIONS,
|
||||||
|
PUBLIC_HOLDINGS_OVERRIDE,
|
||||||
|
handSize,
|
||||||
|
holdingsVisibility,
|
||||||
|
normalizeOptions,
|
||||||
|
} from "./options.js";
|
||||||
import { sharePrice } from "./prices.js";
|
import { sharePrice } from "./prices.js";
|
||||||
import { initGame } from "./setup.js";
|
import { initGame } from "./setup.js";
|
||||||
import { chainAt, checkInvariants, row, scenario } from "./test/helpers.js";
|
import { chainAt, checkInvariants, row, scenario } from "./test/helpers.js";
|
||||||
|
|
@ -245,3 +252,122 @@ test("§15 publicHoldings: everyone's cash and stock are visible, hands are not"
|
||||||
assert.equal(view.seats[1]!.shares.tower, 2);
|
assert.equal(view.seats[1]!.shares.tower, 2);
|
||||||
assert.deepEqual(view.seats[1]!.hand, [-1]);
|
assert.deepEqual(view.seats[1]!.hand, [-1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("§15 holdingsVisibility: missing and private keep the historical options, intermediate levels are stored", () => {
|
||||||
|
const normalized = (raw: Record<string, unknown>) => normalizeOptions(3, raw);
|
||||||
|
for (const raw of [{}, { holdingsVisibility: "private" }]) {
|
||||||
|
assert.deepEqual(normalized(raw), { options: DEFAULT_OPTIONS, ignored: [] });
|
||||||
|
}
|
||||||
|
for (const level of ["cash", "cashAndShareCount"] as const) {
|
||||||
|
const { options, ignored } = normalized({ holdingsVisibility: level });
|
||||||
|
assert.deepEqual(options, { ...DEFAULT_OPTIONS, holdingsVisibility: level });
|
||||||
|
assert.deepEqual(ignored, []);
|
||||||
|
assert.equal(holdingsVisibility(options), level);
|
||||||
|
}
|
||||||
|
// Full public is stored exactly as the legacy checkbox stores it.
|
||||||
|
const legacy = normalized({ publicHoldings: true });
|
||||||
|
assert.deepEqual(legacy, { options: { ...DEFAULT_OPTIONS, publicHoldings: true }, ignored: [] });
|
||||||
|
assert.deepEqual(normalized({ holdingsVisibility: "public" }), legacy);
|
||||||
|
assert.equal(holdingsVisibility(legacy.options), "public");
|
||||||
|
assert.equal(holdingsVisibility(DEFAULT_OPTIONS), "private");
|
||||||
|
assert.equal("holdingsVisibility" in initGame(3, { publicHoldings: true }, "legacy").options, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§15 holdingsVisibility: invalid values are ignored and logged, falling back to the checkbox", () => {
|
||||||
|
for (const value of ["everything", "Cash", true, 2, null]) {
|
||||||
|
const { options, ignored } = normalizeOptions(3, { holdingsVisibility: value });
|
||||||
|
assert.deepEqual(options, DEFAULT_OPTIONS);
|
||||||
|
assert.deepEqual(ignored, [{ option: "holdingsVisibility", value, reason: "unknown value" }]);
|
||||||
|
assert.equal(normalizeOptions(3, { holdingsVisibility: value, publicHoldings: true }).options.publicHoldings, true);
|
||||||
|
}
|
||||||
|
assert.equal(normalizeOptions(3, { publicHoldings: "true" }).options.publicHoldings, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§15 holdingsVisibility: the legacy publicHoldings checkbox wins, and only a real conflict is logged", () => {
|
||||||
|
for (const level of ["private", "public"]) {
|
||||||
|
assert.deepEqual(normalizeOptions(3, { publicHoldings: true, holdingsVisibility: level }), {
|
||||||
|
options: { ...DEFAULT_OPTIONS, publicHoldings: true },
|
||||||
|
ignored: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (const level of ["cash", "cashAndShareCount"]) {
|
||||||
|
const state = initGame(3, { publicHoldings: true, holdingsVisibility: level }, "conflict");
|
||||||
|
assert.deepEqual(state.options, { ...DEFAULT_OPTIONS, publicHoldings: true });
|
||||||
|
assert.deepEqual(ignoredLog(state), [
|
||||||
|
{ type: "optionIgnored", option: "holdingsVisibility", value: level, reason: PUBLIC_HOLDINGS_OVERRIDE },
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§13 holdingsVisibility cash: opponents' exact cash is visible, their stock is not", () => {
|
||||||
|
const state = scenario({
|
||||||
|
board: chainAt("tower", ["1A", "2A"]),
|
||||||
|
hands: [["9G"], ["9I"], ["11I"]],
|
||||||
|
shares: [{ tower: 1 }, { tower: 2, luxor: 3 }],
|
||||||
|
cash: [6000, 4300, 5100],
|
||||||
|
options: { holdingsVisibility: "cash" },
|
||||||
|
});
|
||||||
|
for (const player of [0, undefined]) {
|
||||||
|
const view = wrapper.stripSecret(state, player);
|
||||||
|
assert.equal(view.seats[1]!.cash, 4300);
|
||||||
|
assert.equal(view.seats[2]!.cash, 5100);
|
||||||
|
assert.equal(view.seats[1]!.shares.tower, -1);
|
||||||
|
assert.equal(view.seats[1]!.shares.luxor, -1);
|
||||||
|
assert.equal("shareCount" in view.seats[1]!, false);
|
||||||
|
assert.deepEqual(view.seats[1]!.hand, [-1]);
|
||||||
|
}
|
||||||
|
assert.deepEqual(wrapper.stripSecret(state, 0).seats[0], state.seats[0], "your own seat is complete");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§13 holdingsVisibility cashAndShareCount: exact cash and total shares, never the chains", () => {
|
||||||
|
const state = scenario({
|
||||||
|
board: chainAt("tower", ["1A", "2A"]),
|
||||||
|
hands: [["9G"], ["9I"], ["11I"]],
|
||||||
|
// Kept shares of a chain not on the board still count.
|
||||||
|
shares: [{ tower: 1 }, { tower: 2, luxor: 3 }],
|
||||||
|
cash: [6000, 4300, 5100],
|
||||||
|
options: { holdingsVisibility: "cashAndShareCount" },
|
||||||
|
});
|
||||||
|
for (const player of [0, undefined]) {
|
||||||
|
const view = wrapper.stripSecret(state, player);
|
||||||
|
assert.equal(view.seats[1]!.cash, 4300);
|
||||||
|
assert.equal(view.seats[1]!.shareCount, 5);
|
||||||
|
assert.equal(view.seats[2]!.shareCount, 0);
|
||||||
|
assert.ok(Object.values(view.seats[1]!.shares).every((count) => count === -1));
|
||||||
|
assert.deepEqual(view.seats[1]!.hand, [-1]);
|
||||||
|
}
|
||||||
|
const own = wrapper.stripSecret(state, 0).seats[0]!;
|
||||||
|
assert.deepEqual(own, state.seats[0], "your own seat is complete, without a share count");
|
||||||
|
assert.deepEqual(legalMoves(wrapper.stripSecret(state, 0)), legalMoves(state));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§13 holdingsVisibility: every level reveals everything once the game ends", () => {
|
||||||
|
for (const holdingsVisibility of ["cash", "cashAndShareCount"]) {
|
||||||
|
const state = scenario({
|
||||||
|
board: chainAt("tower", ["1A", "2A", "3A", "4A", "5A", "6A", "7A", "8A", "9A", "10A", "11A"]),
|
||||||
|
hands: [["9G"], ["9I", "12A"], ["11G"]],
|
||||||
|
shares: [{}, { luxor: 3 }],
|
||||||
|
cash: [6000, 4100, 6000],
|
||||||
|
options: { holdingsVisibility },
|
||||||
|
});
|
||||||
|
applyMove(state, { type: "announce" }, 0);
|
||||||
|
applyMove(state, { type: "place", tile: "9G" }, 0);
|
||||||
|
applyMove(state, { type: "buy", shares: {} }, 0);
|
||||||
|
assert.equal(state.ended, true);
|
||||||
|
const seat = wrapper.stripSecret(state, 0).seats[1]!;
|
||||||
|
assert.equal(seat.cash, 4100);
|
||||||
|
assert.equal(seat.shares.luxor, 3);
|
||||||
|
assert.equal("shareCount" in seat, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("§15 holdingsVisibility games replay identically", () => {
|
||||||
|
for (const holdingsVisibility of ["cash", "cashAndShareCount", "public"]) {
|
||||||
|
const state = initGame(4, { holdingsVisibility }, `replay-${holdingsVisibility}`);
|
||||||
|
for (let step = 1; !state.ended && step < 200; step++) {
|
||||||
|
const moves = legalMoves(state).filter((move) => move.type !== "announce");
|
||||||
|
wrapper.move(state, moves[(step * 7919) % moves.length]!, wrapper.currentPlayer(state)!);
|
||||||
|
}
|
||||||
|
assert.deepEqual(wrapper.replay(structuredClone(state)), state);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,13 @@ import { END_SIZE, HAND_SIZE, MAX_BUY, TWO_TILE_HAND_SIZE } from "./config.js";
|
||||||
|
|
||||||
/** rules.md §15, after normalisation against the player count. */
|
/** rules.md §15, after normalisation against the player count. */
|
||||||
export interface GameOptions {
|
export interface GameOptions {
|
||||||
|
/** Full public holdings (rules.md §13), also the highest holdingsVisibility level. */
|
||||||
publicHoldings: boolean;
|
publicHoldings: boolean;
|
||||||
|
/**
|
||||||
|
* Only the intermediate levels are stored: private and public remain publicHoldings
|
||||||
|
* false/true, preserving the init log of games created before this option.
|
||||||
|
*/
|
||||||
|
holdingsVisibility?: "cash" | "cashAndShareCount";
|
||||||
teamPlay: boolean;
|
teamPlay: boolean;
|
||||||
twoPlayerMode: "bank" | "fourHands";
|
twoPlayerMode: "bank" | "fourHands";
|
||||||
autoEnd: boolean;
|
autoEnd: boolean;
|
||||||
|
|
@ -41,6 +47,23 @@ export const DEFAULT_OPTIONS: GameOptions = {
|
||||||
const END_SIZES = [41, 31];
|
const END_SIZES = [41, 31];
|
||||||
const HAND_SIZES = [6, 8, 10, 12, "6", "8", "10", "12"];
|
const HAND_SIZES = [6, 8, 10, 12, "6", "8", "10", "12"];
|
||||||
|
|
||||||
|
/** The optionIgnored reason when the legacy checkbox already makes holdings public. */
|
||||||
|
export const PUBLIC_HOLDINGS_OVERRIDE = "publicHoldings makes all holdings public";
|
||||||
|
|
||||||
|
/** rules.md §13: how much of other players' holdings everyone sees, from least to most. */
|
||||||
|
export const HOLDINGS_VISIBILITY = ["private", "cash", "cashAndShareCount", "public"] as const;
|
||||||
|
export type HoldingsVisibility = (typeof HOLDINGS_VISIBILITY)[number];
|
||||||
|
|
||||||
|
/** The holdings level during play; everything becomes public when the game ends. */
|
||||||
|
export function holdingsVisibility(options: GameOptions): HoldingsVisibility {
|
||||||
|
return options.publicHoldings ? "public" : (options.holdingsVisibility ?? "private");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether exact cash is public, so decisions that depend only on cash may reveal it. */
|
||||||
|
export function cashIsPublic(options: GameOptions): boolean {
|
||||||
|
return holdingsVisibility(options) !== "private";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the creator's options defensively. BGS omits unticked checkboxes and always sends
|
* 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
|
* selects (as strings), so a missing checkbox means false. Options are never rejected
|
||||||
|
|
@ -56,7 +79,25 @@ export function normalizeOptions(
|
||||||
const options: GameOptions = { ...DEFAULT_OPTIONS };
|
const options: GameOptions = { ...DEFAULT_OPTIONS };
|
||||||
const ignored: IgnoredOption[] = [];
|
const ignored: IgnoredOption[] = [];
|
||||||
|
|
||||||
options.publicHoldings = raw.publicHoldings === true;
|
// The legacy publicHoldings checkbox always means full public holdings and wins over the
|
||||||
|
// holdingsVisibility select. Only an intermediate level it overrides is reported: the
|
||||||
|
// select's default "private" is always sent.
|
||||||
|
let visibility: HoldingsVisibility = "private";
|
||||||
|
if (HOLDINGS_VISIBILITY.includes(raw.holdingsVisibility as HoldingsVisibility)) {
|
||||||
|
visibility = raw.holdingsVisibility as HoldingsVisibility;
|
||||||
|
} else if (raw.holdingsVisibility !== undefined) {
|
||||||
|
ignored.push({ option: "holdingsVisibility", value: raw.holdingsVisibility, reason: "unknown value" });
|
||||||
|
}
|
||||||
|
if (raw.publicHoldings === true) {
|
||||||
|
if (visibility === "cash" || visibility === "cashAndShareCount") {
|
||||||
|
ignored.push({ option: "holdingsVisibility", value: visibility, reason: PUBLIC_HOLDINGS_OVERRIDE });
|
||||||
|
}
|
||||||
|
visibility = "public";
|
||||||
|
}
|
||||||
|
options.publicHoldings = visibility === "public";
|
||||||
|
if (visibility === "cash" || visibility === "cashAndShareCount") {
|
||||||
|
options.holdingsVisibility = visibility;
|
||||||
|
}
|
||||||
options.autoEnd = raw.autoEnd === true;
|
options.autoEnd = raw.autoEnd === true;
|
||||||
|
|
||||||
if (raw.teamPlay === true) {
|
if (raw.teamPlay === true) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,10 @@ export function playerRankings(state: GameState): number[] {
|
||||||
return players.map((player) => (hasDropped(state, player) ? lastStayed + 1 : ranks[player]!));
|
return players.map((player) => (hasDropped(state, player) ? lastStayed + 1 : ranks[player]!));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** rules.md §13: scores stay 0 during play while holdings are private. */
|
/**
|
||||||
|
* rules.md §13: scores stay 0 during play unless holdings are fully public. Net worth needs
|
||||||
|
* per-chain holdings, so the cash and share-count levels keep 0 too.
|
||||||
|
*/
|
||||||
export function playerScores(state: GameState): number[] {
|
export function playerScores(state: GameState): number[] {
|
||||||
if (!state.ended && !state.options.publicHoldings) {
|
if (!state.ended && !state.options.publicHoldings) {
|
||||||
return Array.from({ length: state.players }, () => 0);
|
return Array.from({ length: state.players }, () => 0);
|
||||||
|
|
|
||||||
|
|
@ -241,16 +241,18 @@ test("§9.6 with private holdings the buy step is not skipped for lack of cash",
|
||||||
assert.equal(state.activeSeat, 1);
|
assert.equal(state.activeSeat, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("§9.6 with public holdings the buy step is skipped when the player cannot afford any share", () => {
|
test("§9.6 with public cash the buy step is skipped when the player cannot afford any share", () => {
|
||||||
const state = scenario({
|
for (const options of [
|
||||||
board: chainAt("tower", ["1A", "2A"]),
|
{ publicHoldings: true },
|
||||||
hands: [["9G"], ["11G"]],
|
{ holdingsVisibility: "public" },
|
||||||
cash: [100],
|
{ holdingsVisibility: "cash" },
|
||||||
options: { publicHoldings: true },
|
{ holdingsVisibility: "cashAndShareCount" },
|
||||||
});
|
]) {
|
||||||
play(state, 0, place("9G"));
|
const state = scenario({ board: chainAt("tower", ["1A", "2A"]), hands: [["9G"], ["11G"]], cash: [100], options });
|
||||||
assert.equal(state.activeSeat, 1);
|
play(state, 0, place("9G"));
|
||||||
assert.equal(state.phase, "place");
|
assert.equal(state.activeSeat, 1, JSON.stringify(options));
|
||||||
|
assert.equal(state.phase, "place");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("§9.6 the buy step is skipped when no chain is on the board", () => {
|
test("§9.6 the buy step is skipped when no chain is on the board", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { activeChains, chainSize, playableTiles, tileLegality } from "./board.js";
|
import { activeChains, chainSize, playableTiles, tileLegality } from "./board.js";
|
||||||
import { AUTO_TURN_LIMIT } from "./config.js";
|
import { AUTO_TURN_LIMIT } from "./config.js";
|
||||||
import { handSize } from "./options.js";
|
import { cashIsPublic, handSize } from "./options.js";
|
||||||
import { sharePrice } from "./prices.js";
|
import { sharePrice } from "./prices.js";
|
||||||
import { canAnnounce, endConditionMet, endGame } from "./scoring.js";
|
import { canAnnounce, endConditionMet, endGame } from "./scoring.js";
|
||||||
import type { Tile } from "./tiles.js";
|
import type { Tile } from "./tiles.js";
|
||||||
|
|
@ -13,7 +13,7 @@ export function drawTile(state: GameState): Tile | undefined {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rules.md §9.6: whether the buy step has anything to offer. Only public facts count unless
|
* rules.md §9.6: whether the buy step has anything to offer. Only public facts count unless
|
||||||
* holdings are public, so skipping the step never reveals a player's cash.
|
* cash is public (holdings level cash or above), so skipping the step never reveals it.
|
||||||
*/
|
*/
|
||||||
export function buyStepAvailable(state: GameState): boolean {
|
export function buyStepAvailable(state: GameState): boolean {
|
||||||
const seat = state.seats[state.activeSeat]!;
|
const seat = state.seats[state.activeSeat]!;
|
||||||
|
|
@ -23,9 +23,9 @@ export function buyStepAvailable(state: GameState): boolean {
|
||||||
if (state.options.stockSwap && active.length > 1 && active.some((chain) => state.bank[chain] > 0)) {
|
if (state.options.stockSwap && active.length > 1 && active.some((chain) => state.bank[chain] > 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const cashIsPublic = state.options.publicHoldings;
|
const cashKnown = cashIsPublic(state.options);
|
||||||
return activeChains(state.board).some(
|
return activeChains(state.board).some(
|
||||||
(chain) => state.bank[chain] > 0 && (!cashIsPublic || sharePrice(chain, chainSize(state.board, chain)) <= seat.cash)
|
(chain) => state.bank[chain] > 0 && (!cashKnown || sharePrice(chain, chainSize(state.board, chain)) <= seat.cash)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ export interface SeatState {
|
||||||
name: string;
|
name: string;
|
||||||
cash: number;
|
cash: number;
|
||||||
shares: Shares;
|
shares: Shares;
|
||||||
|
/**
|
||||||
|
* Only in a viewer's state at the cashAndShareCount holdings level (rules.md §13): another
|
||||||
|
* seat's total shares across all chains, while `shares` is hidden.
|
||||||
|
*/
|
||||||
|
shareCount?: number;
|
||||||
hand: Tile[];
|
hand: Tile[];
|
||||||
dropped: boolean;
|
dropped: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { CHAIN_IDS } from "./config.js";
|
import { CHAIN_IDS } from "./config.js";
|
||||||
import { visibleLog } from "./limited-log.js";
|
import { visibleLog } from "./limited-log.js";
|
||||||
|
import { holdingsVisibility, type HoldingsVisibility } from "./options.js";
|
||||||
import type { GameState, Shares } from "./types.js";
|
import type { GameState, Shares } from "./types.js";
|
||||||
|
|
||||||
/** Value sent in place of anything the viewer may not see. */
|
/** Value sent in place of anything the viewer may not see. */
|
||||||
|
|
@ -12,22 +13,47 @@ export function seatsOf(state: GameState, player: number | undefined): number[]
|
||||||
return state.seatOwner.flatMap((owner, seat) => (owner === player ? [seat] : []));
|
return state.seatOwner.flatMap((owner, seat) => (owner === player ? [seat] : []));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The holdings level everyone sees now: all of them once the game has ended. */
|
||||||
|
export function visibilityNow(state: GameState): HoldingsVisibility {
|
||||||
|
return state.ended ? "public" : holdingsVisibility(state.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rules.md §13: another seat's cash and shares as shown at `level`. Below public, the
|
||||||
|
* per-chain holdings are hidden; cashAndShareCount adds their total as `shareCount`.
|
||||||
|
*/
|
||||||
|
export function maskHoldings(
|
||||||
|
holdings: { cash: number; shares: Shares },
|
||||||
|
level: HoldingsVisibility
|
||||||
|
): { cash: number; shares: Shares; shareCount?: number } {
|
||||||
|
if (level === "public") {
|
||||||
|
return { cash: holdings.cash, shares: { ...holdings.shares } };
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
cash: level === "private" ? HIDDEN : holdings.cash,
|
||||||
|
shares: { ...HIDDEN_SHARES },
|
||||||
|
...(level === "cashAndShareCount"
|
||||||
|
? { shareCount: Object.values(holdings.shares).reduce((sum, count) => sum + count, 0) }
|
||||||
|
: {}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rules.md §13: the state as `player` may see it (undefined for a spectator). Hidden numbers
|
* 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
|
* 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.
|
* private; other seats' cash and holdings are shown as far as the holdings level allows
|
||||||
* With limitedLog, older log entries are replaced. The seed is removed because it determines
|
* (maskHoldings), and fully once the game has ended. With limitedLog, older log entries are
|
||||||
* the pool order.
|
* replaced. The seed is removed because it determines the pool order.
|
||||||
*/
|
*/
|
||||||
export function viewFor(state: GameState, player: number | undefined): GameState {
|
export function viewFor(state: GameState, player: number | undefined): GameState {
|
||||||
const own = seatsOf(state, player);
|
const own = seatsOf(state, player);
|
||||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
const level = visibilityNow(state);
|
||||||
return {
|
return {
|
||||||
...structuredClone(state),
|
...structuredClone(state),
|
||||||
seed: "",
|
seed: "",
|
||||||
rngCounter: 0,
|
rngCounter: 0,
|
||||||
pool: state.pool.map(() => HIDDEN),
|
pool: state.pool.map(() => HIDDEN),
|
||||||
log: visibleLog(state, player),
|
log: visibleLog(state),
|
||||||
seats: state.seats.map((seat, index) => {
|
seats: state.seats.map((seat, index) => {
|
||||||
if (own.includes(index)) {
|
if (own.includes(index)) {
|
||||||
return structuredClone(seat);
|
return structuredClone(seat);
|
||||||
|
|
@ -35,7 +61,7 @@ export function viewFor(state: GameState, player: number | undefined): GameState
|
||||||
return {
|
return {
|
||||||
...structuredClone(seat),
|
...structuredClone(seat),
|
||||||
hand: seat.hand.map(() => HIDDEN),
|
hand: seat.hand.map(() => HIDDEN),
|
||||||
...(holdingsPublic ? {} : { cash: HIDDEN, shares: { ...HIDDEN_SHARES } }),
|
...maskHoldings(seat, level),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -45,3 +45,22 @@ test("wrapper: setPlayerMetaData stores the player name", () => {
|
||||||
const state = wrapper.setPlayerMetaData(wrapper.init(2, [], {}, "seed"), 1, { name: "Ada" });
|
const state = wrapper.setPlayerMetaData(wrapper.init(2, [], {}, "seed"), 1, { name: "Ada" });
|
||||||
assert.equal(state.seats[1]?.name, "Ada");
|
assert.equal(state.seats[1]?.name, "Ada");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("wrapper: BGS setup values for holdingsVisibility reach stripSecret, and scores stay private", () => {
|
||||||
|
for (const [raw, cash, shareCount] of [
|
||||||
|
[{ holdingsVisibility: "private" }, -1, undefined],
|
||||||
|
[{ holdingsVisibility: "cash" }, 6000, undefined],
|
||||||
|
[{ holdingsVisibility: "cashAndShareCount" }, 6000, 0],
|
||||||
|
] as const) {
|
||||||
|
const state = wrapper.init(3, [], raw, "seed");
|
||||||
|
const opponent = wrapper.stripSecret(state, 0).seats[1]!;
|
||||||
|
assert.equal(opponent.cash, cash, JSON.stringify(raw));
|
||||||
|
assert.equal(opponent.shareCount, shareCount);
|
||||||
|
assert.deepEqual(wrapper.scores(state), [0, 0, 0]);
|
||||||
|
}
|
||||||
|
for (const raw of [{ publicHoldings: true }, { holdingsVisibility: "public" }]) {
|
||||||
|
const state = wrapper.init(3, [], raw, "seed");
|
||||||
|
assert.deepEqual(wrapper.stripSecret(state, 0).seats[1]!.shares, state.seats[1]!.shares);
|
||||||
|
assert.deepEqual(wrapper.scores(state), [6000, 6000, 6000]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ export interface LogSliceOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Both endpoints are inclusive. The log is public (rules.md §13) except with limitedLog, where
|
// 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
|
// entries before the shared window (the current turn and the round before it) are placeholders
|
||||||
// BGS's last-move display.
|
// for every viewer. Each entry gets a `simple` line for BGS's last-move display.
|
||||||
export function logSlice(
|
export function logSlice(
|
||||||
data: GameState,
|
data: GameState,
|
||||||
options?: LogSliceOptions
|
options?: LogSliceOptions
|
||||||
|
|
@ -84,7 +84,7 @@ export function logSlice(
|
||||||
} {
|
} {
|
||||||
const start = Math.max(0, options?.start ?? 0);
|
const start = Math.max(0, options?.start ?? 0);
|
||||||
const end = options?.end ?? data.log.length - 1;
|
const end = options?.end ?? data.log.length - 1;
|
||||||
const log = visibleLog(data, options?.player);
|
const log = visibleLog(data);
|
||||||
// Summaries must use the same filtered history: a visible turn can follow hidden moves.
|
// Summaries must use the same filtered history: a visible turn can follow hidden moves.
|
||||||
const shown = { ...data, log };
|
const shown = { ...data, log };
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Local dev harness (not part of the BGS bundle): runs the real engine in the page, plays
|
// 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.
|
// 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,
|
// 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, twoTiles=1, handSize=12. For reproducible screenshots: moves=N plays N random moves,
|
// holdingsVisibility=cash|cashAndShareCount|public, 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.
|
// merger=1 then plays on to the next merger decision, bar=0 hides this toolbar.
|
||||||
import * as rules from "acquire-engine";
|
import * as rules from "acquire-engine";
|
||||||
import { currentSeat, legalMoves, type GameState } 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;
|
options[key] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const key of ["twoPlayerMode", "endSize", "stockSwap", "sharesPerTurn", "handSize"]) {
|
for (const key of ["holdingsVisibility", "twoPlayerMode", "endSize", "stockSwap", "sharesPerTurn", "handSize"]) {
|
||||||
const value = params.get(key);
|
const value = params.get(key);
|
||||||
if (value) {
|
if (value) {
|
||||||
options[key] = value;
|
options[key] = value;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each state.seats as seat, index (index)}
|
{#each state.seats as seat, index (index)}
|
||||||
{@const held = CHAIN_IDS.filter((chain) => seat.shares[chain] !== 0)}
|
{@const held = CHAIN_IDS.filter((chain) => seat.shares[chain] !== 0)}
|
||||||
{@const hidden = seat.cash === HIDDEN}
|
{@const cashHidden = seat.cash === HIDDEN}
|
||||||
|
{@const sharesHidden = CHAIN_IDS.some((chain) => seat.shares[chain] === HIDDEN)}
|
||||||
<tr class:you={seats.includes(index)}>
|
<tr class:you={seats.includes(index)}>
|
||||||
<td>
|
<td>
|
||||||
{#if index === acting}<span class="turn" aria-label={t("players.acting")}>▶</span>{/if}
|
{#if index === acting}<span class="turn" aria-label={t("players.acting")}>▶</span>{/if}
|
||||||
|
|
@ -47,10 +48,14 @@
|
||||||
><small>{store.lang.money(seat.cash)}</small></td
|
><small>{store.lang.money(seat.cash)}</small></td
|
||||||
>
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<td class="num" class:hidden-value={hidden}>{store.lang.money(seat.cash)}</td>
|
<td class="num" class:hidden-value={cashHidden}>{store.lang.money(seat.cash)}</td>
|
||||||
{/if}
|
{/if}
|
||||||
<td>
|
<td>
|
||||||
{#if hidden}
|
{#if sharesHidden && seat.shareCount !== undefined}
|
||||||
|
<span class="share-count" title={t("players.shareCountHint")}
|
||||||
|
>{t("players.shareCount", { count: seat.shareCount })}</span
|
||||||
|
>
|
||||||
|
{:else if sharesHidden}
|
||||||
<span class="hidden-value">{t("hidden")}</span>
|
<span class="hidden-value">{t("hidden")}</span>
|
||||||
{:else if held.length === 0}
|
{:else if held.length === 0}
|
||||||
<span class="none">{t("players.none")}</span>
|
<span class="none">{t("players.none")}</span>
|
||||||
|
|
@ -149,4 +154,7 @@
|
||||||
.none {
|
.none {
|
||||||
color: var(--ink-muted);
|
color: var(--ink-muted);
|
||||||
}
|
}
|
||||||
|
.share-count {
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -64,3 +64,14 @@ test("player names cannot be mistaken for chain names, markup or formatting toke
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("a holdings level overridden by the legacy publicHoldings checkbox is explained, not called unknown", () => {
|
||||||
|
const state = initGame(3, { publicHoldings: true, holdingsVisibility: "cash" }, "override");
|
||||||
|
const entry = state.log.find((e) => e.type === "optionIgnored")!;
|
||||||
|
assert.equal(
|
||||||
|
describeEntry(state, entry, langFor("en")),
|
||||||
|
"Option holdingsVisibility was ignored: publicHoldings already shows all holdings"
|
||||||
|
);
|
||||||
|
const unknown = initGame(3, { holdingsVisibility: "some" }, "unknown").log.find((e) => e.type === "optionIgnored")!;
|
||||||
|
assert.equal(describeEntry(state, unknown, langFor("en")), "Option holdingsVisibility was ignored: unknown value");
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
CHAINS,
|
CHAINS,
|
||||||
HIDDEN,
|
HIDDEN,
|
||||||
|
PUBLIC_HOLDINGS_OVERRIDE,
|
||||||
currentSeat,
|
currentSeat,
|
||||||
merger,
|
merger,
|
||||||
secondPlacementDue,
|
secondPlacementDue,
|
||||||
|
|
@ -98,6 +99,9 @@ export function describeEntry(
|
||||||
case "init":
|
case "init":
|
||||||
return t("log.init", { count: entry.players });
|
return t("log.init", { count: entry.players });
|
||||||
case "optionIgnored": {
|
case "optionIgnored": {
|
||||||
|
if (entry.reason === PUBLIC_HOLDINGS_OVERRIDE) {
|
||||||
|
return t("log.optionIgnored.publicHoldings", { option: entry.option });
|
||||||
|
}
|
||||||
const count = entry.option === "teamPlay" ? 4 : entry.option === "twoPlayerMode" ? 2 : undefined;
|
const count = entry.option === "teamPlay" ? 4 : entry.option === "twoPlayerMode" ? 2 : undefined;
|
||||||
return count !== undefined && entry.reason.startsWith("only applies")
|
return count !== undefined && entry.reason.startsWith("only applies")
|
||||||
? t("log.optionIgnored.players", { option: entry.option, count })
|
? t("log.optionIgnored.players", { option: entry.option, count })
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,10 @@ export const da: Catalog = {
|
||||||
"players.turn": "tur",
|
"players.turn": "tur",
|
||||||
"players.left": "forladt",
|
"players.left": "forladt",
|
||||||
"players.none": "ingen",
|
"players.none": "ingen",
|
||||||
|
"players.shareCount": { one: "{count} aktie", other: "{count} aktier" },
|
||||||
|
"players.shareCountHint": "I alt på tværs af alle kæder; beholdningen pr. kæde er skjult",
|
||||||
|
"log.optionIgnored.publicHoldings":
|
||||||
|
"Indstillingen {option} blev ignoreret: publicHoldings viser allerede alle beholdninger",
|
||||||
hidden: "skjult",
|
hidden: "skjult",
|
||||||
"seat.name": "{name} (plads {seat})",
|
"seat.name": "{name} (plads {seat})",
|
||||||
"log.label": "Spillets log",
|
"log.label": "Spillets log",
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,10 @@ export const de: Catalog = {
|
||||||
"players.turn": "am Zug",
|
"players.turn": "am Zug",
|
||||||
"players.left": "ausgeschieden",
|
"players.left": "ausgeschieden",
|
||||||
"players.none": "keine",
|
"players.none": "keine",
|
||||||
|
"players.shareCount": { one: "{count} Aktie", other: "{count} Aktien" },
|
||||||
|
"players.shareCountHint": "Summe über alle Ketten; der Besitz je Kette ist verdeckt",
|
||||||
|
"log.optionIgnored.publicHoldings":
|
||||||
|
"Option {option} wurde ignoriert: publicHoldings zeigt bereits den gesamten Besitz",
|
||||||
hidden: "verdeckt",
|
hidden: "verdeckt",
|
||||||
"seat.name": "{name} (Platz {seat})",
|
"seat.name": "{name} (Platz {seat})",
|
||||||
"log.label": "Spielprotokoll",
|
"log.label": "Spielprotokoll",
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,10 @@ export const el: Catalog = {
|
||||||
"players.turn": "σειρά",
|
"players.turn": "σειρά",
|
||||||
"players.left": "αποχώρησε",
|
"players.left": "αποχώρησε",
|
||||||
"players.none": "καμία",
|
"players.none": "καμία",
|
||||||
|
"players.shareCount": { one: "{count} μετοχή", other: "{count} μετοχές" },
|
||||||
|
"players.shareCountHint": "Σύνολο σε όλες τις αλυσίδες· οι μετοχές ανά αλυσίδα είναι κρυφές",
|
||||||
|
"log.optionIgnored.publicHoldings":
|
||||||
|
"Η επιλογή {option} αγνοήθηκε: το publicHoldings δείχνει ήδη όλες τις μετοχές και τα μετρητά",
|
||||||
hidden: "κρυφό",
|
hidden: "κρυφό",
|
||||||
"seat.name": "{name} (θέση {seat})",
|
"seat.name": "{name} (θέση {seat})",
|
||||||
"log.label": "Ημερολόγιο παιχνιδιού",
|
"log.label": "Ημερολόγιο παιχνιδιού",
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,9 @@ export const en = {
|
||||||
"players.turn": "turn",
|
"players.turn": "turn",
|
||||||
"players.left": "left",
|
"players.left": "left",
|
||||||
"players.none": "none",
|
"players.none": "none",
|
||||||
|
"players.shareCount": { one: "{count} share", other: "{count} shares" },
|
||||||
|
"players.shareCountHint": "Total across all chains; holdings per chain are hidden",
|
||||||
|
"log.optionIgnored.publicHoldings": "Option {option} was ignored: publicHoldings already shows all holdings",
|
||||||
hidden: "hidden",
|
hidden: "hidden",
|
||||||
"seat.name": "{name} (seat {seat})",
|
"seat.name": "{name} (seat {seat})",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,10 @@ export const fa: Catalog = {
|
||||||
"players.turn": "نوبت",
|
"players.turn": "نوبت",
|
||||||
"players.left": "رفته",
|
"players.left": "رفته",
|
||||||
"players.none": "هیچ",
|
"players.none": "هیچ",
|
||||||
|
"players.shareCount": { one: "{count} سهم", other: "{count} سهم" },
|
||||||
|
"players.shareCountHint": "مجموع در همهی زنجیرهها؛ سهام هر زنجیره پنهان است",
|
||||||
|
"log.optionIgnored.publicHoldings":
|
||||||
|
"گزینهی {option} نادیده گرفته شد: publicHoldings از قبل همهی داراییها را نشان میدهد",
|
||||||
hidden: "پنهان",
|
hidden: "پنهان",
|
||||||
"seat.name": "{name} (جایگاه {seat})",
|
"seat.name": "{name} (جایگاه {seat})",
|
||||||
"log.label": "گزارش بازی",
|
"log.label": "گزارش بازی",
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,9 @@ export const fr: Catalog = {
|
||||||
"players.turn": "son tour",
|
"players.turn": "son tour",
|
||||||
"players.left": "parti",
|
"players.left": "parti",
|
||||||
"players.none": "aucune",
|
"players.none": "aucune",
|
||||||
|
"players.shareCount": { one: "{count} action", many: "{count} actions", other: "{count} actions" },
|
||||||
|
"players.shareCountHint": "Total sur toutes les chaînes ; le détail par chaîne est caché",
|
||||||
|
"log.optionIgnored.publicHoldings": "L’option {option} a été ignorée : publicHoldings montre déjà tous les avoirs",
|
||||||
hidden: "caché",
|
hidden: "caché",
|
||||||
"seat.name": "{name} (place {seat})",
|
"seat.name": "{name} (place {seat})",
|
||||||
"log.label": "Journal de la partie",
|
"log.label": "Journal de la partie",
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,9 @@ export const hi: Catalog = {
|
||||||
"players.turn": "बारी",
|
"players.turn": "बारी",
|
||||||
"players.left": "छोड़ गए",
|
"players.left": "छोड़ गए",
|
||||||
"players.none": "कोई नहीं",
|
"players.none": "कोई नहीं",
|
||||||
|
"players.shareCount": { one: "{count} शेयर", other: "{count} शेयर" },
|
||||||
|
"players.shareCountHint": "सभी श्रृंखलाओं में कुल; हर श्रृंखला के शेयर छिपे हैं",
|
||||||
|
"log.optionIgnored.publicHoldings": "विकल्प {option} अनदेखा किया गया: publicHoldings पहले से सारी होल्डिंग दिखाता है",
|
||||||
hidden: "छिपा",
|
hidden: "छिपा",
|
||||||
"seat.name": "{name} (सीट {seat})",
|
"seat.name": "{name} (सीट {seat})",
|
||||||
"log.label": "खेल का लॉग",
|
"log.label": "खेल का लॉग",
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,9 @@ export const it: Catalog = {
|
||||||
"players.turn": "turno",
|
"players.turn": "turno",
|
||||||
"players.left": "uscito",
|
"players.left": "uscito",
|
||||||
"players.none": "nessuna",
|
"players.none": "nessuna",
|
||||||
|
"players.shareCount": { one: "{count} azione", many: "{count} azioni", other: "{count} azioni" },
|
||||||
|
"players.shareCountHint": "Totale su tutte le catene; il dettaglio per catena è nascosto",
|
||||||
|
"log.optionIgnored.publicHoldings": "Opzione {option} ignorata: publicHoldings mostra già tutte le partecipazioni",
|
||||||
hidden: "nascosto",
|
hidden: "nascosto",
|
||||||
"seat.name": "{name} (posto {seat})",
|
"seat.name": "{name} (posto {seat})",
|
||||||
"log.label": "Registro della partita",
|
"log.label": "Registro della partita",
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,9 @@ export const ko: Catalog = {
|
||||||
"players.turn": "차례",
|
"players.turn": "차례",
|
||||||
"players.left": "나감",
|
"players.left": "나감",
|
||||||
"players.none": "없음",
|
"players.none": "없음",
|
||||||
|
"players.shareCount": { other: "{count}주" },
|
||||||
|
"players.shareCountHint": "모든 체인의 합계이며, 체인별 보유량은 비공개입니다",
|
||||||
|
"log.optionIgnored.publicHoldings": "{option} 옵션 무시됨: publicHoldings가 이미 모든 보유량을 공개함",
|
||||||
hidden: "비공개",
|
hidden: "비공개",
|
||||||
"seat.name": "{name} ({seat}번 자리)",
|
"seat.name": "{name} ({seat}번 자리)",
|
||||||
"log.label": "게임 기록",
|
"log.label": "게임 기록",
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,9 @@ export const nl: Catalog = {
|
||||||
"players.turn": "beurt",
|
"players.turn": "beurt",
|
||||||
"players.left": "vertrokken",
|
"players.left": "vertrokken",
|
||||||
"players.none": "geen",
|
"players.none": "geen",
|
||||||
|
"players.shareCount": { one: "{count} aandeel", other: "{count} aandelen" },
|
||||||
|
"players.shareCountHint": "Totaal over alle ketens; het bezit per keten is verborgen",
|
||||||
|
"log.optionIgnored.publicHoldings": "Optie {option} genegeerd: publicHoldings toont al het volledige bezit",
|
||||||
hidden: "verborgen",
|
hidden: "verborgen",
|
||||||
"seat.name": "{name} (plaats {seat})",
|
"seat.name": "{name} (plaats {seat})",
|
||||||
"log.label": "Spelverslag",
|
"log.label": "Spelverslag",
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,9 @@ export const pl: Catalog = {
|
||||||
"players.turn": "tura",
|
"players.turn": "tura",
|
||||||
"players.left": "odszedł",
|
"players.left": "odszedł",
|
||||||
"players.none": "brak",
|
"players.none": "brak",
|
||||||
|
"players.shareCount": { one: "{count} akcja", few: "{count} akcje", many: "{count} akcji", other: "{count} akcji" },
|
||||||
|
"players.shareCountHint": "Suma we wszystkich sieciach; akcje poszczególnych sieci są ukryte",
|
||||||
|
"log.optionIgnored.publicHoldings": "Opcję {option} pominięto: publicHoldings już pokazuje wszystkie aktywa",
|
||||||
hidden: "ukryte",
|
hidden: "ukryte",
|
||||||
"seat.name": "{name} (miejsce {seat})",
|
"seat.name": "{name} (miejsce {seat})",
|
||||||
"log.label": "Dziennik gry",
|
"log.label": "Dziennik gry",
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,9 @@ export const ptBR: Catalog = {
|
||||||
"players.turn": "vez",
|
"players.turn": "vez",
|
||||||
"players.left": "saiu",
|
"players.left": "saiu",
|
||||||
"players.none": "nenhuma",
|
"players.none": "nenhuma",
|
||||||
|
"players.shareCount": { one: "{count} ação", many: "{count} ações", other: "{count} ações" },
|
||||||
|
"players.shareCountHint": "Total em todas as redes; as ações de cada rede ficam ocultas",
|
||||||
|
"log.optionIgnored.publicHoldings": "A opção {option} foi ignorada: publicHoldings já mostra todos os ativos",
|
||||||
hidden: "oculto",
|
hidden: "oculto",
|
||||||
"seat.name": "{name} (lugar {seat})",
|
"seat.name": "{name} (lugar {seat})",
|
||||||
"log.label": "Registro do jogo",
|
"log.label": "Registro do jogo",
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,9 @@ export const ro: Catalog = {
|
||||||
"players.turn": "la rând",
|
"players.turn": "la rând",
|
||||||
"players.left": "a plecat",
|
"players.left": "a plecat",
|
||||||
"players.none": "niciuna",
|
"players.none": "niciuna",
|
||||||
|
"players.shareCount": { one: "{count} acțiune", few: "{count} acțiuni", other: "{count} de acțiuni" },
|
||||||
|
"players.shareCountHint": "Total în toate lanțurile; acțiunile pe fiecare lanț sunt ascunse",
|
||||||
|
"log.optionIgnored.publicHoldings": "Opțiunea {option} a fost ignorată: publicHoldings arată deja toate deținerile",
|
||||||
hidden: "ascuns",
|
hidden: "ascuns",
|
||||||
"seat.name": "{name} (locul {seat})",
|
"seat.name": "{name} (locul {seat})",
|
||||||
"log.label": "Jurnalul jocului",
|
"log.label": "Jurnalul jocului",
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,9 @@ export const ru: Catalog = {
|
||||||
"players.turn": "ход",
|
"players.turn": "ход",
|
||||||
"players.left": "вышел",
|
"players.left": "вышел",
|
||||||
"players.none": "нет",
|
"players.none": "нет",
|
||||||
|
"players.shareCount": { one: "{count} акция", few: "{count} акции", many: "{count} акций", other: "{count} акции" },
|
||||||
|
"players.shareCountHint": "Всего по всем сетям; акции по сетям скрыты",
|
||||||
|
"log.optionIgnored.publicHoldings": "Опция {option} пропущена: publicHoldings уже показывает все активы",
|
||||||
hidden: "скрыто",
|
hidden: "скрыто",
|
||||||
"seat.name": "{name} (место {seat})",
|
"seat.name": "{name} (место {seat})",
|
||||||
"log.label": "Журнал игры",
|
"log.label": "Журнал игры",
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,9 @@ export const vi: Catalog = {
|
||||||
"players.turn": "lượt",
|
"players.turn": "lượt",
|
||||||
"players.left": "đã rời",
|
"players.left": "đã rời",
|
||||||
"players.none": "không có",
|
"players.none": "không có",
|
||||||
|
"players.shareCount": { other: "{count} cổ phiếu" },
|
||||||
|
"players.shareCountHint": "Tổng trên mọi chuỗi; số cổ phiếu của từng chuỗi được ẩn",
|
||||||
|
"log.optionIgnored.publicHoldings": "Bỏ qua tùy chọn {option}: publicHoldings đã hiển thị mọi tài sản",
|
||||||
hidden: "ẩn",
|
hidden: "ẩn",
|
||||||
"seat.name": "{name} (ghế {seat})",
|
"seat.name": "{name} (ghế {seat})",
|
||||||
"log.label": "Nhật ký ván chơi",
|
"log.label": "Nhật ký ván chơi",
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,9 @@ export const zhCN: Catalog = {
|
||||||
"players.turn": "回合",
|
"players.turn": "回合",
|
||||||
"players.left": "已离开",
|
"players.left": "已离开",
|
||||||
"players.none": "无",
|
"players.none": "无",
|
||||||
|
"players.shareCount": { other: "{count} 股" },
|
||||||
|
"players.shareCountHint": "所有连锁的合计;各连锁的持股不公开",
|
||||||
|
"log.optionIgnored.publicHoldings": "已忽略选项 {option}:publicHoldings 已公开全部持股",
|
||||||
hidden: "隐藏",
|
hidden: "隐藏",
|
||||||
"seat.name": "{name}(座位 {seat})",
|
"seat.name": "{name}(座位 {seat})",
|
||||||
"log.label": "游戏记录",
|
"log.label": "游戏记录",
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,9 @@ export const zhTW: Catalog = {
|
||||||
"players.turn": "回合",
|
"players.turn": "回合",
|
||||||
"players.left": "已離開",
|
"players.left": "已離開",
|
||||||
"players.none": "無",
|
"players.none": "無",
|
||||||
|
"players.shareCount": { other: "{count} 股" },
|
||||||
|
"players.shareCountHint": "所有連鎖的合計;各連鎖的持股不公開",
|
||||||
|
"log.optionIgnored.publicHoldings": "已忽略選項 {option}:publicHoldings 已公開全部持股",
|
||||||
hidden: "隱藏",
|
hidden: "隱藏",
|
||||||
"seat.name": "{name}(座位 {seat})",
|
"seat.name": "{name}(座位 {seat})",
|
||||||
"log.label": "遊戲紀錄",
|
"log.label": "遊戲紀錄",
|
||||||
|
|
|
||||||
32
packages/viewer/src/lib/replay.spec.ts
Normal file
32
packages/viewer/src/lib/replay.spec.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { test } from "node:test";
|
||||||
|
import { HIDDEN, initGame, legalMoves, applyMove, currentSeat, type GameState } from "acquire-engine";
|
||||||
|
import { replayView } from "./replay.ts";
|
||||||
|
|
||||||
|
function played(options: Record<string, unknown>): GameState {
|
||||||
|
const state = initGame(3, options, "replay-levels");
|
||||||
|
for (let step = 1; step < 120 && !state.ended; step++) {
|
||||||
|
const moves = legalMoves(state).filter((move) => move.type !== "announce");
|
||||||
|
applyMove(state, moves[(step * 7919) % moves.length]!, currentSeat(state)!);
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
test("replay positions show other seats' holdings only as far as the holdings level allows", () => {
|
||||||
|
const at = (state: GameState) => state.log.length;
|
||||||
|
const cases: [Record<string, unknown>, (seat: GameState["seats"][number]) => void][] = [
|
||||||
|
[{}, (seat) => assert.equal(seat.cash, HIDDEN)],
|
||||||
|
[{ holdingsVisibility: "cash" }, (seat) => assert.ok(seat.cash > 0 && seat.shareCount === undefined)],
|
||||||
|
[{ holdingsVisibility: "cashAndShareCount" }, (seat) => assert.equal(typeof seat.shareCount, "number")],
|
||||||
|
];
|
||||||
|
for (const [options, check] of cases) {
|
||||||
|
const state = played(options);
|
||||||
|
const view = replayView(state, 0, at(state));
|
||||||
|
check(view.seats[1]!);
|
||||||
|
assert.equal(view.seats[1]!.shares.tower, HIDDEN);
|
||||||
|
assert.deepEqual(view.seats[0]!.shares, state.seats[0]!.shares, "your own holdings are shown");
|
||||||
|
assert.equal(view.seats[0]!.shareCount, undefined);
|
||||||
|
}
|
||||||
|
const open = played({ holdingsVisibility: "public" });
|
||||||
|
assert.deepEqual(replayView(open, 0, at(open)).seats[1]!.shares, open.seats[1]!.shares);
|
||||||
|
});
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
// BGS replay controls: the state to display at a log position, built from the engine's
|
// BGS replay controls: the state to display at a log position, built from the engine's
|
||||||
// positionAt (the public log replayed with the engine's own placement functions).
|
// positionAt (the public log replayed with the engine's own placement functions).
|
||||||
import { CHAIN_IDS, HIDDEN, positionAt, seatsOf, type GameState, type Shares } from "acquire-engine";
|
import { HIDDEN, maskHoldings, positionAt, seatsOf, visibilityNow, type GameState } from "acquire-engine";
|
||||||
|
|
||||||
const HIDDEN_SHARES = Object.fromEntries(CHAIN_IDS.map((chain) => [chain, HIDDEN])) as Shares;
|
|
||||||
|
|
||||||
/** The first replay position: the board after setup, at the start of the first turn. */
|
/** The first replay position: the board after setup, at the start of the first turn. */
|
||||||
export function replayStart(state: GameState): number {
|
export function replayStart(state: GameState): number {
|
||||||
|
|
@ -11,24 +9,24 @@ export function replayStart(state: GameState): number {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The game as it stood after `at` log entries. Holdings show only where they are public now:
|
* The game as it stood after `at` log entries. Holdings show only as far as they are public now
|
||||||
* public holdings, a finished game, or the viewer's own seats. Tiles in hand are never shown.
|
* (the holdings level, or all of them in a finished game), except on the viewer's own seats.
|
||||||
|
* Tiles in hand are never shown.
|
||||||
*/
|
*/
|
||||||
export function replayView(state: GameState, player: number | undefined, at: number): GameState {
|
export function replayView(state: GameState, player: number | undefined, at: number): GameState {
|
||||||
const position = positionAt(state, at);
|
const position = positionAt(state, at);
|
||||||
const own = seatsOf(state, player);
|
const own = seatsOf(state, player);
|
||||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
const level = visibilityNow(state);
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
board: position.board,
|
board: position.board,
|
||||||
bank: position.bank,
|
bank: position.bank,
|
||||||
seats: state.seats.map((seat, index) => {
|
seats: state.seats.map((seat, index) => {
|
||||||
const shown = position.seats[index]!;
|
const shown = position.seats[index]!;
|
||||||
const visible = holdingsPublic || own.includes(index);
|
const { shareCount: _, ...rest } = seat;
|
||||||
return {
|
return {
|
||||||
...seat,
|
...rest,
|
||||||
cash: visible ? shown.cash : HIDDEN,
|
...maskHoldings(shown, own.includes(index) ? "public" : level),
|
||||||
shares: visible ? shown.shares : { ...HIDDEN_SHARES },
|
|
||||||
hand: Array.from({ length: shown.tiles }, () => HIDDEN),
|
hand: Array.from({ length: shown.tiles }, () => HIDDEN),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
53
rules.md
53
rules.md
|
|
@ -227,10 +227,11 @@ can be renamed later without touching game logic.
|
||||||
5. Players can never sell stock except during merger disposal (§7.2) and final scoring
|
5. Players can never sell stock except during merger disposal (§7.2) and final scoring
|
||||||
(§11.2). There is no trading between players.
|
(§11.2). There is no trading between players.
|
||||||
6. **[DECISION]** The buy step is skipped automatically only for public reasons: no chain
|
6. **[DECISION]** The buy step is skipped automatically only for public reasons: no chain
|
||||||
is on the board, or the bank has no shares left in any active chain. When
|
is on the board, or the bank has no shares left in any active chain. While cash is
|
||||||
`publicHoldings` is off (§13), it is never skipped because the player cannot afford a
|
private (`holdingsVisibility` `private`, §13), it is never skipped because the player
|
||||||
share, since that would reveal their cash; they get the step and may buy nothing. When
|
cannot afford a share, since that would reveal their cash; they get the step and may buy
|
||||||
`publicHoldings` is on, it is also skipped when the player cannot afford any share.
|
nothing. When cash is public (every other level), it is also skipped when the player
|
||||||
|
cannot afford any share.
|
||||||
|
|
||||||
### 9.1 Optional stock swaps (house rule)
|
### 9.1 Optional stock swaps (house rule)
|
||||||
|
|
||||||
|
|
@ -338,21 +339,36 @@ Each viewer must only receive information their player is entitled to.
|
||||||
- **Always private:** each player's hand of tiles, and the order of the draw pool.
|
- **Always private:** each player's hand of tiles, and the order of the draw pool.
|
||||||
- **Always public:** the board, chain names and sizes, current prices, and the number of
|
- **Always public:** the board, chain names and sizes, current prices, and the number of
|
||||||
shares left in the bank for each chain.
|
shares left in the bank for each chain.
|
||||||
- **[DECISION] Game option `publicHoldings` (default: `false`):** When off, each player's
|
- **[DECISION] Game option `holdingsVisibility` (default: `private`):** what everyone sees
|
||||||
current share holdings and cash are visible only to that player. When on, they are
|
of other players' current cash and share holdings during play.
|
||||||
public.
|
- `private`: nothing; each player's cash and holdings are visible only to that player.
|
||||||
|
- `cash`: every player's exact cash is public; holdings stay private.
|
||||||
|
- `cashAndShareCount`: exact cash and each player's total number of shares across all
|
||||||
|
chains (including kept shares of chains not on the board) are public; how many shares
|
||||||
|
of each chain stays private.
|
||||||
|
- `public`: cash and every holding are public.
|
||||||
|
|
||||||
|
The legacy checkbox `publicHoldings: true` means `public` and wins over the select; an
|
||||||
|
intermediate level it overrides is logged as ignored. Normalized options keep
|
||||||
|
`publicHoldings` (true only at `public`) and store `holdingsVisibility` only for `cash`
|
||||||
|
and `cashAndShareCount`, so games created before this option keep identical init logs.
|
||||||
|
Projected net worth and scores need per-chain holdings, so they are shown only at
|
||||||
|
`public` (below). Summary lines say how many shares a player kept in a merger only at
|
||||||
|
`public`. The log is the same at every level.
|
||||||
- **[DECISION] The game log is public** unless `limitedLog` is on (below). It records
|
- **[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
|
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
|
choices. Only the *current* holdings and cash are hidden, even though they can be
|
||||||
reconstructed from the log.
|
reconstructed from the log.
|
||||||
- **Game option `limitedLog` (default: `false`):** each player sees only the log from the
|
- **Game option `limitedLog` (default: `false`):** everyone sees the same part of the log:
|
||||||
start of their own last turn before the current one, so the current turn, including a
|
the current turn, including a merger in progress, and the full round of turns before it
|
||||||
merger in progress, is always shown. Spectators see as much as the active player.
|
(one turn per seat, so four turns in four-hands games). **[DECISION]** Every player and
|
||||||
Setup entries (options, turn order) stay visible. Earlier entries are replaced by
|
spectator gets this same window, wherever they sit, and it always reaches back at least to
|
||||||
placeholders, keeping the log's length. The whole log is revealed when the game ends,
|
the start of their own previous turn. Setup entries (options, turn order) stay visible.
|
||||||
and replay is only available after that.
|
Earlier entries are replaced by placeholders, keeping the log's length. The whole log is
|
||||||
- **[DECISION] Scores during play:** When `publicHoldings` is off, every player's score
|
revealed when the game ends, and replay is only available after that.
|
||||||
is 0 until the game ends. When it is on, the score is projected net worth: cash,
|
- **[DECISION] Scores during play:** Unless holdings are `public`, every player's score
|
||||||
|
is 0 until the game ends, including at the `cash` and `cashAndShareCount` levels. At
|
||||||
|
`public`, the score is projected net worth: cash,
|
||||||
current share sale values and majority/minority bonuses at current holdings (including
|
current share sale values and majority/minority bonuses at current holdings (including
|
||||||
ties and rounding). Future bonuses are excluded in two-player bank mode because the
|
ties and rounding). Future bonuses are excluded in two-player bank mode because the
|
||||||
bank's holding is drawn only at payout. In-progress mergers never count paid bonuses
|
bank's holding is drawn only at payout. In-progress mergers never count paid bonuses
|
||||||
|
|
@ -386,15 +402,16 @@ switches on one engine, not as separate code paths. Defaults reproduce the stand
|
||||||
|
|
||||||
| Option | Values | Default | Effect |
|
| Option | Values | Default | Effect |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| `publicHoldings` | true / false | false | See §13. When false, share holdings and cash are private. |
|
| `holdingsVisibility` | `private` / `cash` / `cashAndShareCount` / `public` | `private` | See §13. What everyone sees of other players' cash and holdings during play. |
|
||||||
| `teamPlay` | true / false | false | Only applies with exactly 4 players. Seats 1 and 3 form one team, seats 2 and 4 the other. All rules are unchanged; at final scoring each team's cash is added together and the team with more wins. **[DECISION]** With `publicHoldings` off, teammates still cannot see each other's holdings. |
|
| `publicHoldings` | true / false | false | Legacy checkbox, kept for existing games: true means `holdingsVisibility: public`. See §13. |
|
||||||
|
| `teamPlay` | true / false | false | Only applies with exactly 4 players. Seats 1 and 3 form one team, seats 2 and 4 the other. All rules are unchanged; at final scoring each team's cash is added together and the team with more wins. **[DECISION]** Below `public` holdings, teammates see each other's cash and holdings only as far as everyone does. |
|
||||||
| `twoPlayerMode` | `bank` / `fourHands` | `bank` | Only has an effect with exactly 2 players. `bank` uses §12. `fourHands` runs a normal 4-seat game where each player controls two seats (player A has seats 1 and 3, player B has seats 2 and 4), with no bank shareholder. **[DECISION]** The player who controls the single richest seat wins; seats are not combined. |
|
| `twoPlayerMode` | `bank` / `fourHands` | `bank` | Only has an effect with exactly 2 players. `bank` uses §12. `fourHands` runs a normal 4-seat game where each player controls two seats (player A has seats 1 and 3, player B has seats 2 and 4), with no bank shareholder. **[DECISION]** The player who controls the single richest seat wins; seats are not combined. |
|
||||||
| `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. |
|
| `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. |
|
| `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. |
|
| `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 | 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. |
|
| `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. |
|
| `limitedLog` | true / false | false | The log shows only the current turn and the round before it 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. |
|
| `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
|
**[DECISION]** Invalid combinations are never rejected. An option that does not apply to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue