Add configurable three, four or five share purchase limit
This commit is contained in:
parent
3e01897b08
commit
3d31fd48b8
33 changed files with 370 additions and 79 deletions
|
|
@ -3,7 +3,7 @@
|
|||
## Repository and live status
|
||||
|
||||
- This is **Acquire**, in `boardgamers/mergers-game`; the BGS game id is `acquire`, version **1**.
|
||||
- **The BGS game is public**, verified 28 October 2026. Preserve the live visibility and
|
||||
- **The BGS game is public**, verified 29 October 2026. Preserve the live visibility and
|
||||
unrelated metadata on updates. Fetch fresh metadata before publishing; this file is not a
|
||||
substitute for checking the live configuration.
|
||||
- `docs/admin/gameinfo.json` is a bootstrap template. Its `public: false` and blank artifact
|
||||
|
|
@ -51,7 +51,8 @@ Use Node 24 and pnpm 11. Inspect the working tree before editing and preserve un
|
|||
- Honor BGS theme, sound, chat, replay and supporter player colors. Chain letters already
|
||||
identify chains independently of color. Ongoing hidden-information analysis is not enabled.
|
||||
- Stock swaps are an optional house rule: Off / 3 / 5 / 7 / Unlimited. The per-turn limit is
|
||||
shared across exchanges, separate from the three-share purchase allowance; prices apply
|
||||
shared across exchanges, separate from the purchase allowance (3 by default; `sharesPerTurn`
|
||||
may raise it to 4 or 5); prices apply
|
||||
after all merger resolution. Keep the default Off.
|
||||
- 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;
|
||||
|
|
|
|||
|
|
@ -94,6 +94,26 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharesPerTurn",
|
||||
"label": "Shares per turn",
|
||||
"type": "select",
|
||||
"default": "3",
|
||||
"items": [
|
||||
{
|
||||
"name": "3",
|
||||
"label": "3 (standard)"
|
||||
},
|
||||
{
|
||||
"name": "4",
|
||||
"label": "4"
|
||||
},
|
||||
{
|
||||
"name": "5",
|
||||
"label": "5"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stockSwap",
|
||||
"label": "Stock swap (shares per turn, optional variant)",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,19 @@
|
|||
# Acquire — 28 October 2026
|
||||
# Acquire — 29 October 2026
|
||||
|
||||
BGS registration: `acquire`, version `1`. Engine `0.0.5`, viewer `0.0.18`.
|
||||
BGS registration: `acquire`, version `1`. Engine `0.0.6`, viewer `0.0.19`.
|
||||
Source: <https://github.com/boardgamers/mergers-game>. The live game is now public; preserve its current visibility when updating.
|
||||
|
||||
## Validation
|
||||
|
||||
- **Shares per turn** offers 3 (standard), 4 or 5 total purchases across all chains.
|
||||
Existing games and tutorial lessons retain 3. The allowance is separate from stock swaps,
|
||||
founding gifts and merger exchanges, and applies once to a two-tile turn or four-hands seat.
|
||||
Checks cover default/invalid setup values, legal moves and direct validation, bank/cash
|
||||
limits, private drafts with one clock increment, and replay in bank/team/four-hands modes.
|
||||
Purchase and swap prompts show the configured limit in all 17 viewer locales; browser
|
||||
checks cover each limit, mixed-chain purchases, disabled excess purchases and phone layouts.
|
||||
The BGS setup declaration uses English source labels; platform label translations are separate.
|
||||
|
||||
- [MikeIsom's PR #1](https://github.com/boardgamers/mergers-game/pull/1) adds two optional
|
||||
setup checkboxes, both default Off: two tiles per turn (hands of 8) and limited game log.
|
||||
The shortened labels requested in review are included. Two-tile rules cover founding/merger
|
||||
|
|
@ -17,7 +26,7 @@ Source: <https://github.com/boardgamers/mergers-game>. The live game is now publ
|
|||
|
||||
- Optional stock swaps default to Off, with 3/5/7/Unlimited shares per turn shared across exchanges.
|
||||
Only active chains may swap 1:1 at current prices after all mergers, respecting bank stock,
|
||||
holdings and cash. Normal three-share purchases remain separate. Engine checks cover allowance
|
||||
holdings and cash. Normal purchases (3 by default, optionally 4 or 5) remain separate. Engine checks cover allowance
|
||||
resets, refunds, equal prices, bank/cash limits, malformed moves, merger timing, old replays,
|
||||
public replay reconstruction, four hands, private undo and one clock increment per turn.
|
||||
The compact pre-buy controls and public swap log are translated into all 17 languages.
|
||||
|
|
@ -56,7 +65,7 @@ Source: <https://github.com/boardgamers/mergers-game>. The live game is now publ
|
|||
requests, hidden-information masking, replay, bank mode, four-hands, teams and dropped players.
|
||||
Desktop/phone checks exercise repeated undo, saved-state refreshes, final history and clock totals.
|
||||
|
||||
- `pnpm check`: formatting, lint, TypeScript/Svelte checks, 242 engine tests,
|
||||
- `pnpm check`: formatting, lint, TypeScript/Svelte checks, 248 engine tests,
|
||||
67 viewer/tutorial tests, and the production build. Two pre-existing lint warnings
|
||||
remain (an unused test import and Svelte's `bind:this` assignment).
|
||||
- Protocol diagnostics: all eight required engine methods; full core/chat/replay
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ A chain of 11 or more tiles is **safe**: it can never be taken over.
|
|||
## Your turn
|
||||
|
||||
1. **Place one tile** from your hand.
|
||||
2. **Buy up to 3 shares**, in any active chains (optional).
|
||||
2. **Buy up to 3 shares** by default, in any active chains (optional; see Shares per turn below).
|
||||
3. **Draw** back up to 6 tiles.
|
||||
|
||||
### What a tile does
|
||||
|
|
@ -41,7 +41,7 @@ A chain of 11 or more tiles is **safe**: it can never be taken over.
|
|||
|
||||
If the game uses **Two tiles per turn**, each player holds 8 tiles instead of 6 and places two tiles every turn.
|
||||
|
||||
At the start of your turn, swap out any dead tiles. Then place your first tile and settle anything it causes, including a full merger with everyone's sell, trade or keep decisions, before placing your second. After both tiles, buy up to 3 shares at the prices on the board, then draw back up to 8.
|
||||
At the start of your turn, swap out any dead tiles. Then place your first tile and settle anything it causes, including a full merger with everyone's sell, trade or keep decisions, before placing your second. After both tiles, buy shares up to the game’s per-turn limit (3 by default) at the prices on the board, then draw back up to 8.
|
||||
|
||||
You may found only one chain per turn, and you can't found a chain and cause a merger in the same turn, in either order. You can cause two mergers, one with each tile. Example: your first tile merges Luxor into Tower, so your second tile can merge again or grow a chain, but it can't found a new one.
|
||||
|
||||
|
|
@ -73,6 +73,13 @@ Then the survivor absorbs all the tiles. The names of the chains taken over are
|
|||
|
||||
After placing, you may buy up to 3 shares in total, in one or more chains on the board. Prices depend on each chain's current size and stay fixed for the rest of your turn. You can't borrow, and you can't sell stock except in a merger or at the end.
|
||||
|
||||
### Optional purchase limit
|
||||
|
||||
The **Shares per turn** setup option offers **3 (standard)**, **4** or **5**. This is the
|
||||
total you may buy across all chains, once per turn, even when playing two tiles. Founding
|
||||
gifts and shares received during mergers do not count. Cash and bank stock still limit
|
||||
what you can buy. Choosing 4 or 5 is a house rule; existing games and tutorials keep 3.
|
||||
|
||||
### Optional stock swaps
|
||||
|
||||
If the game uses **Stock swap**, after your tile and any mergers are fully resolved you
|
||||
|
|
@ -86,7 +93,8 @@ each cost $800. Reversing that exchange pays you $800.
|
|||
|
||||
The setting is **Off** (default), **3**, **5**, **7** or **Unlimited** shares per turn.
|
||||
The allowance is shared across exchanges: giving three shares and receiving three uses
|
||||
three of the allowance. You can still buy your usual **up to 3 shares** afterward.
|
||||
three of the allowance. You can still buy up to the game’s **Shares per turn** limit
|
||||
(**3** by default) afterward; the two allowances are independent.
|
||||
Swaps can be undone until you finish buying. This is an optional house rule.
|
||||
|
||||
## Price table
|
||||
|
|
@ -138,6 +146,7 @@ Because replaying the game would show the full history, replay is only available
|
|||
|
||||
- **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).
|
||||
- **Shares per turn:** buy up to 3 (standard), 4 or 5 shares in total per turn, independently of stock swaps.
|
||||
- **Stock swap:** optional 1:1 exchanges with the bank before buying; Off / 3 / 5 / 7 / Unlimited shares per turn (see above).
|
||||
- **Public holdings:** everyone's cash and shares are visible.
|
||||
- **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.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Publishing Acquire on boardgamers.space
|
||||
|
||||
Acquire is already registered as game **`acquire`**, BGS version **`1`**, and is **public**
|
||||
(verified 28 October 2026). Routine updates must preserve that visibility and the existing
|
||||
(verified 29 October 2026). Routine updates must preserve that visibility and the existing
|
||||
configuration. Start with [AGENTS.md](../AGENTS.md) for repository checks and compatibility
|
||||
requirements, and [admin/release-check.md](admin/release-check.md) for the latest release record.
|
||||
|
||||
|
|
@ -147,7 +147,8 @@ do not replace other declarations from an old local snapshot.
|
|||
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,
|
||||
**Stock swap: Off / 3 / 5 / 7 / Unlimited**, two tiles per turn and limited game log.
|
||||
**Shares per turn: 3 (standard) / 4 / 5**, **Stock swap: Off / 3 / 5 / 7 / Unlimited**,
|
||||
two tiles per turn and limited game log.
|
||||
Stock swaps, two tiles per turn and limited logs default Off.
|
||||
- The **sound** preference, default on, also honoring BGS's global sound setting.
|
||||
- Three interactive tutorial chapters: founding, mergers and scoring.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "acquire-engine",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"description": "Acquire rules engine for boardgamers.space",
|
||||
"license": "AGPL-3.0-only",
|
||||
"files": [
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import { activeChains } from "./board.js";
|
||||
import { CHAIN_IDS, MAX_BUY, type ChainId } from "./config.js";
|
||||
import { CHAIN_IDS, type ChainId } from "./config.js";
|
||||
import { merger } from "./merger.js";
|
||||
import { currentSeat, sanitizeMove } from "./moves.js";
|
||||
import { sharePurchaseLimit } from "./options.js";
|
||||
import { maxStockSwap } from "./stock-swap.js";
|
||||
import { tileLabel } from "./tiles.js";
|
||||
import type { GameState, Move, Shares } from "./types.js";
|
||||
|
||||
function buyCombinations(chains: ChainId[]): Partial<Shares>[] {
|
||||
function buyCombinations(chains: ChainId[], limit: number): Partial<Shares>[] {
|
||||
const result: Partial<Shares>[] = [];
|
||||
const visit = (from: number, remaining: number, current: Partial<Shares>) => {
|
||||
result.push({ ...current });
|
||||
|
|
@ -23,7 +24,7 @@ function buyCombinations(chains: ChainId[]): Partial<Shares>[] {
|
|||
}
|
||||
}
|
||||
};
|
||||
visit(0, MAX_BUY, {});
|
||||
visit(0, limit, {});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +73,10 @@ function phaseCandidates(state: GameState): Move[] {
|
|||
}
|
||||
case "buy": {
|
||||
const active = activeChains(state.board);
|
||||
const moves: Move[] = buyCombinations(active).map((shares) => ({ type: "buy", shares }));
|
||||
const moves: Move[] = buyCombinations(active, sharePurchaseLimit(state.options)).map((shares) => ({
|
||||
type: "buy",
|
||||
shares,
|
||||
}));
|
||||
for (const from of active) {
|
||||
for (const to of active) {
|
||||
const max = maxStockSwap(state, from, to);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { activeChains, chainSize, connectedLoose, placementEffect, playableTiles, tileLegality } from "./board.js";
|
||||
import { defaultMove } from "./autoplay.js";
|
||||
import { AUTO_MOVE_LIMIT, CHAIN_IDS, MAX_BUY, isChainId, type ChainId } from "./config.js";
|
||||
import { AUTO_MOVE_LIMIT, CHAIN_IDS, isChainId, type ChainId } from "./config.js";
|
||||
import { sharePurchaseLimit } from "./options.js";
|
||||
import {
|
||||
dispose,
|
||||
isValidDefunctOrder,
|
||||
|
|
@ -160,8 +161,9 @@ export function sanitizeMove(state: GameState, raw: unknown, seat: number): Move
|
|||
total += n;
|
||||
cost += n * sharePrice(key, chainSize(state.board, key));
|
||||
}
|
||||
if (total > MAX_BUY) {
|
||||
throw new Error(`You can buy at most ${MAX_BUY} shares per turn`);
|
||||
const limit = sharePurchaseLimit(state.options);
|
||||
if (total > limit) {
|
||||
throw new Error(`You can buy at most ${limit} shares per turn`);
|
||||
}
|
||||
if (cost > state.seats[seat]!.cash) {
|
||||
throw new Error("You cannot afford those shares");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { END_SIZE, HAND_SIZE, TWO_TILE_HAND_SIZE } from "./config.js";
|
||||
import { END_SIZE, HAND_SIZE, MAX_BUY, TWO_TILE_HAND_SIZE } from "./config.js";
|
||||
|
||||
/** rules.md §15, after normalisation against the player count. */
|
||||
export interface GameOptions {
|
||||
|
|
@ -9,6 +9,8 @@ export interface GameOptions {
|
|||
endSize: number;
|
||||
/** Omitted when off, preserving the init log of games created before this variant. */
|
||||
stockSwap?: 3 | 5 | 7 | "unlimited";
|
||||
/** Omitted at the standard limit of 3, preserving historical init logs. */
|
||||
sharesPerTurn?: 4 | 5;
|
||||
/** Omitted when off, like stockSwap. */
|
||||
twoTiles?: true;
|
||||
/** Omitted when off, like stockSwap. */
|
||||
|
|
@ -84,6 +86,14 @@ export function normalizeOptions(
|
|||
}
|
||||
}
|
||||
|
||||
if (raw.sharesPerTurn !== undefined) {
|
||||
if ([4, 5, "4", "5"].includes(raw.sharesPerTurn as number | string)) {
|
||||
options.sharesPerTurn = Number(raw.sharesPerTurn) as 4 | 5;
|
||||
} else if (raw.sharesPerTurn !== 3 && raw.sharesPerTurn !== "3") {
|
||||
ignored.push({ option: "sharesPerTurn", value: raw.sharesPerTurn, reason: "unknown value" });
|
||||
}
|
||||
}
|
||||
|
||||
if (raw.twoTiles === true) {
|
||||
options.twoTiles = true;
|
||||
}
|
||||
|
|
@ -94,6 +104,11 @@ export function normalizeOptions(
|
|||
return { options, ignored };
|
||||
}
|
||||
|
||||
/** Total purchases across all chains, independent of stock swaps and tile placements. */
|
||||
export function sharePurchaseLimit(options: GameOptions): number {
|
||||
return options.sharesPerTurn ?? MAX_BUY;
|
||||
}
|
||||
|
||||
/** rules.md §15 twoTiles: hands hold 8 tiles instead of 6. */
|
||||
export function handSize(options: GameOptions): number {
|
||||
return options.twoTiles ? TWO_TILE_HAND_SIZE : HAND_SIZE;
|
||||
|
|
|
|||
157
packages/engine/src/purchase-limit.spec.ts
Normal file
157
packages/engine/src/purchase-limit.spec.ts
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import * as wrapper from "../wrapper.js";
|
||||
import { legalMoves } from "./legal.js";
|
||||
import { applyMove, currentSeat } from "./moves.js";
|
||||
import { DEFAULT_OPTIONS, normalizeOptions, sharePurchaseLimit } from "./options.js";
|
||||
import { positionAt } from "./position.js";
|
||||
import { initGame } from "./setup.js";
|
||||
import { stockSwapsRemaining } from "./stock-swap.js";
|
||||
import { chainAt, checkInvariants, scenario } from "./test/helpers.js";
|
||||
import type { Move } from "./types.js";
|
||||
|
||||
function position(options: Record<string, unknown> = {}) {
|
||||
return scenario({
|
||||
board: { ...chainAt("tower", ["1A", "2A"]), ...chainAt("continental", ["1E", "2E"]) },
|
||||
hands: [["12I", "10I"], ["8I"], ["6I"], ["4I"]],
|
||||
shares: [{ tower: 6, continental: 6 }],
|
||||
options,
|
||||
});
|
||||
}
|
||||
|
||||
test("purchase limit accepts only 3/4/5 and leaves standard and historical options unchanged", () => {
|
||||
for (let players = 2; players <= 6; players++) {
|
||||
for (const sharesPerTurn of [undefined, 3, "3"]) {
|
||||
const normalized = normalizeOptions(players, { sharesPerTurn });
|
||||
assert.deepEqual(normalized, { options: DEFAULT_OPTIONS, ignored: [] });
|
||||
assert.equal(sharePurchaseLimit(normalized.options), 3);
|
||||
}
|
||||
for (const sharesPerTurn of [4, "4", 5, "5"]) {
|
||||
const { options, ignored } = normalizeOptions(players, { sharesPerTurn });
|
||||
assert.equal(sharePurchaseLimit(options), Number(sharesPerTurn));
|
||||
assert.deepEqual(ignored, []);
|
||||
}
|
||||
}
|
||||
for (const sharesPerTurn of [null, true, 0, 2, 6, 7, -1, [], [4], {}, "4.0", "unlimited", Infinity]) {
|
||||
const { options, ignored } = normalizeOptions(3, { sharesPerTurn });
|
||||
assert.deepEqual(options, DEFAULT_OPTIONS);
|
||||
assert.deepEqual(ignored, [{ option: "sharesPerTurn", value: sharesPerTurn, reason: "unknown value" }]);
|
||||
}
|
||||
assert.deepEqual(initGame(3, {}, "old-purchases").options, DEFAULT_OPTIONS);
|
||||
});
|
||||
|
||||
test("purchase limit applies to the total across chains in validation and legal moves", () => {
|
||||
for (const limit of [3, 4, 5]) {
|
||||
const state = position({ sharesPerTurn: String(limit) });
|
||||
applyMove(state, { type: "place", tile: "12I" }, 0);
|
||||
const choices = legalMoves(state).filter((move) => move.type === "buy");
|
||||
assert.equal(choices.length, ((limit + 1) * (limit + 2)) / 2, "all splits across two affordable chains");
|
||||
assert.deepEqual(legalMoves(wrapper.stripSecret(state, 0)), legalMoves(state));
|
||||
const original = structuredClone(state);
|
||||
for (const shares of [{ tower: limit + 1 }, { tower: 2, continental: limit - 1 }]) {
|
||||
assert.throws(() => applyMove(state, { type: "buy", shares }, 0), new RegExp(`at most ${limit}`));
|
||||
assert.deepEqual(state, original, "invalid purchases are atomic");
|
||||
}
|
||||
applyMove(state, { type: "buy", shares: { tower: 2, continental: limit - 2 } }, 0);
|
||||
assert.equal(state.seats[0]!.cash, 6000 - 400 - (limit - 2) * 400);
|
||||
assert.equal(state.seats[0]!.shares.tower, 8);
|
||||
assert.equal(state.seats[0]!.shares.continental, 6 + limit - 2);
|
||||
assert.equal(state.activeSeat, 1);
|
||||
checkInvariants(state);
|
||||
}
|
||||
});
|
||||
|
||||
test("larger purchase limits still enforce cash, bank stock, active chains and turn ownership", () => {
|
||||
const state = position({ sharesPerTurn: 5 });
|
||||
applyMove(state, { type: "place", tile: "12I" }, 0);
|
||||
state.seats[0]!.cash = 900;
|
||||
assert.throws(() => applyMove(state, { type: "buy", shares: { tower: 5 } }, 0), /afford/);
|
||||
assert.ok(!legalMoves(state).some((m) => m.type === "buy" && m.shares.tower === 5));
|
||||
state.seats[0]!.cash = 6000;
|
||||
state.bank.tower = 4;
|
||||
assert.throws(() => applyMove(state, { type: "buy", shares: { tower: 5 } }, 0), /bank/);
|
||||
assert.ok(!legalMoves(state).some((m) => m.type === "buy" && m.shares.tower === 5));
|
||||
assert.throws(() => applyMove(state, { type: "buy", shares: { luxor: 1 } }, 0), /on the board/);
|
||||
assert.throws(() => applyMove(state, { type: "buy", shares: { tower: 1 } }, 1), /not your turn/);
|
||||
});
|
||||
|
||||
test("five purchases remain independent of swaps and cover the whole two-tile turn", () => {
|
||||
const state = position({ sharesPerTurn: 5, stockSwap: 3, twoTiles: true });
|
||||
applyMove(state, { type: "place", tile: "12I" }, 0);
|
||||
assert.equal(state.phase, "place");
|
||||
assert.throws(() => applyMove(state, { type: "buy", shares: { tower: 5 } }, 0));
|
||||
applyMove(state, { type: "place", tile: "10I" }, 0);
|
||||
applyMove(state, { type: "swap", from: "continental", to: "tower", count: 3 }, 0);
|
||||
assert.equal(stockSwapsRemaining(state), 0);
|
||||
applyMove(state, { type: "buy", shares: { tower: 5 } }, 0);
|
||||
assert.equal(state.seats[0]!.shares.tower, 14);
|
||||
assert.equal(state.seats[0]!.cash, 5600);
|
||||
assert.equal(state.activeSeat, 1);
|
||||
assert.equal(state.log.filter((e) => e.type === "bought").length, 1);
|
||||
checkInvariants(state);
|
||||
});
|
||||
|
||||
test("four- and five-share turn drafts commit once after revisions without extra history or time", () => {
|
||||
for (const limit of [4, 5]) {
|
||||
const base = position({ sharesPerTurn: limit, stockSwap: 3 });
|
||||
const original = structuredClone(base);
|
||||
const moves: Move[] = [
|
||||
{ type: "place", tile: "12I" },
|
||||
{ type: "swap", from: "continental", to: "tower", count: 1 },
|
||||
];
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const preview = wrapper.move(
|
||||
base,
|
||||
{ type: "turn", from: base.log.length, moves: moves.slice(0, (i % 2) + 1) },
|
||||
0
|
||||
);
|
||||
assert.equal(wrapper.toSave(preview), undefined);
|
||||
assert.deepEqual(wrapper.timeIncrements(preview), [0, 0, 0]);
|
||||
}
|
||||
const saved = wrapper.move(
|
||||
base,
|
||||
{
|
||||
type: "turn",
|
||||
from: base.log.length,
|
||||
moves: [...moves, { type: "buy", shares: { tower: limit } }],
|
||||
},
|
||||
0
|
||||
);
|
||||
assert.deepEqual(base, original);
|
||||
assert.equal(wrapper.toSave(saved), saved);
|
||||
assert.equal(saved.log.filter((entry) => entry.type === "move").length, 3);
|
||||
assert.deepEqual(wrapper.timeIncrements(saved), [1, 0, 0]);
|
||||
checkInvariants(saved);
|
||||
}
|
||||
});
|
||||
|
||||
test("purchase variants replay across bank, four-hands, team and two-tile games, including the old default", () => {
|
||||
for (const [players, options] of [
|
||||
[3, {}],
|
||||
[3, { sharesPerTurn: "3" }],
|
||||
[2, { sharesPerTurn: "4" }],
|
||||
[2, { sharesPerTurn: "5", twoPlayerMode: "fourHands" }],
|
||||
[4, { sharesPerTurn: "4", teamPlay: true }],
|
||||
[3, { sharesPerTurn: "5", twoTiles: true, limitedLog: true }],
|
||||
] as [number, Record<string, unknown>][]) {
|
||||
const state = initGame(players, options, "purchase-replay");
|
||||
let largestBuy = 0;
|
||||
for (let i = 0; i < 150 && !state.ended; i++) {
|
||||
const moves = legalMoves(state).filter((m) => m.type !== "announce");
|
||||
const move = moves.at(-1)!;
|
||||
if (move.type === "buy") {
|
||||
largestBuy = Math.max(
|
||||
largestBuy,
|
||||
Object.values(move.shares).reduce((a, b) => a + b, 0)
|
||||
);
|
||||
}
|
||||
applyMove(state, move, currentSeat(state)!);
|
||||
}
|
||||
assert.equal(largestBuy, sharePurchaseLimit(state.options));
|
||||
assert.deepEqual(wrapper.replay(state), state);
|
||||
const reconstructed = positionAt(state, state.log.length);
|
||||
assert.deepEqual(reconstructed.board, state.board);
|
||||
assert.deepEqual(reconstructed.bank, state.bank);
|
||||
checkInvariants(state);
|
||||
}
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "acquire-viewer",
|
||||
"version": "0.0.18",
|
||||
"version": "0.0.19",
|
||||
"private": true,
|
||||
"description": "Browser viewer for Acquire on boardgamers.space",
|
||||
"license": "AGPL-3.0-only",
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ for (const key of ["publicHoldings", "teamPlay", "autoEnd", "twoTiles", "limited
|
|||
options[key] = true;
|
||||
}
|
||||
}
|
||||
for (const key of ["twoPlayerMode", "endSize", "stockSwap"]) {
|
||||
for (const key of ["twoPlayerMode", "endSize", "stockSwap", "sharesPerTurn"]) {
|
||||
const value = params.get(key);
|
||||
if (value) {
|
||||
options[key] = value;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
currentSeat,
|
||||
merger,
|
||||
sharePrice,
|
||||
sharePurchaseLimit,
|
||||
tileLabel,
|
||||
type ChainId,
|
||||
type Shares,
|
||||
|
|
@ -67,6 +68,7 @@
|
|||
const valueChange = $derived(`${tradeValue < 0 ? "−" : "+"}${money(Math.abs(tradeValue))}`);
|
||||
|
||||
const buyable = $derived(activeChains(game.board));
|
||||
const buyLimit = $derived(sharePurchaseLimit(game.options));
|
||||
const price = (chain: ChainId) => sharePrice(chain, chainSize(game.board, chain));
|
||||
const cost = $derived(Object.entries(shares).reduce((sum, [chain, n]) => sum + n * price(chain as ChainId), 0));
|
||||
const total = $derived(Object.values(shares).reduce((sum, n) => sum + n, 0));
|
||||
|
|
@ -296,7 +298,7 @@
|
|||
>
|
||||
{:else if game.phase === "buy"}
|
||||
{#if game.options.stockSwap}<StockSwap {store} bind:open={swapOpen} />{/if}
|
||||
<p>{t("buy.prompt")}</p>
|
||||
<p>{t("buy.prompt", { limit: buyLimit })}</p>
|
||||
{#if buyable.length > 0}
|
||||
<table class="buy">
|
||||
<thead>
|
||||
|
|
@ -337,7 +339,12 @@
|
|||
</table>
|
||||
{/if}
|
||||
<p class="total">
|
||||
{t("buy.total", { count: total, cost: money(cost), cash: money(game.seats[seat!]!.cash - cost) })}
|
||||
{t("buy.total", {
|
||||
count: total,
|
||||
limit: buyLimit,
|
||||
cost: money(cost),
|
||||
cash: money(game.seats[seat!]!.cash - cost),
|
||||
})}
|
||||
</p>
|
||||
<button type="button" class="actionable primary" onclick={() => store.send({ type: "buy", shares })}>
|
||||
{total === 0 ? t("buy.nothing") : t("buy.confirm", { cost: money(cost) })}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
activeChains,
|
||||
chainSize,
|
||||
sharePrice,
|
||||
sharePurchaseLimit,
|
||||
stockSwapCost,
|
||||
stockSwapsRemaining,
|
||||
type ChainId,
|
||||
|
|
@ -48,7 +49,7 @@
|
|||
{t("swap.title")}
|
||||
<small>· {remaining === Infinity ? t("swap.unlimited") : t("swap.remaining", { count: remaining })}</small></summary
|
||||
>
|
||||
<p class="note">{t("swap.note")}</p>
|
||||
<p class="note">{t("swap.note", { limit: sharePurchaseLimit(game.options) })}</p>
|
||||
{#if choices.length}
|
||||
<div class="chains">
|
||||
<label
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const da: Catalog = {
|
||||
"swap.title": "Aktiebytte",
|
||||
"swap.note": "Byt 1:1 til aktuelle priser før køb. Du kan stadig købe op til 3 aktier.",
|
||||
"swap.note": "Byt 1:1 til aktuelle priser før køb. Du kan stadig købe op til {limit} aktier.",
|
||||
"swap.remaining": "{count} tilbage denne tur",
|
||||
"swap.unlimited": "Ubegrænset",
|
||||
"swap.give": "Afgiv (dine aktier)",
|
||||
|
|
@ -68,14 +68,14 @@ export const da: Catalog = {
|
|||
"dispose.tradeFewer": "Byt to færre",
|
||||
"dispose.tradeMore": "Byt to flere",
|
||||
"dispose.confirm": "Bekræft",
|
||||
"buy.prompt": "Køb op til 3 aktier. Priserne ligger fast i denne tur.",
|
||||
"buy.prompt": "Køb op til {limit} aktier. Priserne ligger fast i denne tur.",
|
||||
"buy.chain": "Kæde",
|
||||
"buy.price": "Pris",
|
||||
"buy.bank": "Bank",
|
||||
"buy.buy": "Køb",
|
||||
"buy.fewer": "Én {chain}-aktie færre",
|
||||
"buy.more": "Én {chain}-aktie mere",
|
||||
"buy.total": "{count} af 3 aktier · pris {cost} · tilbage {cash}",
|
||||
"buy.total": "{count} af {limit} aktier · pris {cost} · tilbage {cash}",
|
||||
"buy.nothing": "Køb intet og afslut turen",
|
||||
"buy.confirm": "Køb for {cost} og afslut turen",
|
||||
"board.label": "Spilleplade",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const de: Catalog = {
|
||||
"swap.title": "Aktientausch",
|
||||
"swap.note": "Vor dem Kauf 1:1 zu aktuellen Kursen tauschen. Du darfst weiterhin bis zu 3 Aktien kaufen.",
|
||||
"swap.note": "Vor dem Kauf 1:1 zu aktuellen Kursen tauschen. Du darfst weiterhin bis zu {limit} Aktien kaufen.",
|
||||
"swap.remaining": "{count} in diesem Zug übrig",
|
||||
"swap.unlimited": "Unbegrenzt",
|
||||
"swap.give": "Abgeben (dein Bestand)",
|
||||
|
|
@ -68,14 +68,14 @@ export const de: Catalog = {
|
|||
"dispose.tradeFewer": "Zwei weniger tauschen",
|
||||
"dispose.tradeMore": "Zwei mehr tauschen",
|
||||
"dispose.confirm": "Bestätigen",
|
||||
"buy.prompt": "Kaufe bis zu 3 Aktien. Die Preise gelten für den ganzen Zug.",
|
||||
"buy.prompt": "Kaufe bis zu {limit} Aktien. Die Preise gelten für den ganzen Zug.",
|
||||
"buy.chain": "Kette",
|
||||
"buy.price": "Preis",
|
||||
"buy.bank": "Bank",
|
||||
"buy.buy": "Kaufen",
|
||||
"buy.fewer": "Eine {chain}-Aktie weniger kaufen",
|
||||
"buy.more": "Eine {chain}-Aktie mehr kaufen",
|
||||
"buy.total": "{count} von 3 Aktien · Kosten {cost} · Restgeld {cash}",
|
||||
"buy.total": "{count} von {limit} Aktien · Kosten {cost} · Restgeld {cash}",
|
||||
"buy.nothing": "Nichts kaufen und Zug beenden",
|
||||
"buy.confirm": "Für {cost} kaufen und Zug beenden",
|
||||
"board.label": "Spielplan",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const el: Catalog = {
|
||||
"swap.title": "Ανταλλαγή μετοχών",
|
||||
"swap.note": "Ανταλλάξτε 1:1 στις τρέχουσες τιμές πριν αγοράσετε. Μπορείτε ακόμα να αγοράσετε έως 3 μετοχές.",
|
||||
"swap.note": "Ανταλλάξτε 1:1 στις τρέχουσες τιμές πριν αγοράσετε. Μπορείτε ακόμα να αγοράσετε έως {limit} μετοχές.",
|
||||
"swap.remaining": "Απομένουν {count} σε αυτόν τον γύρο",
|
||||
"swap.unlimited": "Απεριόριστες",
|
||||
"swap.give": "Δίνετε (μετοχές σας)",
|
||||
|
|
@ -68,14 +68,14 @@ export const el: Catalog = {
|
|||
"dispose.tradeFewer": "Ανταλλαγή δύο λιγότερων",
|
||||
"dispose.tradeMore": "Ανταλλαγή δύο ακόμη",
|
||||
"dispose.confirm": "Επιβεβαίωση",
|
||||
"buy.prompt": "Αγόρασε έως 3 μετοχές. Οι τιμές μένουν σταθερές σε αυτόν τον γύρο.",
|
||||
"buy.prompt": "Αγόρασε έως {limit} μετοχές. Οι τιμές μένουν σταθερές σε αυτόν τον γύρο.",
|
||||
"buy.chain": "Αλυσίδα",
|
||||
"buy.price": "Τιμή",
|
||||
"buy.bank": "Τράπεζα",
|
||||
"buy.buy": "Αγορά",
|
||||
"buy.fewer": "Μία μετοχή {chain} λιγότερη",
|
||||
"buy.more": "Μία μετοχή {chain} ακόμη",
|
||||
"buy.total": "{count} από 3 μετοχές · κόστος {cost} · υπόλοιπο {cash}",
|
||||
"buy.total": "{count} από {limit} μετοχές · κόστος {cost} · υπόλοιπο {cash}",
|
||||
"buy.nothing": "Καμία αγορά και τέλος γύρου",
|
||||
"buy.confirm": "Αγορά για {cost} και τέλος γύρου",
|
||||
"board.label": "Ταμπλό",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// per CLDR plural category of the language. Chain names are never translated.
|
||||
export const en = {
|
||||
"swap.title": "Stock swap",
|
||||
"swap.note": "Swap 1:1 at current prices before buying. You may still buy up to 3 shares.",
|
||||
"swap.note": "Swap 1:1 at current prices before buying. You may still buy up to {limit} shares.",
|
||||
"swap.remaining": "{count} left this turn",
|
||||
"swap.unlimited": "Unlimited",
|
||||
"swap.give": "Give (your stock)",
|
||||
|
|
@ -73,14 +73,14 @@ export const en = {
|
|||
"dispose.tradeFewer": "Trade two fewer",
|
||||
"dispose.tradeMore": "Trade two more",
|
||||
"dispose.confirm": "Confirm",
|
||||
"buy.prompt": "Buy up to 3 shares. Prices are fixed for this turn.",
|
||||
"buy.prompt": "Buy up to {limit} shares. Prices are fixed for this turn.",
|
||||
"buy.chain": "Chain",
|
||||
"buy.price": "Price",
|
||||
"buy.bank": "Bank",
|
||||
"buy.buy": "Buy",
|
||||
"buy.fewer": "Buy one fewer {chain}",
|
||||
"buy.more": "Buy one more {chain}",
|
||||
"buy.total": "{count} of 3 shares · cost {cost} · cash left {cash}",
|
||||
"buy.total": "{count} of {limit} shares · cost {cost} · cash left {cash}",
|
||||
"buy.nothing": "Buy nothing and end turn",
|
||||
"buy.confirm": "Buy for {cost} and end turn",
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const fa: Catalog = {
|
||||
"swap.title": "تعویض سهام",
|
||||
"swap.note": "پیش از خرید، با قیمت فعلی یکبهیک تعویض کنید. همچنان میتوانید تا ۳ سهم بخرید.",
|
||||
"swap.note": "پیش از خرید، با قیمت فعلی یکبهیک تعویض کنید. همچنان میتوانید تا {limit} سهم بخرید.",
|
||||
"swap.remaining": "{count} سهم باقیمانده در این نوبت",
|
||||
"swap.unlimited": "نامحدود",
|
||||
"swap.give": "واگذاری (سهام شما)",
|
||||
|
|
@ -68,14 +68,14 @@ export const fa: Catalog = {
|
|||
"dispose.tradeFewer": "دو تا کمتر معاوضه کن",
|
||||
"dispose.tradeMore": "دو تا بیشتر معاوضه کن",
|
||||
"dispose.confirm": "تأیید",
|
||||
"buy.prompt": "حداکثر 3 سهم بخرید. قیمتها در این نوبت ثابتاند.",
|
||||
"buy.prompt": "حداکثر {limit} سهم بخرید. قیمتها در این نوبت ثابتاند.",
|
||||
"buy.chain": "زنجیره",
|
||||
"buy.price": "قیمت",
|
||||
"buy.bank": "بانک",
|
||||
"buy.buy": "خرید",
|
||||
"buy.fewer": "یک سهم {chain} کمتر",
|
||||
"buy.more": "یک سهم {chain} بیشتر",
|
||||
"buy.total": "{count} از 3 سهم · هزینه {cost} · باقیمانده {cash}",
|
||||
"buy.total": "{count} از {limit} سهم · هزینه {cost} · باقیمانده {cash}",
|
||||
"buy.nothing": "چیزی نخر و نوبت را تمام کن",
|
||||
"buy.confirm": "خرید به {cost} و پایان نوبت",
|
||||
"board.label": "صفحهی بازی",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const fr: Catalog = {
|
||||
"swap.title": "Échange d’actions",
|
||||
"swap.note": "Échangez à 1 contre 1 au prix actuel avant d’acheter. Vous pouvez toujours acheter jusqu’à 3 actions.",
|
||||
"swap.note":
|
||||
"Échangez à 1 contre 1 au prix actuel avant d’acheter. Vous pouvez toujours acheter jusqu’à {limit} actions.",
|
||||
"swap.remaining": "{count} restantes ce tour",
|
||||
"swap.unlimited": "Illimité",
|
||||
"swap.give": "Donner (vos actions)",
|
||||
|
|
@ -72,14 +73,14 @@ export const fr: Catalog = {
|
|||
"dispose.tradeFewer": "Échanger deux de moins",
|
||||
"dispose.tradeMore": "Échanger deux de plus",
|
||||
"dispose.confirm": "Confirmer",
|
||||
"buy.prompt": "Achetez jusqu’à 3 actions. Les prix restent fixes pendant ce tour.",
|
||||
"buy.prompt": "Achetez jusqu’à {limit} actions. Les prix restent fixes pendant ce tour.",
|
||||
"buy.chain": "Chaîne",
|
||||
"buy.price": "Prix",
|
||||
"buy.bank": "Banque",
|
||||
"buy.buy": "Achat",
|
||||
"buy.fewer": "Acheter une action {chain} de moins",
|
||||
"buy.more": "Acheter une action {chain} de plus",
|
||||
"buy.total": "{count} actions sur 3 · coût {cost} · argent restant {cash}",
|
||||
"buy.total": "{count} actions sur {limit} · coût {cost} · argent restant {cash}",
|
||||
"buy.nothing": "Ne rien acheter et finir le tour",
|
||||
"buy.confirm": "Acheter pour {cost} et finir le tour",
|
||||
"board.label": "Plateau",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const hi: Catalog = {
|
||||
"swap.title": "शेयर अदला-बदली",
|
||||
"swap.note": "खरीदने से पहले मौजूदा कीमतों पर 1:1 अदला-बदली करें। फिर भी 3 शेयर तक खरीद सकते हैं।",
|
||||
"swap.note": "खरीदने से पहले मौजूदा कीमतों पर 1:1 अदला-बदली करें। फिर भी {limit} शेयर तक खरीद सकते हैं।",
|
||||
"swap.remaining": "इस बारी में {count} बाकी",
|
||||
"swap.unlimited": "असीमित",
|
||||
"swap.give": "दें (आपके शेयर)",
|
||||
|
|
@ -67,14 +67,14 @@ export const hi: Catalog = {
|
|||
"dispose.tradeFewer": "दो कम बदलें",
|
||||
"dispose.tradeMore": "दो और बदलें",
|
||||
"dispose.confirm": "पुष्टि करें",
|
||||
"buy.prompt": "अधिकतम 3 शेयर खरीदें। इस बारी में कीमतें नहीं बदलतीं।",
|
||||
"buy.prompt": "अधिकतम {limit} शेयर खरीदें। इस बारी में कीमतें नहीं बदलतीं।",
|
||||
"buy.chain": "श्रृंखला",
|
||||
"buy.price": "कीमत",
|
||||
"buy.bank": "बैंक",
|
||||
"buy.buy": "खरीदें",
|
||||
"buy.fewer": "{chain} का एक शेयर कम",
|
||||
"buy.more": "{chain} का एक शेयर और",
|
||||
"buy.total": "3 में से {count} शेयर · लागत {cost} · बची नकदी {cash}",
|
||||
"buy.total": "{limit} में से {count} शेयर · लागत {cost} · बची नकदी {cash}",
|
||||
"buy.nothing": "कुछ न खरीदें और बारी समाप्त करें",
|
||||
"buy.confirm": "{cost} में खरीदें और बारी समाप्त करें",
|
||||
"board.label": "बोर्ड",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const it: Catalog = {
|
||||
"swap.title": "Scambio di azioni",
|
||||
"swap.note": "Scambia 1:1 ai prezzi attuali prima di acquistare. Puoi ancora comprare fino a 3 azioni.",
|
||||
"swap.note": "Scambia 1:1 ai prezzi attuali prima di acquistare. Puoi ancora comprare fino a {limit} azioni.",
|
||||
"swap.remaining": "{count} rimaste nel turno",
|
||||
"swap.unlimited": "Illimitato",
|
||||
"swap.give": "Cedi (le tue azioni)",
|
||||
|
|
@ -72,14 +72,14 @@ export const it: Catalog = {
|
|||
"dispose.tradeFewer": "Scambiane due in meno",
|
||||
"dispose.tradeMore": "Scambiane due in più",
|
||||
"dispose.confirm": "Conferma",
|
||||
"buy.prompt": "Compra fino a 3 azioni. I prezzi restano fissi in questo turno.",
|
||||
"buy.prompt": "Compra fino a {limit} azioni. I prezzi restano fissi in questo turno.",
|
||||
"buy.chain": "Catena",
|
||||
"buy.price": "Prezzo",
|
||||
"buy.bank": "Banca",
|
||||
"buy.buy": "Compra",
|
||||
"buy.fewer": "Un'azione {chain} in meno",
|
||||
"buy.more": "Un'azione {chain} in più",
|
||||
"buy.total": "{count} di 3 azioni · costo {cost} · restano {cash}",
|
||||
"buy.total": "{count} di {limit} azioni · costo {cost} · restano {cash}",
|
||||
"buy.nothing": "Non comprare nulla e termina il turno",
|
||||
"buy.confirm": "Compra per {cost} e termina il turno",
|
||||
"board.label": "Tabellone",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const ko: Catalog = {
|
||||
"swap.title": "주식 교환",
|
||||
"swap.note": "구매 전에 현재 가격으로 1:1 교환합니다. 이후에도 주식을 최대 3주 구매할 수 있습니다.",
|
||||
"swap.note": "구매 전에 현재 가격으로 1:1 교환합니다. 이후에도 주식을 최대 {limit}주 구매할 수 있습니다.",
|
||||
"swap.remaining": "이번 차례에 {count}주 남음",
|
||||
"swap.unlimited": "무제한",
|
||||
"swap.give": "제공 (보유 주식)",
|
||||
|
|
@ -68,14 +68,14 @@ export const ko: Catalog = {
|
|||
"dispose.tradeFewer": "2주 덜 교환",
|
||||
"dispose.tradeMore": "2주 더 교환",
|
||||
"dispose.confirm": "확정",
|
||||
"buy.prompt": "주식을 최대 3주까지 사세요. 이번 턴에는 가격이 바뀌지 않습니다.",
|
||||
"buy.prompt": "주식을 최대 {limit}주까지 사세요. 이번 턴에는 가격이 바뀌지 않습니다.",
|
||||
"buy.chain": "체인",
|
||||
"buy.price": "가격",
|
||||
"buy.bank": "은행",
|
||||
"buy.buy": "구매",
|
||||
"buy.fewer": "{chain} 주식 1주 빼기",
|
||||
"buy.more": "{chain} 주식 1주 더하기",
|
||||
"buy.total": "3주 중 {count}주 · 비용 {cost} · 남는 돈 {cash}",
|
||||
"buy.total": "{limit}주 중 {count}주 · 비용 {cost} · 남는 돈 {cash}",
|
||||
"buy.nothing": "사지 않고 턴 끝내기",
|
||||
"buy.confirm": "{cost}에 사고 턴 끝내기",
|
||||
"board.label": "게임판",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const nl: Catalog = {
|
||||
"swap.title": "Aandelen ruilen",
|
||||
"swap.note": "Ruil vóór het kopen 1:1 tegen de huidige prijzen. Je mag daarna nog maximaal 3 aandelen kopen.",
|
||||
"swap.note": "Ruil vóór het kopen 1:1 tegen de huidige prijzen. Je mag daarna nog maximaal {limit} aandelen kopen.",
|
||||
"swap.remaining": "Nog {count} deze beurt",
|
||||
"swap.unlimited": "Onbeperkt",
|
||||
"swap.give": "Geef (jouw aandelen)",
|
||||
|
|
@ -68,14 +68,14 @@ export const nl: Catalog = {
|
|||
"dispose.tradeFewer": "Twee minder ruilen",
|
||||
"dispose.tradeMore": "Twee meer ruilen",
|
||||
"dispose.confirm": "Bevestigen",
|
||||
"buy.prompt": "Koop tot 3 aandelen. De prijzen liggen vast tijdens deze beurt.",
|
||||
"buy.prompt": "Koop tot {limit} aandelen. De prijzen liggen vast tijdens deze beurt.",
|
||||
"buy.chain": "Keten",
|
||||
"buy.price": "Prijs",
|
||||
"buy.bank": "Bank",
|
||||
"buy.buy": "Kopen",
|
||||
"buy.fewer": "Eén {chain}-aandeel minder",
|
||||
"buy.more": "Eén {chain}-aandeel meer",
|
||||
"buy.total": "{count} van 3 aandelen · kosten {cost} · over {cash}",
|
||||
"buy.total": "{count} van {limit} aandelen · kosten {cost} · over {cash}",
|
||||
"buy.nothing": "Niets kopen en beurt beëindigen",
|
||||
"buy.confirm": "Kopen voor {cost} en beurt beëindigen",
|
||||
"board.label": "Spelbord",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const pl: Catalog = {
|
||||
"swap.title": "Wymiana akcji",
|
||||
"swap.note": "Przed zakupem wymieniaj 1:1 po bieżących cenach. Nadal możesz kupić do 3 akcji.",
|
||||
"swap.note": "Przed zakupem wymieniaj 1:1 po bieżących cenach. Nadal możesz kupić do {limit} akcji.",
|
||||
"swap.remaining": "Pozostało w turze: {count}",
|
||||
"swap.unlimited": "Bez limitu",
|
||||
"swap.give": "Oddaj (twoje akcje)",
|
||||
|
|
@ -73,14 +73,14 @@ export const pl: Catalog = {
|
|||
"dispose.tradeFewer": "Wymień o dwie mniej",
|
||||
"dispose.tradeMore": "Wymień o dwie więcej",
|
||||
"dispose.confirm": "Potwierdź",
|
||||
"buy.prompt": "Kup do 3 akcji. Ceny nie zmieniają się w tej turze.",
|
||||
"buy.prompt": "Kup do {limit} akcji. Ceny nie zmieniają się w tej turze.",
|
||||
"buy.chain": "Sieć",
|
||||
"buy.price": "Cena",
|
||||
"buy.bank": "Bank",
|
||||
"buy.buy": "Kup",
|
||||
"buy.fewer": "Kup o jedną akcję {chain} mniej",
|
||||
"buy.more": "Kup o jedną akcję {chain} więcej",
|
||||
"buy.total": "{count} z 3 akcji · koszt {cost} · zostaje {cash}",
|
||||
"buy.total": "{count} z {limit} akcji · koszt {cost} · zostaje {cash}",
|
||||
"buy.nothing": "Nic nie kupuj i zakończ turę",
|
||||
"buy.confirm": "Kup za {cost} i zakończ turę",
|
||||
"board.label": "Plansza",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const ptBR: Catalog = {
|
||||
"swap.title": "Troca de ações",
|
||||
"swap.note": "Troque 1:1 pelos preços atuais antes de comprar. Você ainda pode comprar até 3 ações.",
|
||||
"swap.note": "Troque 1:1 pelos preços atuais antes de comprar. Você ainda pode comprar até {limit} ações.",
|
||||
"swap.remaining": "{count} restantes neste turno",
|
||||
"swap.unlimited": "Ilimitado",
|
||||
"swap.give": "Dar (suas ações)",
|
||||
|
|
@ -72,14 +72,14 @@ export const ptBR: Catalog = {
|
|||
"dispose.tradeFewer": "Trocar duas a menos",
|
||||
"dispose.tradeMore": "Trocar duas a mais",
|
||||
"dispose.confirm": "Confirmar",
|
||||
"buy.prompt": "Compre até 3 ações. Os preços ficam fixos neste turno.",
|
||||
"buy.prompt": "Compre até {limit} ações. Os preços ficam fixos neste turno.",
|
||||
"buy.chain": "Rede",
|
||||
"buy.price": "Preço",
|
||||
"buy.bank": "Banco",
|
||||
"buy.buy": "Comprar",
|
||||
"buy.fewer": "Uma ação da {chain} a menos",
|
||||
"buy.more": "Uma ação da {chain} a mais",
|
||||
"buy.total": "{count} de 3 ações · custo {cost} · sobra {cash}",
|
||||
"buy.total": "{count} de {limit} ações · custo {cost} · sobra {cash}",
|
||||
"buy.nothing": "Não comprar nada e encerrar o turno",
|
||||
"buy.confirm": "Comprar por {cost} e encerrar o turno",
|
||||
"board.label": "Tabuleiro",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const ro: Catalog = {
|
||||
"swap.title": "Schimb de acțiuni",
|
||||
"swap.note": "Schimbă 1:1 la prețurile curente înainte de cumpărare. Poți cumpăra în continuare până la 3 acțiuni.",
|
||||
"swap.note":
|
||||
"Schimbă 1:1 la prețurile curente înainte de cumpărare. Poți cumpăra în continuare până la {limit} acțiuni.",
|
||||
"swap.remaining": "{count} rămase în această tură",
|
||||
"swap.unlimited": "Nelimitat",
|
||||
"swap.give": "Dai (acțiunile tale)",
|
||||
|
|
@ -72,14 +73,14 @@ export const ro: Catalog = {
|
|||
"dispose.tradeFewer": "Schimbă două mai puțin",
|
||||
"dispose.tradeMore": "Schimbă două în plus",
|
||||
"dispose.confirm": "Confirmă",
|
||||
"buy.prompt": "Cumpără până la 3 acțiuni. Prețurile rămân fixe în această tură.",
|
||||
"buy.prompt": "Cumpără până la {limit} acțiuni. Prețurile rămân fixe în această tură.",
|
||||
"buy.chain": "Lanț",
|
||||
"buy.price": "Preț",
|
||||
"buy.bank": "Bancă",
|
||||
"buy.buy": "Cumpără",
|
||||
"buy.fewer": "Cumpără o acțiune {chain} mai puțin",
|
||||
"buy.more": "Cumpără o acțiune {chain} în plus",
|
||||
"buy.total": "{count} din 3 acțiuni · cost {cost} · bani rămași {cash}",
|
||||
"buy.total": "{count} din {limit} acțiuni · cost {cost} · bani rămași {cash}",
|
||||
"buy.nothing": "Nu cumpăra nimic și încheie tura",
|
||||
"buy.confirm": "Cumpără cu {cost} și încheie tura",
|
||||
"board.label": "Tablă",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const ru: Catalog = {
|
||||
"swap.title": "Обмен акций",
|
||||
"swap.note": "Обменивайте 1:1 по текущим ценам перед покупкой. После этого можно купить до 3 акций.",
|
||||
"swap.note": "Обменивайте 1:1 по текущим ценам перед покупкой. После этого можно купить до {limit} акций.",
|
||||
"swap.remaining": "Осталось за ход: {count}",
|
||||
"swap.unlimited": "Без ограничений",
|
||||
"swap.give": "Отдать (ваши акции)",
|
||||
|
|
@ -73,14 +73,14 @@ export const ru: Catalog = {
|
|||
"dispose.tradeFewer": "Обменять на две меньше",
|
||||
"dispose.tradeMore": "Обменять на две больше",
|
||||
"dispose.confirm": "Подтвердить",
|
||||
"buy.prompt": "Купите до 3 акций. Цены в этом ходе не меняются.",
|
||||
"buy.prompt": "Купите до {limit} акций. Цены в этом ходе не меняются.",
|
||||
"buy.chain": "Сеть",
|
||||
"buy.price": "Цена",
|
||||
"buy.bank": "Банк",
|
||||
"buy.buy": "Купить",
|
||||
"buy.fewer": "На одну акцию {chain} меньше",
|
||||
"buy.more": "На одну акцию {chain} больше",
|
||||
"buy.total": "{count} из 3 акций · стоимость {cost} · останется {cash}",
|
||||
"buy.total": "{count} из {limit} акций · стоимость {cost} · останется {cash}",
|
||||
"buy.nothing": "Ничего не покупать и закончить ход",
|
||||
"buy.confirm": "Купить за {cost} и закончить ход",
|
||||
"board.label": "Поле",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const vi: Catalog = {
|
||||
"swap.title": "Đổi cổ phiếu",
|
||||
"swap.note": "Đổi 1:1 theo giá hiện tại trước khi mua. Bạn vẫn được mua tối đa 3 cổ phiếu.",
|
||||
"swap.note": "Đổi 1:1 theo giá hiện tại trước khi mua. Bạn vẫn được mua tối đa {limit} cổ phiếu.",
|
||||
"swap.remaining": "Còn {count} trong lượt này",
|
||||
"swap.unlimited": "Không giới hạn",
|
||||
"swap.give": "Đưa (cổ phiếu của bạn)",
|
||||
|
|
@ -68,14 +68,14 @@ export const vi: Catalog = {
|
|||
"dispose.tradeFewer": "Đổi bớt hai",
|
||||
"dispose.tradeMore": "Đổi thêm hai",
|
||||
"dispose.confirm": "Xác nhận",
|
||||
"buy.prompt": "Mua tối đa 3 cổ phiếu. Giá không đổi trong lượt này.",
|
||||
"buy.prompt": "Mua tối đa {limit} cổ phiếu. Giá không đổi trong lượt này.",
|
||||
"buy.chain": "Chuỗi",
|
||||
"buy.price": "Giá",
|
||||
"buy.bank": "Ngân hàng",
|
||||
"buy.buy": "Mua",
|
||||
"buy.fewer": "Bớt một cổ phiếu {chain}",
|
||||
"buy.more": "Thêm một cổ phiếu {chain}",
|
||||
"buy.total": "{count}/3 cổ phiếu · chi phí {cost} · còn lại {cash}",
|
||||
"buy.total": "{count}/{limit} cổ phiếu · chi phí {cost} · còn lại {cash}",
|
||||
"buy.nothing": "Không mua và kết thúc lượt",
|
||||
"buy.confirm": "Mua với giá {cost} và kết thúc lượt",
|
||||
"board.label": "Bàn chơi",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const zhCN: Catalog = {
|
||||
"swap.title": "股票交换",
|
||||
"swap.note": "购买前可按现价一换一。交换后仍可购买最多 3 股。",
|
||||
"swap.note": "购买前可按现价一换一。交换后仍可购买最多 {limit} 股。",
|
||||
"swap.remaining": "本回合剩余 {count} 股",
|
||||
"swap.unlimited": "不限",
|
||||
"swap.give": "交出(持有股票)",
|
||||
|
|
@ -67,14 +67,14 @@ export const zhCN: Catalog = {
|
|||
"dispose.tradeFewer": "少换两股",
|
||||
"dispose.tradeMore": "多换两股",
|
||||
"dispose.confirm": "确认",
|
||||
"buy.prompt": "最多购买 3 股。本回合内价格不变。",
|
||||
"buy.prompt": "最多购买 {limit} 股。本回合内价格不变。",
|
||||
"buy.chain": "连锁",
|
||||
"buy.price": "价格",
|
||||
"buy.bank": "银行",
|
||||
"buy.buy": "购买",
|
||||
"buy.fewer": "少买一股 {chain}",
|
||||
"buy.more": "多买一股 {chain}",
|
||||
"buy.total": "{count}/3 股 · 花费 {cost} · 剩余 {cash}",
|
||||
"buy.total": "{count}/{limit} 股 · 花费 {cost} · 剩余 {cash}",
|
||||
"buy.nothing": "不购买,结束回合",
|
||||
"buy.confirm": "花费 {cost} 购买并结束回合",
|
||||
"board.label": "游戏版图",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Catalog } from "../i18n.ts";
|
|||
|
||||
export const zhTW: Catalog = {
|
||||
"swap.title": "股票交換",
|
||||
"swap.note": "購買前可按現價一換一。交換後仍可購買最多 3 股。",
|
||||
"swap.note": "購買前可按現價一換一。交換後仍可購買最多 {limit} 股。",
|
||||
"swap.remaining": "本回合剩餘 {count} 股",
|
||||
"swap.unlimited": "不限",
|
||||
"swap.give": "交出(持有股票)",
|
||||
|
|
@ -67,14 +67,14 @@ export const zhTW: Catalog = {
|
|||
"dispose.tradeFewer": "少換兩股",
|
||||
"dispose.tradeMore": "多換兩股",
|
||||
"dispose.confirm": "確認",
|
||||
"buy.prompt": "最多購買 3 股。本回合內價格不變。",
|
||||
"buy.prompt": "最多購買 {limit} 股。本回合內價格不變。",
|
||||
"buy.chain": "連鎖",
|
||||
"buy.price": "價格",
|
||||
"buy.bank": "銀行",
|
||||
"buy.buy": "購買",
|
||||
"buy.fewer": "少買一股 {chain}",
|
||||
"buy.more": "多買一股 {chain}",
|
||||
"buy.total": "{count}/3 股 · 花費 {cost} · 剩餘 {cash}",
|
||||
"buy.total": "{count}/{limit} 股 · 花費 {cost} · 剩餘 {cash}",
|
||||
"buy.nothing": "不購買,結束回合",
|
||||
"buy.confirm": "花費 {cost} 購買並結束回合",
|
||||
"board.label": "遊戲圖板",
|
||||
|
|
|
|||
10
rules.md
10
rules.md
|
|
@ -53,7 +53,7 @@ player.
|
|||
|
||||
1. **Place tile** (§5). May trigger **Found chain** (§6) or **Merger** (§7), which fully
|
||||
resolve before continuing.
|
||||
2. **Buy stock** (§9). Optional, up to 3 shares.
|
||||
2. **Buy stock** (§9). Optional, up to 3 shares by default (4 or 5 with the setup variant).
|
||||
3. **End-of-game announcement** (§11). Optional. **[DECISION]** Allowed at exactly two
|
||||
points: before placing a tile, and during the buy step (§11.1).
|
||||
4. **Replace dead tiles** (§5.3).
|
||||
|
|
@ -208,7 +208,10 @@ can be renamed later without touching game logic.
|
|||
## 9. Buying Stock
|
||||
|
||||
1. After placing (or skipping placement), the active player may buy **0 to 3 shares**
|
||||
in total, across one, two, or three active chains.
|
||||
in total across active chains. The optional **Shares per turn** setting (`sharesPerTurn`)
|
||||
raises this total to **4** or **5**. The allowance applies once per turn, including
|
||||
two-tile turns and each seat in four-hands games; founding gifts and merger trades do
|
||||
not use it. Existing games and tutorials keep the standard limit of 3.
|
||||
2. Shares can only be bought in chains that are on the board and have shares left in the
|
||||
bank.
|
||||
3. The price of each share is based on the chain's size **after** this turn's placement
|
||||
|
|
@ -233,7 +236,7 @@ and the seat must afford any payment. No borrowing or direct player trades.
|
|||
|
||||
Off is the default. Limits 3, 5 or 7 count shares **given** across all exchanges that turn;
|
||||
Unlimited has no share-count cap. Allowances reset for each seat's turn, including four hands.
|
||||
Normal purchases of up to 3 shares remain separate and end the turn. An exchange may fund
|
||||
Normal purchases use their own `sharesPerTurn` limit (3 by default) and end the turn. An exchange may fund
|
||||
those purchases. A swap-enabled buy step is not skipped for lack of cash or secret holdings
|
||||
when at least two chains are active and the bank has stock in one. Dropped players skip swaps.
|
||||
Swaps and their cash differences are public once committed. Until buying ends the turn,
|
||||
|
|
@ -380,6 +383,7 @@ switches on one engine, not as separate code paths. Defaults reproduce the stand
|
|||
| `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. |
|
||||
| `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. |
|
||||
| `sharesPerTurn` | 3 / 4 / 5 | 3 | Maximum shares purchased per turn in total across all active chains (house rule). Independent of stock swaps; see §9. |
|
||||
| `stockSwap` | `off` / 3 / 5 / 7 / `unlimited` | `off` | Optional 1:1 exchanges with the bank before buying, paying or receiving the price difference. See §9.1. |
|
||||
| `twoTiles` | true / false | false | Hands of 8 tiles and two placements per turn (house rule). See §4.1. |
|
||||
| `limitedLog` | true / false | false | The log shows only what happened since your last turn until the game ends (house rule). See §13. |
|
||||
|
|
|
|||
|
|
@ -104,6 +104,65 @@ try {
|
|||
assert.equal(report.diagnostics.compatible, true);
|
||||
assert.equal(report.diagnostics.recommended.percent, 100);
|
||||
|
||||
// Setup limits must reach both the localized UI and the engine-backed +/- controls.
|
||||
for (const limit of [3, 4, 5]) {
|
||||
await page.setViewportSize({ width: limit === 3 ? 1280 : limit === 4 ? 390 : 320, height: 900 });
|
||||
await open(`players=3&hotseat=0&view=0&sharesPerTurn=${limit}&stockSwap=3`);
|
||||
assert.equal(
|
||||
await page.evaluate(() => window.acquireDev.rules.sharePurchaseLimit(window.acquireDev.state.options)),
|
||||
limit
|
||||
);
|
||||
await page.evaluate((state) => {
|
||||
const { parseTile, allTiles } = window.acquireDev.rules;
|
||||
state.options = { ...window.acquireDev.state.options };
|
||||
state.board[parseTile("1E")] = "continental";
|
||||
state.board[parseTile("2E")] = "continental";
|
||||
const held = new Set(state.seats.flatMap((seat) => seat.hand));
|
||||
state.pool = allTiles().filter((tile) => state.board[tile] === null && !held.has(tile));
|
||||
state.phase = "buy";
|
||||
state.placedThisTurn = true;
|
||||
window.acquireDev.load(state);
|
||||
}, preparedPosition("scoring"));
|
||||
await page.locator(".stock-swap summary").click();
|
||||
assert.match(await page.locator(".stock-swap .note").innerText(), new RegExp(`up to ${limit} shares`));
|
||||
const moreTower = page.getByRole("button", { name: "Buy one more Tower", exact: true });
|
||||
for (let i = 0; i < limit; i++) {
|
||||
await moreTower.click();
|
||||
}
|
||||
assert.equal(await moreTower.isDisabled(), true);
|
||||
assert.equal(await page.getByRole("button", { name: "Buy one more Continental", exact: true }).isDisabled(), true);
|
||||
assert.match(await page.locator(".panel .total").innerText(), new RegExp(`${limit} of ${limit} shares`));
|
||||
await page.getByRole("button", { name: "Buy one fewer Tower", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Buy one more Continental", exact: true }).click();
|
||||
for (const theme of ["light", "dark"]) {
|
||||
await page.evaluate((value) => window.acquireDev.emitter.emit("theme", { dark: value === "dark" }), theme);
|
||||
for (const locale of locales) {
|
||||
await preferences({ locale });
|
||||
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
|
||||
assert.ok((await page.locator(".stock-swap .note").innerText()).includes(String(limit)));
|
||||
assert.doesNotMatch(await page.locator(".panel").innerText(), /\{limit\}/);
|
||||
assert.equal(await page.locator("table.buy button").filter({ hasText: "+" }).first().isDisabled(), true);
|
||||
}
|
||||
await preferences({ locale: "en" });
|
||||
await page
|
||||
.locator(".panel")
|
||||
.screenshot({ path: fileURLToPath(new URL(`purchase-limit-${limit}-${theme}.png`, output)) });
|
||||
}
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
assert.deepEqual(
|
||||
await page.evaluate(() => ({
|
||||
bought: window.acquireDev.state.log.find((entry) => entry.type === "bought").shares,
|
||||
cash: window.acquireDev.state.seats[0].cash,
|
||||
increments: window.acquireDev.engine.timeIncrements(window.acquireDev.state),
|
||||
})),
|
||||
{ bought: { tower: limit - 1, continental: 1 }, cash: 6000 - (limit - 1) * 700 - 400, increments: [1, 0, 0] }
|
||||
);
|
||||
}
|
||||
report.scenarios.push(
|
||||
"3/4/5 share purchase limits, total across chains, independent swap allowance, 17 locales/both themes/mobile and one turn increment"
|
||||
);
|
||||
|
||||
// The two-tile variant keeps both placements private until buying or a commit boundary.
|
||||
for (const width of [1280, 390, 320]) {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue