Merge pull request #2 from MikeIsom/playtest-feedback
Playtest feedback updates and fixes
This commit is contained in:
commit
681bb84459
75 changed files with 3612 additions and 498 deletions
13
AGENTS.md
13
AGENTS.md
|
|
@ -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 27 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
|
||||
|
|
@ -43,7 +43,9 @@ Use Node 24 and pnpm 11. Inspect the working tree before editing and preserve un
|
|||
`toSave: undefined`; only the acting player receives the stripped preview. Revisions must
|
||||
not append saved history or award time. Commit boundaries include another player's
|
||||
decision, hidden information being revealed, draws and game end. Keep atomic moves working
|
||||
for older viewers, tutorials and analysis.
|
||||
for older viewers, tutorials and analysis. The viewer predicts each boundary by running the
|
||||
engine's `draftCanContinue` on a throwaway copy of the player's own view (`moveOutcome`), so
|
||||
the turn-ending step shows a turn summary first and merger decisions warn when undo stops.
|
||||
- Preserve two-player bank mode, four hands, team play and dropped-player behavior when changing rules.
|
||||
- Put new UI/log/tutorial text in all 17 catalogs under `packages/viewer/src/lib/locales/`.
|
||||
Keep chain names and tile coordinates unchanged. CMS text and setup labels have separate
|
||||
|
|
@ -51,8 +53,13 @@ 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;
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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
|
||||
moves on load), `merger=1` (continue to the next merger).
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
},
|
||||
"topLevelVariable": "acquire",
|
||||
"chat": true,
|
||||
"integratedControls": ["chat"],
|
||||
"replayable": true,
|
||||
"fullScreenMobile": false
|
||||
},
|
||||
|
|
@ -45,10 +44,28 @@
|
|||
],
|
||||
"options": [
|
||||
{
|
||||
"name": "publicHoldings",
|
||||
"label": "Public holdings (everyone sees all stock and cash)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
"name": "holdingsVisibility",
|
||||
"label": "What players see of each other's cash and stock",
|
||||
"type": "select",
|
||||
"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",
|
||||
|
|
@ -94,6 +111,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)",
|
||||
|
|
@ -124,13 +161,37 @@
|
|||
},
|
||||
{
|
||||
"name": "twoTiles",
|
||||
"label": "Two tiles per turn (hands of 8, optional variant)",
|
||||
"label": "Two tiles per turn",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "handSize",
|
||||
"label": "Tiles in hand",
|
||||
"type": "select",
|
||||
"default": "6",
|
||||
"items": [
|
||||
{
|
||||
"name": "6",
|
||||
"label": "6 (standard)"
|
||||
},
|
||||
{
|
||||
"name": "8",
|
||||
"label": "8"
|
||||
},
|
||||
{
|
||||
"name": "10",
|
||||
"label": "10"
|
||||
},
|
||||
{
|
||||
"name": "12",
|
||||
"label": "12"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "limitedLog",
|
||||
"label": "Limited game log (only since your last turn until the game ends)",
|
||||
"label": "Limited game log (only last round)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,32 @@
|
|||
# Acquire — 26 October 2026
|
||||
# Acquire — 29 October 2026
|
||||
|
||||
BGS registration: `acquire`, version `1`. Engine `0.0.4`, viewer `0.0.17`.
|
||||
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
|
||||
restrictions, bank tiles, dead-tile replacement, skipped placements, dropped players and replay.
|
||||
Follow-up fixes prevent BGS turn summaries from exposing hidden history, give four-hands
|
||||
spectators the active player's log window, and lock replay throughout limited-log play.
|
||||
Regression tests cover those privacy boundaries plus repeated two-tile revisions without
|
||||
growing saved history or awarding duplicate time. Browser checks exercise both variants,
|
||||
mobile layouts, all 17 locales, light/dark themes and replay after the full log is revealed.
|
||||
|
||||
- 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.
|
||||
|
|
@ -46,8 +65,8 @@ 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, 222 engine tests,
|
||||
66 viewer/tutorial tests, and the production build. Two pre-existing lint warnings
|
||||
- `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
|
||||
viewer coverage, preferences, avatars and theme handlers. Protocol `0.10.0` is the
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ There are 7 hotel chains, in three price tiers:
|
|||
- **Medium:** Worldwide, American, Festival
|
||||
- **Major:** Imperial, Continental
|
||||
|
||||
Each chain has 25 shares. Everyone starts with $6,000 and a hand of 6 tiles. Before the game, each player places one tile from the pool; the lowest tile (by number, then letter) goes first, and play continues in seat order.
|
||||
Each chain has 25 shares. Everyone starts with $6,000 and a hand of 6 tiles (or 8, 10 or 12 with the Tiles in hand option). Before the game, each player places one tile from the pool; the lowest tile (by number, then letter) goes first, and play continues in seat order.
|
||||
|
||||
A chain of 11 or more tiles is **safe**: it can never be taken over.
|
||||
|
||||
## Your turn
|
||||
|
||||
1. **Place one tile** from your hand.
|
||||
2. **Buy up to 3 shares**, in any active chains (optional).
|
||||
3. **Draw** back up to 6 tiles.
|
||||
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 (or the game’s hand size).
|
||||
|
||||
### What a tile does
|
||||
|
||||
|
|
@ -39,17 +39,19 @@ A chain of 11 or more tiles is **safe**: it can never be taken over.
|
|||
|
||||
### Two tiles per turn
|
||||
|
||||
If the game uses **Two tiles per turn**, each player holds 8 tiles instead of 6 and places two tiles every turn.
|
||||
If the game uses **Two tiles per turn**, each player places two tiles every turn. The number of tiles in hand is a separate option, so you can combine two tiles per turn with any hand size. (Two-tile games started before that option existed use hands of 8.)
|
||||
|
||||
At the start of your turn, swap out any dead tiles. Then place your first tile and settle anything it causes, including a full merger with everyone's sell, trade or keep decisions, before placing your second. After both tiles, buy 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 your hand size.
|
||||
|
||||
You may found only one chain per turn, and you can't found a chain and cause a merger in the same turn, in either order. You can cause two mergers, one with each tile. Example: your first tile merges Luxor into Tower, so your second tile can merge again or grow a chain, but it can't found a new one.
|
||||
You may found only one chain per turn, and your second tile can't cause a merger involving the chain your first tile founded. Otherwise each tile follows the usual rules: you can merge and then found a chain, found a chain and then merge two other chains, or cause two mergers, one with each tile. Example: your first tile founds Worldwide, so your second tile can merge Luxor into Tower or grow Worldwide, but it can't found another chain or cause a merger involving Worldwide.
|
||||
|
||||
You must play a second tile if any tile in your hand is legal after the first. If none is, go straight to buying. A tile that becomes dead during your turn, for example because your first tile made a chain safe, can't be your second tile; it's swapped out at the start of your next turn.
|
||||
|
||||
You can announce the end of the game before your first tile, between your two tiles, or while buying, as long as an end condition holds at that moment.
|
||||
|
||||
In a two-player game, the bank's tiles are placed right after the merger that drew them, so between your two tiles if your first tile caused it. Mergers caused by the bank's tiles don't count toward your two mergers or the founding rule. If a player leaves, the game places their first two legal tiles for them.
|
||||
Two-tile games started before this rule was relaxed keep the earlier limit: a turn can't both found a chain and cause a merger, in either order (mergers caused by the bank's tiles don't count).
|
||||
|
||||
In a two-player game, the bank's tiles are placed right after the merger that drew them, so between your two tiles if your first tile caused it. If a player leaves, the game places their first two legal tiles for them.
|
||||
|
||||
## Mergers
|
||||
|
||||
|
|
@ -73,6 +75,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 +95,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
|
||||
|
|
@ -126,20 +136,28 @@ With two players, the bank also acts as a shareholder whenever bonuses are paid.
|
|||
|
||||
## What you can see
|
||||
|
||||
Your tiles are private. Unless the game was created with **public holdings**, each player's cash and shares are private too; the game log is 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
|
||||
|
||||
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.
|
||||
|
||||
## Game options
|
||||
|
||||
- **Limited game log:** the log shows only what happened since your last turn, until the game ends (see above).
|
||||
- **Two tiles per turn:** hands of 8 tiles and two tiles placed every turn (see above).
|
||||
- **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).
|
||||
- **Tiles in hand:** 6 (standard), 8, 10 or 12 tiles in each hand, with or without two tiles per turn.
|
||||
- **Shares per turn:** buy up to 3 (standard), 4 or 5 shares in total per turn, independently of stock swaps.
|
||||
- **Stock swap:** optional 1:1 exchanges with the bank before buying; Off / 3 / 5 / 7 / Unlimited shares per turn (see above).
|
||||
- **Public holdings:** everyone's cash and shares are visible.
|
||||
- **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.
|
||||
- **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.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Publishing Acquire on boardgamers.space
|
||||
|
||||
Acquire is already registered as game **`acquire`**, BGS version **`1`**, and is **public**
|
||||
(verified 27 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.
|
||||
|
||||
|
|
@ -146,8 +146,10 @@ do not replace other declarations from an old local snapshot.
|
|||
|
||||
Current declaration sources are in [admin/gameinfo.json](admin/gameinfo.json):
|
||||
|
||||
- Six options: public holdings, team play, two-player mode, automatic ending, end size,
|
||||
and **Stock swap: Off / 3 / 5 / 7 / Unlimited**, default Off.
|
||||
- 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**,
|
||||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -19,4 +19,11 @@ export * from "./src/replay.js";
|
|||
export * from "./src/position.js";
|
||||
export * from "./src/simple.js";
|
||||
export { logWindowStart } from "./src/limited-log.js";
|
||||
export { blockedThisTurn, secondPlacementDue, turnPlacements } from "./src/two-tiles.js";
|
||||
export {
|
||||
blockedThisTurn,
|
||||
secondPlacementDue,
|
||||
turnPlacements,
|
||||
twoTileLimit,
|
||||
type TwoTileLimit,
|
||||
} from "./src/two-tiles.js";
|
||||
export { draftCanContinue } from "./src/turn-draft.js";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "acquire-engine",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.6",
|
||||
"description": "Acquire rules engine for boardgamers.space",
|
||||
"license": "AGPL-3.0-only",
|
||||
"files": [
|
||||
|
|
|
|||
106
packages/engine/src/hand-size.spec.ts
Normal file
106
packages/engine/src/hand-size.spec.ts
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { legalMoves } from "./legal.js";
|
||||
import { applyMove } from "./moves.js";
|
||||
import { positionAt } from "./position.js";
|
||||
import { initGame } from "./setup.js";
|
||||
import { chainAt, checkInvariants, row, scenario, t } from "./test/helpers.js";
|
||||
import type { GameState, Move } from "./types.js";
|
||||
import * as wrapper from "../wrapper.js";
|
||||
|
||||
const place = (tile: string): Move => ({ type: "place", tile });
|
||||
const buy: Move = { type: "buy", shares: {} };
|
||||
|
||||
function play(state: GameState, seat: number, move: Move): GameState {
|
||||
applyMove(state, move, seat);
|
||||
checkInvariants(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
test("§15 handSize: every seat is dealt the chosen hand in every mode and player count", () => {
|
||||
for (const handSize of ["6", "8", "10", "12"]) {
|
||||
for (const twoTiles of [false, true]) {
|
||||
for (let players = 2; players <= 6; players++) {
|
||||
const modes = players === 2 ? ["bank", "fourHands"] : ["bank"];
|
||||
for (const twoPlayerMode of modes) {
|
||||
const state = initGame(
|
||||
players,
|
||||
{ ...(twoTiles && { twoTiles }), ...(players === 4 && { teamPlay: true }), twoPlayerMode, handSize },
|
||||
`deal-${handSize}-${players}-${twoPlayerMode}-${twoTiles}`
|
||||
);
|
||||
checkInvariants(state);
|
||||
const size = Number(handSize);
|
||||
assert.ok(state.seats.every((seat) => seat.hand.length === size));
|
||||
assert.ok(positionAt(state, state.log.length).seats.every((seat) => seat.tiles === size));
|
||||
const view = wrapper.stripSecret(state, 0);
|
||||
assert.ok(
|
||||
view.seats.every((seat) => seat.hand.length === size),
|
||||
"masked hands keep their size"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Six hands of 12 plus six turn-order tiles still leave 30 of the 108 tiles to draw.
|
||||
assert.equal(initGame(6, { handSize: "12" }, "deal-max").pool.length, 30);
|
||||
});
|
||||
|
||||
test("§15 handSize: the hand refills to the chosen size after a turn", () => {
|
||||
const hand = ["5E", "9G", "11G", "3I", "6I", "9I", "1G", "1I", "12A", "12C"];
|
||||
const state = scenario({ hands: [hand, ["12E"]], poolTop: ["12G", "12I"], options: { handSize: "10" } });
|
||||
play(state, 0, place("5E"));
|
||||
assert.equal(state.seats[0]!.hand.length, 10);
|
||||
assert.ok(state.seats[0]!.hand.includes(t("12G")));
|
||||
assert.ok(!state.seats[0]!.hand.includes(t("12I")));
|
||||
});
|
||||
|
||||
test("§15 handSize: dead tiles are replaced up to the chosen size", () => {
|
||||
const state = scenario({
|
||||
board: { ...chainAt("tower", row("A", 1, 11)), ...chainAt("continental", row("C", 1, 11)) },
|
||||
hands: [["1B", "10G", "12E", "12G", "12I", "10I", "8I", "6I", "4I", "2I", "8G", "6G"], ["5E"]],
|
||||
options: { handSize: "12" },
|
||||
});
|
||||
play(state, 0, place("10G"));
|
||||
play(state, 0, buy);
|
||||
assert.ok(state.removed.includes(t("1B")));
|
||||
assert.equal(state.seats[0]!.hand.length, 12);
|
||||
assert.deepEqual(state.log.filter((entry) => entry.type === "drew").at(-1), { type: "drew", seat: 0, count: 2 });
|
||||
});
|
||||
|
||||
test("§15 handSize with twoTiles: both tiles are placed, then the hand refills to the chosen size", () => {
|
||||
const state = scenario({
|
||||
board: chainAt("tower", ["1A", "2A"]),
|
||||
hands: [["5E", "9I", "12A", "12C", "12E", "12G"], ["10C"], ["10E"]],
|
||||
poolTop: ["7G", "7I"],
|
||||
options: { twoTiles: true, handSize: "6" },
|
||||
});
|
||||
assert.equal(state.options.handSize, 6);
|
||||
play(state, 0, place("5E"));
|
||||
play(state, 0, place("9I"));
|
||||
play(state, 0, buy);
|
||||
assert.equal(state.seats[0]!.hand.length, 6);
|
||||
assert.deepEqual(state.seats[0]!.hand.slice(-2), [t("7G"), t("7I")]);
|
||||
});
|
||||
|
||||
/** Plays a random game to the end, checking invariants after every move, and replays it. */
|
||||
function playToEnd(players: number, options: Record<string, unknown>, seed: string): GameState {
|
||||
const state = wrapper.init(players, [], options, seed);
|
||||
for (let step = 0; !state.ended; step++) {
|
||||
assert.ok(step < 5000, `${seed} did not finish`);
|
||||
const moves = legalMoves(state);
|
||||
const others = moves.filter((move) => move.type !== "announce");
|
||||
const choices = others.length > 0 && step % 23 !== 0 ? others : moves;
|
||||
wrapper.move(state, choices[(step * 7919) % choices.length]!, wrapper.currentPlayer(state)!);
|
||||
checkInvariants(state);
|
||||
}
|
||||
assert.deepEqual(wrapper.replay(structuredClone(state)), state, `§14.7 ${seed} replays exactly`);
|
||||
return state;
|
||||
}
|
||||
|
||||
test("§14.8 handSize 12: full games finish and replay with 6 players, two-player bank mode and four hands", () => {
|
||||
playToEnd(6, { handSize: "12" }, "hand-12-six");
|
||||
playToEnd(6, { handSize: "12", twoTiles: true }, "hand-12-six-two-tiles");
|
||||
playToEnd(2, { handSize: "12", twoPlayerMode: "bank" }, "hand-12-bank");
|
||||
playToEnd(2, { handSize: "12", twoPlayerMode: "fourHands", twoTiles: true }, "hand-12-four-hands");
|
||||
playToEnd(4, { handSize: "10", teamPlay: true, publicHoldings: true }, "hand-10-teams");
|
||||
});
|
||||
|
|
@ -8,7 +8,7 @@ import { parseTile } from "./tiles.js";
|
|||
import { chainAt, scenario } from "./test/helpers.js";
|
||||
import type { GameState, LogEntry } from "./types.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";
|
||||
|
||||
const OPTION_SETS: Record<string, unknown>[] = [
|
||||
|
|
@ -17,8 +17,14 @@ const OPTION_SETS: Record<string, unknown>[] = [
|
|||
{ teamPlay: true },
|
||||
{ twoPlayerMode: "fourHands" },
|
||||
{ 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 {
|
||||
let s = seed >>> 0;
|
||||
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. */
|
||||
function withoutSecrets(state: GameState, player: number | undefined): unknown {
|
||||
const own = seatsOf(state, player);
|
||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
||||
const level = visibilityNow(state);
|
||||
return {
|
||||
...state,
|
||||
seed: "",
|
||||
rngCounter: 0,
|
||||
pool: state.pool.length,
|
||||
seats: state.seats.map((seat, index) =>
|
||||
own.includes(index)
|
||||
? seat
|
||||
: {
|
||||
...seat,
|
||||
hand: seat.hand.length,
|
||||
...(holdingsPublic ? {} : { cash: "hidden", shares: "hidden" }),
|
||||
}
|
||||
),
|
||||
seats: state.seats.map((seat, index) => {
|
||||
if (own.includes(index)) {
|
||||
return seat;
|
||||
}
|
||||
const { shareCount: _, ...rest } = seat;
|
||||
return {
|
||||
...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)) {
|
||||
const view = wrapper.stripSecret(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.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),
|
||||
"§13 other players' hands are private"
|
||||
);
|
||||
if (holdingsPublic) {
|
||||
assert.equal(seat.cash, state.seats[index]!.cash);
|
||||
if (level === "private") {
|
||||
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);
|
||||
} else {
|
||||
assert.equal(seat.cash, HIDDEN, "§13 other players' cash is private");
|
||||
assert.ok(
|
||||
CHAIN_IDS.every((chain) => seat.shares[chain] === HIDDEN),
|
||||
"§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>;
|
||||
|
|
@ -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]!;
|
||||
[opponent.hand[0], variant.pool[0]] = [variant.pool[0]!, opponent.hand[0]!];
|
||||
}
|
||||
if (!state.options.publicHoldings && !state.ended) {
|
||||
variant.seats.forEach((seat, index) => {
|
||||
if (!own.includes(index)) {
|
||||
seat.cash += 100;
|
||||
seat.shares.tower += 1;
|
||||
const level = visibilityNow(state);
|
||||
variant.seats.forEach((seat, index) => {
|
||||
if (own.includes(index) || level === "public") {
|
||||
return;
|
||||
}
|
||||
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(
|
||||
JSON.stringify(wrapper.stripSecret(variant, player)),
|
||||
JSON.stringify(wrapper.stripSecret(state, player)),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { logWindowStart } from "./limited-log.js";
|
|||
import { applyMove, currentSeat } from "./moves.js";
|
||||
import { normalizeOptions } from "./options.js";
|
||||
import { initGame } from "./setup.js";
|
||||
import { simpleLine } from "./simple.js";
|
||||
import type { GameState, LogEntry } from "./types.js";
|
||||
|
||||
const LIMITED = { limitedLog: true };
|
||||
|
|
@ -43,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");
|
||||
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
||||
const active = state.activeSeat;
|
||||
for (let player = 0; player < 4; player++) {
|
||||
const start = nthLastTurn(state, 5);
|
||||
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);
|
||||
assert.equal(view.log.length, state.log.length, "the log keeps its length for turn drafts");
|
||||
const turns = turnIndexes(state, player);
|
||||
// While it is your turn, the window starts at your previous one.
|
||||
const start = player === active ? turns.at(-2)! : turns.at(-1)!;
|
||||
assert.equal(logWindowStart(state, player), start);
|
||||
view.log.forEach((entry, index) => {
|
||||
const setup = ["init", "optionIgnored", "turnOrder"].includes(state.log[index]!.type);
|
||||
assert.deepEqual(entry, index >= start || setup ? state.log[index] : { type: "hidden" }, `entry ${index}`);
|
||||
});
|
||||
assert.deepEqual(view.log, spectator, "every seat and spectators see the same window");
|
||||
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(
|
||||
wrapper.stripSecret(state, undefined).log,
|
||||
wrapper.stripSecret(state, active).log,
|
||||
"spectators see what the active player sees"
|
||||
state.log.slice(start).flatMap((entry) => (entry.type === "turn" ? [entry.seat] : [])),
|
||||
[1, 2, 3, 0, 1],
|
||||
"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", () => {
|
||||
|
|
@ -84,6 +128,19 @@ test("§13 limitedLog: a merger in progress stays fully visible to every dispose
|
|||
assert.ok(disposals > 0, "the game reached a stock disposal");
|
||||
});
|
||||
|
||||
test("§13 limitedLog: visible turn summaries cannot reveal an earlier hidden turn", () => {
|
||||
const state = initGame(4, LIMITED, "summary-window");
|
||||
playUntil(state, lcg(2), (s) => s.turn > 14 && s.phase === "place");
|
||||
const start = logWindowStart(state);
|
||||
for (const player of [0, 1, 2, 3, undefined]) {
|
||||
assert.ok(start > 0);
|
||||
const view = wrapper.stripSecret(state, player);
|
||||
assert.equal(view.log[start - 1]!.type, "hidden");
|
||||
const slice = wrapper.logSlice(state, { player, start, end: start }).log;
|
||||
assert.equal(slice[0]!.simple, simpleLine(state, state.log[start]!));
|
||||
}
|
||||
});
|
||||
|
||||
test("§13 limitedLog: the whole log is revealed once the game ends", () => {
|
||||
const state = initGame(3, LIMITED, "revealed");
|
||||
playUntil(state, lcg(3));
|
||||
|
|
|
|||
|
|
@ -1,37 +1,31 @@
|
|||
import type { GameState, LogEntry } from "./types.js";
|
||||
import { seatsOf } from "./view.js";
|
||||
|
||||
/** Setup entries describe options and turn order, not play, so they always stay visible. */
|
||||
const SETUP: LogEntry["type"][] = ["init", "optionIgnored", "turnOrder"];
|
||||
|
||||
/**
|
||||
* rules.md §13 limitedLog: the first log index `player` may read (undefined for a
|
||||
* spectator). Players see from the start of their own last turn before the current one, so
|
||||
* the current turn, including a merger in progress, is always visible. Spectators see as much
|
||||
* as the active player. The whole log is visible when the option is off or the game is over.
|
||||
* rules.md §13 limitedLog: the first log index anyone may read. Every player and spectator
|
||||
* sees the same window: the current turn, including a merger in progress, and the full round
|
||||
* of turns before it (one turn per seat, so four in fourHands). It always reaches back at least
|
||||
* 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) {
|
||||
return 0;
|
||||
}
|
||||
const own = player === undefined ? [state.activeSeat] : seatsOf(state, player);
|
||||
let current = true;
|
||||
let turns = 0;
|
||||
for (let index = state.log.length - 1; index >= 0; index--) {
|
||||
const entry = state.log[index]!;
|
||||
if (entry.type !== "turn") {
|
||||
continue;
|
||||
}
|
||||
if (!current && own.includes(entry.seat)) {
|
||||
if (state.log[index]!.type === "turn" && ++turns > state.seats.length) {
|
||||
return index;
|
||||
}
|
||||
current = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** The log as `player` may read it: earlier entries become placeholders, keeping its length. */
|
||||
export function visibleLog(state: GameState, player: number | undefined): LogEntry[] {
|
||||
const start = logWindowStart(state, player);
|
||||
/** The log as anyone may read it: earlier entries become placeholders, keeping its length. */
|
||||
export function visibleLog(state: GameState): LogEntry[] {
|
||||
const start = logWindowStart(state);
|
||||
return state.log.map((entry, index) =>
|
||||
index >= start || SETUP.includes(entry.type) ? structuredClone(entry) : { type: "hidden" }
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -16,9 +17,15 @@ import { sharePrice } from "./prices.js";
|
|||
import { canAnnounce, endGame } from "./scoring.js";
|
||||
import { parseTile, tileLabel, type Tile } from "./tiles.js";
|
||||
import { afterPlacement, endTurn, enterBuyPhase } from "./turn.js";
|
||||
import { blockedThisTurn } from "./two-tiles.js";
|
||||
import { twoTileLimit, type TwoTileLimit } from "./two-tiles.js";
|
||||
import type { GameState, Move, Shares } from "./types.js";
|
||||
|
||||
const TWO_TILE_LIMIT_ERRORS: Record<TwoTileLimit, string> = {
|
||||
oneFounding: "A turn cannot found two chains",
|
||||
mergeFounded: "A turn cannot merge the chain it founded",
|
||||
foundOrMerge: "A turn cannot both found a chain and cause a merger",
|
||||
};
|
||||
|
||||
export function currentSeat(state: GameState): number | undefined {
|
||||
if (state.ended) {
|
||||
return undefined;
|
||||
|
|
@ -87,8 +94,9 @@ export function sanitizeMove(state: GameState, raw: unknown, seat: number): Move
|
|||
if (tileLegality(state.board, tile) !== "playable") {
|
||||
throw new Error(`Tile ${tileLabel(tile)} cannot be played now`);
|
||||
}
|
||||
if (blockedThisTurn(state, tile)) {
|
||||
throw new Error("A turn cannot found two chains, or both found a chain and cause a merger");
|
||||
const limit = twoTileLimit(state, tile);
|
||||
if (limit !== undefined) {
|
||||
throw new Error(TWO_TILE_LIMIT_ERRORS[limit]);
|
||||
}
|
||||
return { type: "place", tile: tileLabel(tile) };
|
||||
}
|
||||
|
|
@ -160,8 +168,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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
});
|
||||
|
||||
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", () => {
|
||||
const state = scenario({
|
||||
seats: 2,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@ export interface NetWorth {
|
|||
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 {
|
||||
if (!state.ended && !state.options.publicHoldings) {
|
||||
return undefined;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,14 @@ import assert from "node:assert/strict";
|
|||
import { test } from "node:test";
|
||||
import { endConditionHolds } from "./board.js";
|
||||
import { applyMove } from "./moves.js";
|
||||
import { DEFAULT_OPTIONS, normalizeOptions } from "./options.js";
|
||||
import { legalMoves } from "./legal.js";
|
||||
import {
|
||||
DEFAULT_OPTIONS,
|
||||
PUBLIC_HOLDINGS_OVERRIDE,
|
||||
handSize,
|
||||
holdingsVisibility,
|
||||
normalizeOptions,
|
||||
} from "./options.js";
|
||||
import { sharePrice } from "./prices.js";
|
||||
import { initGame } from "./setup.js";
|
||||
import { chainAt, checkInvariants, row, scenario } from "./test/helpers.js";
|
||||
|
|
@ -93,6 +100,45 @@ test("§3.5 options are never rejected: unknown values are ignored and logged",
|
|||
assert.doesNotThrow(() => wrapper.init(2, [], { teamPlay: true, twoPlayerMode: "fourHands", endSize: 7 }, "x"));
|
||||
});
|
||||
|
||||
test("§15 handSize: missing keeps the legacy hand of 6, or 8 with twoTiles, and leaves the init log unchanged", () => {
|
||||
assert.equal("handSize" in normalizeOptions(3, {}).options, false);
|
||||
assert.equal(handSize(normalizeOptions(3, {}).options), 6);
|
||||
assert.equal("handSize" in normalizeOptions(3, { twoTiles: true }).options, false);
|
||||
assert.equal(handSize(normalizeOptions(3, { twoTiles: true }).options), 8);
|
||||
const init = initGame(3, {}, "no-hand-size").log[0] as Extract<LogEntry, { type: "init" }>;
|
||||
assert.deepEqual(init.options, DEFAULT_OPTIONS);
|
||||
});
|
||||
|
||||
test("§15 handSize: every size is read as BGS sends it, alone or with twoTiles; the legacy size is omitted", () => {
|
||||
for (const twoTiles of [false, true]) {
|
||||
const legacy = twoTiles ? 8 : 6;
|
||||
for (const size of [6, 8, 10, 12]) {
|
||||
for (const sent of [String(size), size]) {
|
||||
const { options, ignored } = normalizeOptions(3, { ...(twoTiles && { twoTiles }), handSize: sent });
|
||||
assert.deepEqual(ignored, []);
|
||||
assert.equal(handSize(options), size);
|
||||
assert.equal(options.handSize, size === legacy ? undefined : size);
|
||||
assert.equal("handSize" in options, size !== legacy, `handSize ${sent} with twoTiles ${twoTiles}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.deepEqual(normalizeOptions(3, { handSize: "10" }).options, { ...DEFAULT_OPTIONS, handSize: 10 });
|
||||
});
|
||||
|
||||
test("§15 handSize: unknown values are ignored and logged, keeping the legacy size", () => {
|
||||
for (const value of ["7", 7, "", "eight", "08", " 8", 6.5, 14, true, null, ["8"]]) {
|
||||
for (const twoTiles of [false, true]) {
|
||||
const state = initGame(3, { ...(twoTiles && { twoTiles }), handSize: value }, "bad-hand-size");
|
||||
assert.equal("handSize" in state.options, false);
|
||||
assert.deepEqual(
|
||||
ignoredLog(state).map((e) => [e.option, e.value, e.reason]),
|
||||
[["handSize", value, "unknown value"]]
|
||||
);
|
||||
assert.ok(state.seats.every((seat) => seat.hand.length === (twoTiles ? 8 : 6)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("§15 endSize 31: a 31-tile chain meets the end condition; safe size and prices are unchanged", () => {
|
||||
const tiles = [...row("A", 1, 12), ...row("B", 1, 12), ...row("C", 1, 7)];
|
||||
const board = scenario({ board: chainAt("tower", tiles), hands: [["9I"]] }).board;
|
||||
|
|
@ -206,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.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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,16 +1,31 @@
|
|||
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 {
|
||||
/** Full public holdings (rules.md §13), also the highest holdingsVisibility level. */
|
||||
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;
|
||||
twoPlayerMode: "bank" | "fourHands";
|
||||
autoEnd: boolean;
|
||||
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 at the legacy size (6, or 8 with twoTiles), so games created before it replay. */
|
||||
handSize?: 6 | 8 | 10 | 12;
|
||||
/**
|
||||
* Set with twoTiles in games created under the relaxed founding/merger limits (rules.md
|
||||
* §4.1). Two-tile games logged before them lack it and keep the original limits.
|
||||
*/
|
||||
twoTilesRelaxed?: true;
|
||||
/** Omitted when off, like stockSwap. */
|
||||
limitedLog?: true;
|
||||
}
|
||||
|
|
@ -30,21 +45,59 @@ export const DEFAULT_OPTIONS: GameOptions = {
|
|||
};
|
||||
|
||||
const END_SIZES = [41, 31];
|
||||
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
|
||||
* selects (as strings), so a missing checkbox means false. Options are never rejected
|
||||
* (rules.md §3.5/§15): anything that does not apply, or has an unknown value, is ignored
|
||||
* and reported so the log can say so.
|
||||
* and reported so the log can say so. Replay passes the options `recorded` in the game's
|
||||
* init log, so games created under an earlier rule revision rebuild with that revision.
|
||||
*/
|
||||
export function normalizeOptions(
|
||||
players: number,
|
||||
raw: Record<string, unknown>
|
||||
raw: Record<string, unknown>,
|
||||
recorded?: Partial<GameOptions>
|
||||
): { options: GameOptions; ignored: IgnoredOption[] } {
|
||||
const options: GameOptions = { ...DEFAULT_OPTIONS };
|
||||
const ignored: IgnoredOption[] = [];
|
||||
|
||||
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;
|
||||
|
||||
if (raw.teamPlay === true) {
|
||||
|
|
@ -84,8 +137,29 @@ 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;
|
||||
if (recorded === undefined || recorded.twoTilesRelaxed === true) {
|
||||
options.twoTilesRelaxed = true;
|
||||
}
|
||||
}
|
||||
if (raw.handSize !== undefined) {
|
||||
if (HAND_SIZES.includes(raw.handSize as number | string)) {
|
||||
const size = Number(raw.handSize) as 6 | 8 | 10 | 12;
|
||||
if (size !== legacyHandSize(options)) {
|
||||
options.handSize = size;
|
||||
}
|
||||
} else {
|
||||
ignored.push({ option: "handSize", value: raw.handSize, reason: "unknown value" });
|
||||
}
|
||||
}
|
||||
if (raw.limitedLog === true) {
|
||||
options.limitedLog = true;
|
||||
|
|
@ -94,11 +168,21 @@ export function normalizeOptions(
|
|||
return { options, ignored };
|
||||
}
|
||||
|
||||
/** rules.md §15 twoTiles: hands hold 8 tiles instead of 6. */
|
||||
export function handSize(options: GameOptions): number {
|
||||
/** Total purchases across all chains, independent of stock swaps and tile placements. */
|
||||
export function sharePurchaseLimit(options: GameOptions): number {
|
||||
return options.sharesPerTurn ?? MAX_BUY;
|
||||
}
|
||||
|
||||
/** Games created before the handSize option hold 6 tiles, or 8 with twoTiles. */
|
||||
function legacyHandSize(options: GameOptions): number {
|
||||
return options.twoTiles ? TWO_TILE_HAND_SIZE : HAND_SIZE;
|
||||
}
|
||||
|
||||
/** rules.md §15 handSize: the number of tiles each seat draws up to. */
|
||||
export function handSize(options: GameOptions): number {
|
||||
return options.handSize ?? legacyHandSize(options);
|
||||
}
|
||||
|
||||
/** Internal seats per real player: fourHands gives each of the 2 players two seats. */
|
||||
export function seatOwners(players: number, options: GameOptions): number[] {
|
||||
if (players === 2 && options.twoPlayerMode === "fourHands") {
|
||||
|
|
|
|||
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);
|
||||
}
|
||||
});
|
||||
|
|
@ -15,7 +15,7 @@ export function replayGame(data: GameState, to: number = data.log.length): GameS
|
|||
if (!data.seed || first?.type !== "init") {
|
||||
throw new Error("Replay needs the full game state, including the seed");
|
||||
}
|
||||
const state = initGame(first.players, first.rawOptions, data.seed);
|
||||
const state = initGame(first.players, first.rawOptions, data.seed, first.options);
|
||||
checkLog(state, data, 0);
|
||||
while (state.log.length < to) {
|
||||
const checked = state.log.length;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,10 @@ export function playerRankings(state: GameState): number[] {
|
|||
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[] {
|
||||
if (!state.ended && !state.options.publicHoldings) {
|
||||
return Array.from({ length: state.players }, () => 0);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { CHAIN_IDS, MAX_PLAYERS, MIN_PLAYERS, SHARES_PER_CHAIN, STARTING_CASH } from "./config.js";
|
||||
import { handSize, normalizeOptions, seatOwners } from "./options.js";
|
||||
import { handSize, normalizeOptions, seatOwners, type GameOptions } from "./options.js";
|
||||
import { shuffle } from "./prng.js";
|
||||
import { allTiles } from "./tiles.js";
|
||||
import { drawTile, startTurn } from "./turn.js";
|
||||
|
|
@ -9,12 +9,20 @@ function sharesOf(count: number): Shares {
|
|||
return Object.fromEntries(CHAIN_IDS.map((chain) => [chain, count])) as Shares;
|
||||
}
|
||||
|
||||
/** Creates a game for `players` real players; fourHands gives each of them two seats. */
|
||||
export function initGame(players: number, rawOptions: Record<string, unknown>, seed: string): GameState {
|
||||
/**
|
||||
* Creates a game for `players` real players; fourHands gives each of them two seats. Replay
|
||||
* passes the init log's `recorded` options to keep the rules the game was created with.
|
||||
*/
|
||||
export function initGame(
|
||||
players: number,
|
||||
rawOptions: Record<string, unknown>,
|
||||
seed: string,
|
||||
recorded?: Partial<GameOptions>
|
||||
): GameState {
|
||||
if (!Number.isInteger(players) || players < MIN_PLAYERS || players > MAX_PLAYERS) {
|
||||
throw new Error(`Acquire needs ${MIN_PLAYERS} to ${MAX_PLAYERS} players`);
|
||||
}
|
||||
const { options, ignored } = normalizeOptions(players, rawOptions);
|
||||
const { options, ignored } = normalizeOptions(players, rawOptions, recorded);
|
||||
const seatOwner = seatOwners(players, options);
|
||||
const seats = seatOwner.length;
|
||||
const state: GameState = {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ export function simpleLineAt(state: GameState, index: number): string {
|
|||
export function turnSummary(state: GameState, index: number): string {
|
||||
let start = index - 1;
|
||||
while (start >= 0 && state.log[start]!.type !== "turn") {
|
||||
if (state.log[start]!.type === "hidden") {
|
||||
return simpleLine(state, state.log[index]!);
|
||||
}
|
||||
start--;
|
||||
}
|
||||
if (start < 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);
|
||||
});
|
||||
|
||||
test("§9.6 with public holdings the buy step is skipped when the player cannot afford any share", () => {
|
||||
const state = scenario({
|
||||
board: chainAt("tower", ["1A", "2A"]),
|
||||
hands: [["9G"], ["11G"]],
|
||||
cash: [100],
|
||||
options: { publicHoldings: true },
|
||||
});
|
||||
play(state, 0, place("9G"));
|
||||
assert.equal(state.activeSeat, 1);
|
||||
assert.equal(state.phase, "place");
|
||||
test("§9.6 with public cash the buy step is skipped when the player cannot afford any share", () => {
|
||||
for (const options of [
|
||||
{ publicHoldings: true },
|
||||
{ holdingsVisibility: "public" },
|
||||
{ holdingsVisibility: "cash" },
|
||||
{ holdingsVisibility: "cashAndShareCount" },
|
||||
]) {
|
||||
const state = scenario({ board: chainAt("tower", ["1A", "2A"]), hands: [["9G"], ["11G"]], cash: [100], options });
|
||||
play(state, 0, place("9G"));
|
||||
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", () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { activeChains, chainSize, playableTiles, tileLegality } from "./board.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 { canAnnounce, endConditionMet, endGame } from "./scoring.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
|
||||
* 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 {
|
||||
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)) {
|
||||
return true;
|
||||
}
|
||||
const cashIsPublic = state.options.publicHoldings;
|
||||
const cashKnown = cashIsPublic(state.options);
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import * as wrapper from "../wrapper.js";
|
|||
import { legalMoves } from "./legal.js";
|
||||
import { applyMove, currentSeat, dropPlayerSeats } from "./moves.js";
|
||||
import { normalizeOptions } from "./options.js";
|
||||
import { blockedThisTurn, turnPlacements, twoTileLimit } from "./two-tiles.js";
|
||||
import { positionAt } from "./position.js";
|
||||
import { initGame } from "./setup.js";
|
||||
import { turnSummary } from "./simple.js";
|
||||
|
|
@ -82,41 +83,61 @@ test("§15 twoTiles: the second tile is skipped when none is playable", () => {
|
|||
assert.deepEqual(placeable(state), []);
|
||||
});
|
||||
|
||||
test("§15 twoTiles: after founding, a tile that would found or merge is blocked; growing is allowed", () => {
|
||||
const state = scenario({
|
||||
board: { ...chainAt("tower", ["1E", "2E"]), ...chainAt("luxor", ["4E", "5E"]), "8A": "loose", "1A": "loose" },
|
||||
hands: [["9A", "3E", "6E", "2A"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
assert.deepEqual(placeable(state), ["9A", "3E", "6E", "2A"]);
|
||||
play(state, 0, place("9A"));
|
||||
play(state, 0, { type: "found", chain: "american" });
|
||||
assert.deepEqual(placeable(state), ["6E"]);
|
||||
for (const tile of ["3E", "2A"]) {
|
||||
assert.throws(() => applyMove(state, place(tile), 0), /cannot found two chains/);
|
||||
}
|
||||
play(state, 0, place("6E"));
|
||||
assert.equal(state.phase, "buy");
|
||||
});
|
||||
// Two pairs of chains to merge, and loose tiles to found a chain next to.
|
||||
const LIMITS_BOARD = {
|
||||
...chainAt("tower", ["1A", "2A"]),
|
||||
...chainAt("luxor", ["4A", "5A"]),
|
||||
...chainAt("american", ["1E", "2E"]),
|
||||
...chainAt("festival", ["4E", "5E"]),
|
||||
"8G": "loose",
|
||||
"1I": "loose",
|
||||
} as const;
|
||||
|
||||
test("§15 twoTiles: a turn may cause two mergers, but not a merger and a founding", () => {
|
||||
test("§4.1 twoTiles: a merger with the first tile, then a founding with the second, is allowed", () => {
|
||||
const state = scenario({
|
||||
board: {
|
||||
...chainAt("tower", ["1A", "2A"]),
|
||||
...chainAt("luxor", ["4A", "5A"]),
|
||||
...chainAt("american", ["1E", "2E"]),
|
||||
...chainAt("festival", ["4E", "5E"]),
|
||||
"8G": "loose",
|
||||
},
|
||||
hands: [["3A", "3E", "9G"], ["12C"], ["12E"]],
|
||||
board: LIMITS_BOARD,
|
||||
hands: [["3A", "9G"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
play(state, 0, place("3A"));
|
||||
play(state, 0, { type: "survivor", chain: "tower" });
|
||||
assert.equal(state.phase, "place");
|
||||
assert.deepEqual(placeable(state), ["3E"], "9G would found a chain after a merger");
|
||||
assert.deepEqual(placeable(state), ["9G"]);
|
||||
play(state, 0, place("9G"));
|
||||
play(state, 0, { type: "found", chain: "worldwide" });
|
||||
assert.equal(state.phase, "buy");
|
||||
play(state, 0, buy);
|
||||
assert.equal(turnSummary(state, state.log.length - 1), "Player 1 merged Luxor into Tower, founded Worldwide");
|
||||
});
|
||||
|
||||
test("§4.1 twoTiles: a founding with the first tile, then a merger of two other chains, is allowed", () => {
|
||||
const state = scenario({
|
||||
board: LIMITS_BOARD,
|
||||
hands: [["9G", "3A", "3E"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
play(state, 0, place("9G"));
|
||||
play(state, 0, { type: "found", chain: "worldwide" });
|
||||
assert.deepEqual(placeable(state), ["3A", "3E"]);
|
||||
play(state, 0, place("3E"));
|
||||
play(state, 0, { type: "survivor", chain: "american" });
|
||||
assert.equal(state.phase, "buy");
|
||||
play(state, 0, buy);
|
||||
assert.equal(turnSummary(state, state.log.length - 1), "Player 1 founded Worldwide, merged Festival into American");
|
||||
});
|
||||
|
||||
test("§4.1 twoTiles: a merger, then another merger, is allowed", () => {
|
||||
const state = scenario({
|
||||
board: LIMITS_BOARD,
|
||||
hands: [["3A", "3E", "9G"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
play(state, 0, place("3A"));
|
||||
play(state, 0, { type: "survivor", chain: "tower" });
|
||||
assert.deepEqual(placeable(state), ["3E", "9G"]);
|
||||
play(state, 0, place("3E"));
|
||||
play(state, 0, { type: "survivor", chain: "american" });
|
||||
assert.equal(state.phase, "buy");
|
||||
|
|
@ -127,16 +148,53 @@ test("§15 twoTiles: a turn may cause two mergers, but not a merger and a foundi
|
|||
);
|
||||
});
|
||||
|
||||
test("§15 twoTiles: a founding first rules out a merger with the second tile", () => {
|
||||
test("§4.1 twoTiles: a turn cannot found two chains; growing the new chain is allowed", () => {
|
||||
const state = scenario({
|
||||
board: { ...chainAt("tower", ["1A", "2A"]), ...chainAt("luxor", ["4A", "5A"]), "8G": "loose" },
|
||||
hands: [["9G", "3A"], ["12C"], ["12E"]],
|
||||
board: LIMITS_BOARD,
|
||||
hands: [["9G", "2I", "10G"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
play(state, 0, place("9G"));
|
||||
play(state, 0, { type: "found", chain: "american" });
|
||||
assert.deepEqual(placeable(state), [], "3A would merge after a founding");
|
||||
play(state, 0, { type: "found", chain: "worldwide" });
|
||||
assert.equal(twoTileLimit(state, t("2I")), "oneFounding");
|
||||
assert.throws(() => applyMove(state, place("2I"), 0), /cannot found two chains/);
|
||||
assert.deepEqual(placeable(state), ["10G"]);
|
||||
play(state, 0, place("10G"));
|
||||
assert.equal(state.phase, "buy");
|
||||
});
|
||||
|
||||
test("§4.1 twoTiles: the second tile cannot merge the chain founded this turn", () => {
|
||||
// 9G founds a chain with 8G; 7G would then merge it with Imperial.
|
||||
const state = scenario({
|
||||
board: { ...LIMITS_BOARD, ...chainAt("imperial", ["6G", "6H"]) },
|
||||
hands: [["9G", "7G", "3A"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
assert.equal(twoTileLimit(state, t("7G")), undefined);
|
||||
play(state, 0, place("9G"));
|
||||
play(state, 0, { type: "found", chain: "worldwide" });
|
||||
assert.equal(twoTileLimit(state, t("7G")), "mergeFounded");
|
||||
assert.equal(twoTileLimit(state, t("3A")), undefined);
|
||||
assert.throws(() => applyMove(state, place("7G"), 0), /cannot merge the chain it founded/);
|
||||
assert.deepEqual(placeable(state), ["3A"]);
|
||||
play(state, 0, place("3A"));
|
||||
play(state, 0, { type: "survivor", chain: "luxor" });
|
||||
play(state, 0, buy);
|
||||
assert.equal(twoTileLimit(state, t("7G")), undefined, "the limit ends with the turn");
|
||||
});
|
||||
|
||||
test("§4.1 twoTiles: the second tile is skipped when only a merger with the new chain remains", () => {
|
||||
const state = scenario({
|
||||
board: { ...LIMITS_BOARD, ...chainAt("imperial", ["6G", "6H"]) },
|
||||
hands: [["9G", "7G"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
});
|
||||
play(state, 0, place("9G"));
|
||||
play(state, 0, { type: "found", chain: "worldwide" });
|
||||
assert.deepEqual(placeable(state), []);
|
||||
assert.equal(state.phase, "buy");
|
||||
});
|
||||
|
||||
|
|
@ -239,6 +297,7 @@ test("§15 twoTiles: both placements can be drafted privately before committing"
|
|||
options: TWO_TILES,
|
||||
});
|
||||
const player = 0;
|
||||
const original = structuredClone(state);
|
||||
const draft = wrapper.move(
|
||||
state,
|
||||
{ type: "turn", from: state.log.length, moves: [place("5E"), place("9I")] },
|
||||
|
|
@ -247,6 +306,22 @@ test("§15 twoTiles: both placements can be drafted privately before committing"
|
|||
assert.equal(draft.phase, "buy");
|
||||
assert.deepEqual(draft.tentative, { player, from: state.log.length });
|
||||
assert.equal(wrapper.toSave(draft), undefined);
|
||||
assert.deepEqual(wrapper.timeIncrements(draft), [0, 0, 0]);
|
||||
for (let revision = 0; revision < 3; revision++) {
|
||||
const revised = wrapper.move(state, { type: "turn", from: state.log.length, moves: [place("9I")] }, player);
|
||||
assert.equal(revised.phase, "place");
|
||||
assert.equal(wrapper.toSave(revised), undefined);
|
||||
assert.deepEqual(wrapper.timeIncrements(revised), [0, 0, 0]);
|
||||
assert.deepEqual(state, original);
|
||||
}
|
||||
const committed = wrapper.move(
|
||||
state,
|
||||
{ type: "turn", from: state.log.length, moves: [place("5E"), place("9I"), buy] },
|
||||
player
|
||||
);
|
||||
assert.equal(wrapper.toSave(committed), committed);
|
||||
assert.deepEqual(wrapper.timeIncrements(committed), [1, 0, 0]);
|
||||
assert.equal(committed.log.filter((entry) => entry.type === "move").length, 3);
|
||||
});
|
||||
|
||||
test("§14.7 twoTiles games replay exactly", () => {
|
||||
|
|
@ -258,3 +333,76 @@ test("§14.7 twoTiles games replay exactly", () => {
|
|||
}
|
||||
assert.deepEqual(wrapper.replay(state), state);
|
||||
});
|
||||
|
||||
/** Two-tile games created before the relaxed limits have no `twoTilesRelaxed` option. */
|
||||
function legacy(state: GameState): GameState {
|
||||
delete state.options.twoTilesRelaxed;
|
||||
const init = state.log[0];
|
||||
if (init?.type === "init") {
|
||||
delete init.options.twoTilesRelaxed;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
test("§4.1 twoTiles: new games record the relaxed limits; replay keeps a game's own revision", () => {
|
||||
assert.equal(normalizeOptions(3, TWO_TILES).options.twoTilesRelaxed, true);
|
||||
assert.equal("twoTilesRelaxed" in normalizeOptions(3, {}).options, false);
|
||||
assert.equal("twoTilesRelaxed" in normalizeOptions(3, TWO_TILES, { twoTiles: true }).options, false);
|
||||
assert.equal(normalizeOptions(3, TWO_TILES, { twoTiles: true, twoTilesRelaxed: true }).options.twoTilesRelaxed, true);
|
||||
assert.equal("twoTilesRelaxed" in normalizeOptions(3, {}, { twoTilesRelaxed: true }).options, false);
|
||||
});
|
||||
|
||||
test("§4.1 twoTiles in games created before the relaxed limits: no founding and merger in one turn", () => {
|
||||
const foundThenMerge = legacy(
|
||||
scenario({
|
||||
board: LIMITS_BOARD,
|
||||
hands: [["9G", "3A", "12A"], ["12C"], ["12E"]],
|
||||
poolOnly: true,
|
||||
options: TWO_TILES,
|
||||
})
|
||||
);
|
||||
play(foundThenMerge, 0, place("9G"));
|
||||
play(foundThenMerge, 0, { type: "found", chain: "worldwide" });
|
||||
assert.equal(twoTileLimit(foundThenMerge, t("3A")), "foundOrMerge");
|
||||
assert.throws(() => applyMove(foundThenMerge, place("3A"), 0), /cannot both found a chain and cause a merger/);
|
||||
assert.deepEqual(placeable(foundThenMerge), ["12A"]);
|
||||
|
||||
const mergeThenFound = legacy(
|
||||
scenario({ board: LIMITS_BOARD, hands: [["3A", "9G", "3E"], ["12C"], ["12E"]], poolOnly: true, options: TWO_TILES })
|
||||
);
|
||||
play(mergeThenFound, 0, place("3A"));
|
||||
play(mergeThenFound, 0, { type: "survivor", chain: "tower" });
|
||||
assert.equal(twoTileLimit(mergeThenFound, t("9G")), "foundOrMerge");
|
||||
assert.deepEqual(placeable(mergeThenFound), ["3E"], "two mergers are still allowed");
|
||||
});
|
||||
|
||||
test("§4.1 twoTiles in games created before the relaxed limits: bank-caused mergers do not count", () => {
|
||||
const state = legacy(
|
||||
scenario({ board: LIMITS_BOARD, hands: [["12A", "9G"], ["12C"], ["12E"]], poolOnly: true, options: TWO_TILES })
|
||||
);
|
||||
play(state, 0, place("12A"));
|
||||
state.log.push({ type: "merger", seat: 0, tile: t("3A"), sizes: { tower: 2, luxor: 2 }, byBank: true });
|
||||
assert.equal(turnPlacements(state).merged, false);
|
||||
assert.equal(twoTileLimit(state, t("9G")), undefined);
|
||||
state.log.push({ type: "merger", seat: 0, tile: t("3E"), sizes: { american: 2, festival: 2 } });
|
||||
assert.equal(turnPlacements(state).merged, true);
|
||||
assert.equal(twoTileLimit(state, t("9G")), "foundOrMerge");
|
||||
});
|
||||
|
||||
test("§14.7 twoTiles games created before the relaxed limits replay under them", () => {
|
||||
const state = legacy(initGame(3, TWO_TILES, "legacy-two-tiles"));
|
||||
let differs = false;
|
||||
for (let i = 0; i < 400 && !state.ended; i++) {
|
||||
if (state.phase === "place") {
|
||||
const relaxed = { ...state, options: { ...state.options, twoTilesRelaxed: true as const } };
|
||||
differs ||= state.seats[state.activeSeat]!.hand.some(
|
||||
(tile) => blockedThisTurn(state, tile) && !blockedThisTurn(relaxed, tile)
|
||||
);
|
||||
}
|
||||
const moves = legalMoves(state).filter((move) => move.type !== "announce");
|
||||
play(state, currentSeat(state)!, moves[(i * 7919) % moves.length]!);
|
||||
}
|
||||
assert.ok(differs, "the game reaches a turn where the original limits block a tile");
|
||||
assert.equal("twoTilesRelaxed" in state.options, false);
|
||||
assert.deepEqual(wrapper.replay(structuredClone(state)), state);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
import { placementEffect } from "./board.js";
|
||||
import type { ChainId } from "./config.js";
|
||||
import type { Tile } from "./tiles.js";
|
||||
import type { GameState } from "./types.js";
|
||||
|
||||
/** What the active seat's placements have done so far this turn, read from the log. */
|
||||
export function turnPlacements(state: GameState): { placed: number; founded: boolean; merged: boolean } {
|
||||
const result = { placed: 0, founded: false, merged: false };
|
||||
/**
|
||||
* Why rules.md §15 twoTiles rules out a tile this turn: `oneFounding` (a second founding),
|
||||
* `mergeFounded` (a merger involving the chain founded this turn), or, in games created
|
||||
* under the original limits, `foundOrMerge` (a founding and a merger in one turn).
|
||||
*/
|
||||
export type TwoTileLimit = "oneFounding" | "mergeFounded" | "foundOrMerge";
|
||||
|
||||
/**
|
||||
* What the active seat's placements have done so far this turn, read from the log: how many
|
||||
* tiles it placed, the chain it founded (if any) and whether it caused a merger.
|
||||
*/
|
||||
export function turnPlacements(state: GameState): { placed: number; founded: ChainId | null; merged: boolean } {
|
||||
const result: { placed: number; founded: ChainId | null; merged: boolean } = {
|
||||
placed: 0,
|
||||
founded: null,
|
||||
merged: false,
|
||||
};
|
||||
for (let i = state.log.length - 1; i >= 0; i--) {
|
||||
const entry = state.log[i]!;
|
||||
if (entry.type === "turn") {
|
||||
|
|
@ -13,7 +28,7 @@ export function turnPlacements(state: GameState): { placed: number; founded: boo
|
|||
if (entry.type === "move" && entry.move.type === "place") {
|
||||
result.placed++;
|
||||
} else if (entry.type === "founded") {
|
||||
result.founded = true;
|
||||
result.founded = entry.chain;
|
||||
} else if (entry.type === "merger" && !entry.byBank) {
|
||||
// rules.md §15 twoTiles: mergers caused by bank tiles do not count.
|
||||
result.merged = true;
|
||||
|
|
@ -23,16 +38,30 @@ export function turnPlacements(state: GameState): { placed: number; founded: boo
|
|||
}
|
||||
|
||||
/**
|
||||
* rules.md §15 twoTiles: a turn founds at most one chain, and never both founds a chain and
|
||||
* causes a merger. Whether `tile` is ruled out by what this turn's placements already did.
|
||||
* rules.md §4.1: a turn founds at most one chain, and its second tile cannot merge the chain
|
||||
* its first tile founded. Games created before the relaxed limits (no `twoTilesRelaxed`)
|
||||
* also forbid founding and merging in the same turn, in either order.
|
||||
*/
|
||||
export function blockedThisTurn(state: GameState, tile: Tile): boolean {
|
||||
export function twoTileLimit(state: GameState, tile: Tile): TwoTileLimit | undefined {
|
||||
if (!state.options.twoTiles) {
|
||||
return false;
|
||||
return undefined;
|
||||
}
|
||||
const { founded, merged } = turnPlacements(state);
|
||||
const effect = placementEffect(state.board, tile).kind;
|
||||
return (effect === "found" && (founded || merged)) || (effect === "merge" && founded);
|
||||
const effect = placementEffect(state.board, tile);
|
||||
if (effect.kind === "found" && founded !== null) {
|
||||
return "oneFounding";
|
||||
}
|
||||
if (!state.options.twoTilesRelaxed) {
|
||||
return (effect.kind === "found" && merged) || (effect.kind === "merge" && founded !== null)
|
||||
? "foundOrMerge"
|
||||
: undefined;
|
||||
}
|
||||
return effect.kind === "merge" && founded !== null && effect.chains.includes(founded) ? "mergeFounded" : undefined;
|
||||
}
|
||||
|
||||
/** Whether `tile` is ruled out by what this turn's placements already did (rules.md §4.1). */
|
||||
export function blockedThisTurn(state: GameState, tile: Tile): boolean {
|
||||
return twoTileLimit(state, tile) !== undefined;
|
||||
}
|
||||
|
||||
/** rules.md §15 twoTiles: whether the active seat places another tile before buying. */
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ export interface SeatState {
|
|||
name: string;
|
||||
cash: number;
|
||||
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[];
|
||||
dropped: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { CHAIN_IDS } from "./config.js";
|
||||
import { visibleLog } from "./limited-log.js";
|
||||
import { holdingsVisibility, type HoldingsVisibility } from "./options.js";
|
||||
import type { GameState, Shares } from "./types.js";
|
||||
|
||||
/** 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] : []));
|
||||
}
|
||||
|
||||
/** 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
|
||||
* 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.
|
||||
* With limitedLog, older log entries are replaced. The seed is removed because it determines
|
||||
* the pool order.
|
||||
* private; other seats' cash and holdings are shown as far as the holdings level allows
|
||||
* (maskHoldings), and fully once the game has ended. With limitedLog, older log entries are
|
||||
* replaced. The seed is removed because it determines the pool order.
|
||||
*/
|
||||
export function viewFor(state: GameState, player: number | undefined): GameState {
|
||||
const own = seatsOf(state, player);
|
||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
||||
const level = visibilityNow(state);
|
||||
return {
|
||||
...structuredClone(state),
|
||||
seed: "",
|
||||
rngCounter: 0,
|
||||
pool: state.pool.map(() => HIDDEN),
|
||||
log: visibleLog(state, player),
|
||||
log: visibleLog(state),
|
||||
seats: state.seats.map((seat, index) => {
|
||||
if (own.includes(index)) {
|
||||
return structuredClone(seat);
|
||||
|
|
@ -35,7 +61,7 @@ export function viewFor(state: GameState, player: number | undefined): GameState
|
|||
return {
|
||||
...structuredClone(seat),
|
||||
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" });
|
||||
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]);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { applyMove, currentSeat, dropPlayerSeats } from "./src/moves.js";
|
|||
import { replayGame } from "./src/replay.js";
|
||||
import { playerRankings, playerScores } from "./src/scoring.js";
|
||||
import { initGame } from "./src/setup.js";
|
||||
import { simpleLine, simpleLineAt } from "./src/simple.js";
|
||||
import { simpleLineAt } from "./src/simple.js";
|
||||
import type { GameState, LogEntry } from "./src/types.js";
|
||||
import { seatsOf, viewFor } from "./src/view.js";
|
||||
|
||||
|
|
@ -73,8 +73,8 @@ export interface LogSliceOptions {
|
|||
}
|
||||
|
||||
// Both endpoints are inclusive. The log is public (rules.md §13) except with limitedLog, where
|
||||
// entries before the player's window are placeholders. Each entry gets a `simple` line for
|
||||
// BGS's last-move display.
|
||||
// entries before the shared window (the current turn and the round before it) are placeholders
|
||||
// for every viewer. Each entry gets a `simple` line for BGS's last-move display.
|
||||
export function logSlice(
|
||||
data: GameState,
|
||||
options?: LogSliceOptions
|
||||
|
|
@ -84,11 +84,13 @@ export function logSlice(
|
|||
} {
|
||||
const start = Math.max(0, options?.start ?? 0);
|
||||
const end = options?.end ?? data.log.length - 1;
|
||||
const log = visibleLog(data, options?.player);
|
||||
const log = visibleLog(data);
|
||||
// Summaries must use the same filtered history: a visible turn can follow hidden moves.
|
||||
const shown = { ...data, log };
|
||||
return {
|
||||
log: log.slice(start, end + 1).map((entry, i) => ({
|
||||
...entry,
|
||||
simple: entry.type === "hidden" ? simpleLine(data, entry) : simpleLineAt(data, start + i),
|
||||
simple: simpleLineAt(shown, start + i),
|
||||
})),
|
||||
...(data.tentative && data.tentative.player === options?.player
|
||||
? { preview: stripSecret(data, options.player) }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "acquire-viewer",
|
||||
"version": "0.0.17",
|
||||
"version": "0.0.19",
|
||||
"private": true,
|
||||
"description": "Browser viewer for Acquire on boardgamers.space",
|
||||
"license": "AGPL-3.0-only",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
import Chat from "./lib/Chat.svelte";
|
||||
import Hand from "./lib/Hand.svelte";
|
||||
import Log from "./lib/Log.svelte";
|
||||
import PlaceConfirm from "./lib/PlaceConfirm.svelte";
|
||||
import Players from "./lib/Players.svelte";
|
||||
import PriceTable from "./lib/PriceTable.svelte";
|
||||
import Status from "./lib/Status.svelte";
|
||||
|
|
@ -17,32 +18,43 @@
|
|||
<main class="acquire" data-theme={store.theme} lang={store.locale} dir={store.rightToLeft ? "rtl" : "ltr"}>
|
||||
{#if store.state}
|
||||
{@const state = store.view!}
|
||||
<!-- Each column stacks its panels independently on wider screens, so a short panel never stretches
|
||||
to the board's height; phones place the panels individually (the columns are display: contents). -->
|
||||
<div class="layout">
|
||||
<div class="controls">
|
||||
<Status {state} seats={store.seats} />
|
||||
<ActionPanel {store} />
|
||||
<div class="column turn-column">
|
||||
<div class="controls">
|
||||
<Status {state} seats={store.seats} />
|
||||
<ActionPanel {store} />
|
||||
</div>
|
||||
{#if store.seats.length > 0 && store.replayAt === undefined}
|
||||
<div class="hand">
|
||||
<Hand {store} />
|
||||
<div class="hand-confirm"><PlaceConfirm {store} nearHand /></div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="market">
|
||||
<ChainTable {state} seats={store.seats} />
|
||||
<PriceTable {state} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="board">
|
||||
<Board
|
||||
{state}
|
||||
selected={store.selected}
|
||||
onplace={(tile) => store.send({ type: "place", tile: tileLabel(tile) })}
|
||||
/>
|
||||
<div class="column board-column">
|
||||
<div class="board">
|
||||
<Board
|
||||
{state}
|
||||
selected={store.selected}
|
||||
onplace={(tile) => store.send({ type: "place", tile: tileLabel(tile) })}
|
||||
/>
|
||||
</div>
|
||||
<div class="players">
|
||||
<Players {state} seats={store.seats} />
|
||||
</div>
|
||||
</div>
|
||||
{#if store.seats.length > 0 && store.replayAt === undefined}
|
||||
<div class="hand"><Hand {store} /></div>
|
||||
{/if}
|
||||
<div class="market">
|
||||
<ChainTable {state} seats={store.seats} />
|
||||
<PriceTable {state} />
|
||||
<div class="column talk-column">
|
||||
<div class="history"><Log {state} /></div>
|
||||
{#if !store.analysis}
|
||||
<div class="conversation"><Chat /></div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="players">
|
||||
<Players {state} seats={store.seats} />
|
||||
</div>
|
||||
{#if !store.analysis}
|
||||
<div class="conversation"><Chat /></div>
|
||||
{/if}
|
||||
<div class="history"><Log {state} /></div>
|
||||
</div>
|
||||
{:else}
|
||||
<p>{store.lang.t("loading")}</p>
|
||||
|
|
@ -50,7 +62,7 @@
|
|||
</main>
|
||||
|
||||
<style>
|
||||
/* Keep the decision and board together on narrow screens. */
|
||||
/* Phones: one column that keeps the decision, board and hand together. */
|
||||
.layout {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
|
|
@ -58,7 +70,11 @@
|
|||
grid-template-areas: "controls" "board" "hand" "market" "players" "conversation" "history";
|
||||
align-items: start;
|
||||
}
|
||||
.layout > div {
|
||||
.column {
|
||||
display: contents;
|
||||
}
|
||||
.column,
|
||||
.column > div {
|
||||
min-width: 0;
|
||||
}
|
||||
.controls {
|
||||
|
|
@ -87,29 +103,47 @@
|
|||
.history {
|
||||
grid-area: history;
|
||||
}
|
||||
/* Tablets and phones in landscape: the board beside the decision and hand. */
|
||||
/* Tablets and phones in landscape: the board and players beside the decision, hand and chains;
|
||||
history and chat below. */
|
||||
@media (min-width: 700px) {
|
||||
.layout {
|
||||
grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
|
||||
grid-template-areas:
|
||||
"board controls"
|
||||
"board hand"
|
||||
"market players"
|
||||
"history conversation";
|
||||
grid-template-rows: auto 1fr auto auto;
|
||||
grid-template-areas: "main turn" "history conversation";
|
||||
}
|
||||
.board-column,
|
||||
.turn-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
.board-column {
|
||||
grid-area: main;
|
||||
}
|
||||
.turn-column {
|
||||
grid-area: turn;
|
||||
}
|
||||
/* Placing a tile needs no second confirmation here: the decision is right above the hand. */
|
||||
.hand-confirm {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
/* Desktop: keep the market beside the board; spread the supporting panels across a second row
|
||||
instead of letting chat and history make one very tall sidebar. */
|
||||
/* Desktop: three independent columns (board and players; decision, hand and chains; history and
|
||||
chat), so none of them leaves an empty area beside the board. */
|
||||
@media (min-width: 1200px) {
|
||||
.layout {
|
||||
row-gap: 16px;
|
||||
grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr) minmax(320px, 1fr);
|
||||
grid-template-areas:
|
||||
"board controls market"
|
||||
"board hand market"
|
||||
"players history conversation";
|
||||
grid-template-rows: auto 1fr auto;
|
||||
grid-template-areas: "main turn talk";
|
||||
}
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.market {
|
||||
gap: 8px;
|
||||
}
|
||||
.talk-column {
|
||||
grid-area: talk;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Local dev harness (not part of the BGS bundle): runs the real engine in the page, plays
|
||||
// random moves on request, and lets you view the game as any player or as a spectator.
|
||||
// URL parameters: players=2..6, seed=..., view=N, hotseat=0, theme=light|dark, locale=de, and any game option, e.g. publicHoldings=1,
|
||||
// twoPlayerMode=fourHands, teamPlay=1, autoEnd=1, endSize=31. For reproducible screenshots: moves=N plays N random moves,
|
||||
// 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.
|
||||
import * as rules from "acquire-engine";
|
||||
import { currentSeat, legalMoves, type GameState } from "acquire-engine";
|
||||
|
|
@ -34,7 +34,7 @@ for (const key of ["publicHoldings", "teamPlay", "autoEnd", "twoTiles", "limited
|
|||
options[key] = true;
|
||||
}
|
||||
}
|
||||
for (const key of ["twoPlayerMode", "endSize", "stockSwap"]) {
|
||||
for (const key of ["holdingsVisibility", "twoPlayerMode", "endSize", "stockSwap", "sharesPerTurn", "handSize"]) {
|
||||
const value = params.get(key);
|
||||
if (value) {
|
||||
options[key] = value;
|
||||
|
|
|
|||
|
|
@ -6,24 +6,22 @@
|
|||
currentSeat,
|
||||
merger,
|
||||
sharePrice,
|
||||
tileLabel,
|
||||
sharePurchaseLimit,
|
||||
type ChainId,
|
||||
type Move,
|
||||
type Shares,
|
||||
} from "acquire-engine";
|
||||
import ChainMark from "./ChainMark.svelte";
|
||||
import HoldingChange from "./HoldingChange.svelte";
|
||||
import PlaceConfirm from "./PlaceConfirm.svelte";
|
||||
import StockSwap from "./StockSwap.svelte";
|
||||
import TurnSummary from "./TurnSummary.svelte";
|
||||
import UndoButton from "./UndoButton.svelte";
|
||||
import { mergerPreview } from "./mergerPreview";
|
||||
import {
|
||||
adjustShares,
|
||||
canBuy,
|
||||
canDispose,
|
||||
describePlacement,
|
||||
disposalPresets,
|
||||
nextDefunctChoices,
|
||||
ofType,
|
||||
} from "./decisions";
|
||||
import { adjustShares, canBuy, canDispose, disposalPresets, nextDefunctChoices, ofType } from "./decisions";
|
||||
import { chainName } from "./format";
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
import { holdingsAfter, moveEffect } from "./turn-summary";
|
||||
|
||||
let { store }: { store: ViewerStore } = $props();
|
||||
|
||||
|
|
@ -39,15 +37,20 @@
|
|||
let confirmAnnounce = $state(false);
|
||||
let swapOpen = $state(false);
|
||||
let order = $state<ChainId[]>([]);
|
||||
let survivor = $state<ChainId | undefined>();
|
||||
let sell = $state(0);
|
||||
let trade = $state(0);
|
||||
// Keeping every share must be chosen as deliberately as selling or trading.
|
||||
let chosen = $state(false);
|
||||
let shares = $state<Partial<Shares>>({});
|
||||
$effect(() => {
|
||||
void store.state;
|
||||
confirmAnnounce = false;
|
||||
order = [];
|
||||
survivor = undefined;
|
||||
sell = 0;
|
||||
trade = 0;
|
||||
chosen = false;
|
||||
shares = {};
|
||||
});
|
||||
|
||||
|
|
@ -65,34 +68,69 @@
|
|||
const maxTrade = $derived(presets.trade?.trade ?? 0);
|
||||
const tradeValue = $derived((maxTrade / 2) * (afterMerger?.price ?? 0) - maxTrade * sellPrice);
|
||||
const valueChange = $derived(`${tradeValue < 0 ? "−" : "+"}${money(Math.abs(tradeValue))}`);
|
||||
const keep = $derived(held - sell - trade);
|
||||
const disposal = $derived<Move>({ type: "dispose", sell, trade });
|
||||
const disposalLegal = $derived(canDispose(moves, sell, trade));
|
||||
const disposalAfter = $derived.by(() => {
|
||||
const effect = disposing && disposalLegal ? moveEffect(game, disposal) : undefined;
|
||||
if (!effect) {
|
||||
return undefined;
|
||||
}
|
||||
const after = holdingsAfter(game, effect);
|
||||
return { ...after, shares: after.shares.filter(({ chain }) => chain === disposing || chain === m!.survivor) };
|
||||
});
|
||||
/** "Sell 3 for $1,200, trade 4 for 2 American and keep 1 Luxor" */
|
||||
const disposalLabel = $derived.by(() => {
|
||||
if (!disposing || !m) {
|
||||
return "";
|
||||
}
|
||||
const actions = [
|
||||
sell > 0 ? t("dispose.doSell", { count: sell, amount: money(sell * sellPrice) }) : "",
|
||||
trade > 0 ? t("dispose.doTrade", { give: trade, receive: trade / 2, chain: chainName(m.survivor!) }) : "",
|
||||
keep > 0 && keep === held ? t("dispose.doKeepAll", { count: keep, chain: chainName(disposing) }) : "",
|
||||
keep > 0 && keep < held ? t("dispose.doKeep", { count: keep, chain: chainName(disposing) }) : "",
|
||||
].filter(Boolean);
|
||||
const text = lang.list(actions);
|
||||
return text.charAt(0).toLocaleUpperCase(lang.locale) + text.slice(1);
|
||||
});
|
||||
|
||||
const mergingChains = $derived(m ? CHAIN_IDS.filter((chain) => m.sizes[chain] !== undefined) : []);
|
||||
// The decision this phase would send, to tell the player when Undo stops at it.
|
||||
const decision = $derived.by((): Move | undefined => {
|
||||
if (game.phase === "survivor") {
|
||||
return ofType(moves, "survivor").find((move) => move.chain === survivor) ?? ofType(moves, "survivor")[0];
|
||||
}
|
||||
if (game.phase === "defunctOrder") {
|
||||
return ofType(moves, "defunctOrder")[0];
|
||||
}
|
||||
if (game.phase === "dispose") {
|
||||
return disposalLegal ? disposal : ofType(moves, "dispose")[0];
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
const lastUndo = $derived(!!decision && store.drafting && !!store.outcome(decision)?.commits);
|
||||
|
||||
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));
|
||||
|
||||
function placeSelected(): void {
|
||||
if (store.selected !== undefined) {
|
||||
store.send({ type: "place", tile: tileLabel(store.selected) });
|
||||
const cash = $derived(seat === undefined ? 0 : game.seats[seat]!.cash);
|
||||
/** Why one more share of `chain` cannot be added, beyond the shared purchase limit. */
|
||||
function buyBlocked(chain: ChainId): string | undefined {
|
||||
if (total >= buyLimit || canBuy(moves, adjustShares(shares, chain, 1))) {
|
||||
return undefined;
|
||||
}
|
||||
return game.bank[chain] - (shares[chain] ?? 0) <= 0 ? t("buy.soldOut") : t("buy.cantAfford");
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if moves.length > 0 && !store.sending}
|
||||
{#if store.reviewing}
|
||||
<TurnSummary {store} />
|
||||
{:else if moves.length > 0 && !store.sending}
|
||||
<section class="panel" class:disposal={game.phase === "dispose"} aria-label={t("panel.label")}>
|
||||
{#if store.canUndo}
|
||||
<button type="button" class="actionable undo" onclick={() => store.undo()}>
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
aria-hidden="true"><path d="M9 4 3 10l6 6M3 10h11a7 7 0 0 1 0 14" transform="translate(0 -2)" /></svg
|
||||
>
|
||||
{t("turn.undo")}
|
||||
</button>
|
||||
<UndoButton {store} />
|
||||
{/if}
|
||||
{#if legal("announce")}
|
||||
<div class="announce">
|
||||
|
|
@ -113,18 +151,7 @@
|
|||
|
||||
{#if game.phase === "place"}
|
||||
{#if store.selected !== undefined}
|
||||
<p>
|
||||
{t("place.effect", {
|
||||
tile: tileLabel(store.selected),
|
||||
effect: describePlacement(game, store.selected, lang),
|
||||
})}
|
||||
</p>
|
||||
<button type="button" class="actionable primary" onclick={placeSelected}
|
||||
>{t("place.button", { tile: tileLabel(store.selected) })}</button
|
||||
>
|
||||
<button type="button" class="actionable" onclick={() => (store.selected = undefined)}
|
||||
>{t("place.another")}</button
|
||||
>
|
||||
<PlaceConfirm {store} />
|
||||
{:else if legal("place")}
|
||||
<p>{t("place.choose")}</p>
|
||||
{/if}
|
||||
|
|
@ -148,17 +175,33 @@
|
|||
{:else if game.phase === "survivor" && m}
|
||||
<p>{t("survivor.prompt")}</p>
|
||||
<div class="choices">
|
||||
{#each CHAIN_IDS.filter((chain) => m.sizes[chain] !== undefined) as chain (chain)}
|
||||
{#each mergingChains as chain (chain)}
|
||||
<button
|
||||
type="button"
|
||||
class="choice"
|
||||
class:actionable={survivors.has(chain)}
|
||||
class:chosen={survivor === chain}
|
||||
aria-pressed={survivors.has(chain) ? survivor === chain : undefined}
|
||||
disabled={!survivors.has(chain)}
|
||||
onclick={() => store.send({ type: "survivor", chain })}
|
||||
onclick={() => (survivor = chain)}
|
||||
><ChainMark {chain} withName /> <span class="size">{t("tiles", { count: m.sizes[chain]! })}</span></button
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="primary"
|
||||
class:actionable={survivor !== undefined}
|
||||
disabled={survivor === undefined}
|
||||
onclick={() => survivor && store.send({ type: "survivor", chain: survivor })}
|
||||
>{survivor
|
||||
? t("survivor.confirm", {
|
||||
survivor: chainName(survivor),
|
||||
defunct: lang.list(mergingChains.filter((chain) => chain !== survivor).map(chainName)),
|
||||
})
|
||||
: t("survivor.choose")}</button
|
||||
>
|
||||
{#if lastUndo}<p class="final-note">{t("turn.finalStep")}</p>{/if}
|
||||
{:else if game.phase === "defunctOrder" && m}
|
||||
<p>{t("order.prompt", { survivor: chainName(m.survivor!) })}</p>
|
||||
<div class="choices">
|
||||
|
|
@ -182,7 +225,10 @@
|
|||
class:actionable={orderComplete}
|
||||
disabled={!orderComplete}
|
||||
class="primary"
|
||||
onclick={() => store.send({ type: "defunctOrder", chains: order })}>{t("order.confirm")}</button
|
||||
onclick={() => store.send({ type: "defunctOrder", chains: order })}
|
||||
>{orderComplete
|
||||
? t("order.confirmChains", { chains: lang.list(order.map(chainName)) })
|
||||
: t("order.confirm")}</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -190,6 +236,7 @@
|
|||
disabled={order.length === 0}
|
||||
onclick={() => (order = [])}>{t("order.reset")}</button
|
||||
>
|
||||
{#if lastUndo}<p class="final-note">{t("turn.finalStep")}</p>{/if}
|
||||
{:else if game.phase === "dispose" && disposing && m}
|
||||
<p>
|
||||
{t("dispose.takenOver", { defunct: chainName(disposing), survivor: chainName(m.survivor!) })}
|
||||
|
|
@ -215,10 +262,12 @@
|
|||
type="button"
|
||||
class="preset sell-all"
|
||||
class:actionable={!!presets.sell}
|
||||
aria-pressed={presets.sell ? chosen && sell === held : undefined}
|
||||
disabled={!presets.sell}
|
||||
onclick={() => {
|
||||
sell = presets.sell!.sell;
|
||||
trade = 0;
|
||||
chosen = true;
|
||||
}}
|
||||
>
|
||||
{t("dispose.sellAll")} · <bdi dir="ltr">{money(held * sellPrice)}</bdi>
|
||||
|
|
@ -230,7 +279,10 @@
|
|||
type="button"
|
||||
class:actionable={canDispose(moves, sell - 1, trade)}
|
||||
disabled={!canDispose(moves, sell - 1, trade)}
|
||||
onclick={() => sell--}
|
||||
onclick={() => {
|
||||
sell--;
|
||||
chosen = true;
|
||||
}}
|
||||
aria-label={t("dispose.sellFewer")}>−</button
|
||||
>
|
||||
<span class="value">{sell}</span>
|
||||
|
|
@ -238,7 +290,10 @@
|
|||
type="button"
|
||||
class:actionable={canDispose(moves, sell + 1, trade)}
|
||||
disabled={!canDispose(moves, sell + 1, trade)}
|
||||
onclick={() => sell++}
|
||||
onclick={() => {
|
||||
sell++;
|
||||
chosen = true;
|
||||
}}
|
||||
aria-label={t("dispose.sellMore")}>+</button
|
||||
>
|
||||
<span class="effect">+{money(sell * sellPrice)}</span>
|
||||
|
|
@ -251,10 +306,12 @@
|
|||
type="button"
|
||||
class="preset trade-max"
|
||||
class:actionable={!!presets.trade}
|
||||
aria-pressed={presets.trade ? chosen && sell === 0 && trade === maxTrade : undefined}
|
||||
disabled={!presets.trade}
|
||||
onclick={() => {
|
||||
sell = 0;
|
||||
trade = maxTrade;
|
||||
chosen = true;
|
||||
}}
|
||||
>
|
||||
{#if maxTrade > 0}
|
||||
|
|
@ -264,13 +321,23 @@
|
|||
{t("dispose.trade")}
|
||||
{/if}
|
||||
</button>
|
||||
<small
|
||||
>{maxTrade > 0
|
||||
? t("dispose.tradeRate", { defunct: chainName(disposing), survivor: chainName(m.survivor!) })
|
||||
: held < 2
|
||||
? t("dispose.tradeFew")
|
||||
: t("dispose.tradeNone", { chain: chainName(m.survivor!) })}</small
|
||||
>
|
||||
</div>
|
||||
<div class="quantity">
|
||||
<button
|
||||
type="button"
|
||||
class:actionable={canDispose(moves, sell, trade - 2)}
|
||||
disabled={!canDispose(moves, sell, trade - 2)}
|
||||
onclick={() => (trade -= 2)}
|
||||
onclick={() => {
|
||||
trade -= 2;
|
||||
chosen = true;
|
||||
}}
|
||||
aria-label={t("dispose.tradeFewer")}>−</button
|
||||
>
|
||||
<span class="value">{trade}</span>
|
||||
|
|
@ -278,25 +345,56 @@
|
|||
type="button"
|
||||
class:actionable={canDispose(moves, sell, trade + 2)}
|
||||
disabled={!canDispose(moves, sell, trade + 2)}
|
||||
onclick={() => (trade += 2)}
|
||||
onclick={() => {
|
||||
trade += 2;
|
||||
chosen = true;
|
||||
}}
|
||||
aria-label={t("dispose.tradeMore")}>+</button
|
||||
>
|
||||
<span class="effect">{t("dispose.receive", { count: trade / 2, chain: chainName(m.survivor!) })}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="keep-row">
|
||||
<span class="label">{t("dispose.keep")}</span>
|
||||
<span class="value">{held - sell - trade}</span>
|
||||
<span class="effect">{t("dispose.keepNote", { chain: chainName(disposing) })}</span>
|
||||
<div class="disposal-row">
|
||||
<div class="label">
|
||||
<button
|
||||
type="button"
|
||||
class="preset keep-all actionable"
|
||||
aria-pressed={chosen && keep === held}
|
||||
onclick={() => {
|
||||
sell = 0;
|
||||
trade = 0;
|
||||
chosen = true;
|
||||
}}
|
||||
>{t("dispose.keepAll")}
|
||||
<small>{t("dispose.keepNote", { chain: chainName(disposing) })}</small></button
|
||||
>
|
||||
</div>
|
||||
<div class="quantity keep">
|
||||
<span class="value">{keep}</span>
|
||||
<span class="spacer"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="actionable primary" onclick={() => store.send({ type: "dispose", sell, trade })}
|
||||
>{t("dispose.confirm")}</button
|
||||
>
|
||||
{#if chosen && disposalAfter}
|
||||
<HoldingChange label={t("dispose.after")} cash={disposalAfter.cash} shares={disposalAfter.shares} />
|
||||
{/if}
|
||||
<div class="confirm-row">
|
||||
<button
|
||||
type="button"
|
||||
class="primary"
|
||||
class:actionable={chosen && disposalLegal}
|
||||
disabled={!chosen || !disposalLegal}
|
||||
onclick={() => store.send(disposal)}>{chosen ? disposalLabel : t("dispose.confirm")}</button
|
||||
>
|
||||
<p class="final-note">
|
||||
{#if !chosen}<span>{t("dispose.choose")}</span>{/if}
|
||||
{#if lastUndo}<span>{t("turn.finalStep")}</span>{/if}
|
||||
</p>
|
||||
</div>
|
||||
{: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>
|
||||
|
|
@ -310,8 +408,23 @@
|
|||
{#each buyable as chain (chain)}
|
||||
{@const fewer = adjustShares(shares, chain, -1)}
|
||||
{@const more = adjustShares(shares, chain, 1)}
|
||||
{@const own = game.seats[seat!]!.shares[chain]}
|
||||
{@const why = buyBlocked(chain)}
|
||||
<tr>
|
||||
<td><ChainMark {chain} withName /></td>
|
||||
<td>
|
||||
<ChainMark {chain} withName />
|
||||
{#if own > 0 || shares[chain]}
|
||||
<small class="own"
|
||||
>{t("buy.owned")}
|
||||
<bdi dir="ltr"
|
||||
>{#if shares[chain]}{own}<span class="arrow">→</span>{/if}<strong
|
||||
>{own + (shares[chain] ?? 0)}</strong
|
||||
></bdi
|
||||
></small
|
||||
>
|
||||
{/if}
|
||||
{#if why}<small class="why">{why}</small>{/if}
|
||||
</td>
|
||||
<td class="num">{money(price(chain))}</td>
|
||||
<td class="num">{game.bank[chain]}</td>
|
||||
<td class="num stepper">
|
||||
|
|
@ -337,7 +450,13 @@
|
|||
</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(cash - cost),
|
||||
})}
|
||||
{#if total >= buyLimit}<small class="why">{t("buy.limitReached", { limit: buyLimit })}</small>{/if}
|
||||
</p>
|
||||
<button type="button" class="actionable primary" onclick={() => store.send({ type: "buy", shares })}>
|
||||
{total === 0 ? t("buy.nothing") : t("buy.confirm", { cost: money(cost) })}
|
||||
|
|
@ -364,12 +483,6 @@
|
|||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.panel .undo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
.panel {
|
||||
background: var(--panel);
|
||||
padding: 10px 12px 12px;
|
||||
|
|
@ -379,6 +492,10 @@
|
|||
/* The layout already separates these controls from the hand below. */
|
||||
margin-bottom: 0;
|
||||
}
|
||||
/* Keep a merger decision within one desktop screen, even with touch-sized buttons. */
|
||||
.panel.disposal > p {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.panel p {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
|
@ -423,8 +540,8 @@
|
|||
}
|
||||
.steppers {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
margin: 0 0 8px;
|
||||
gap: 4px;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
.disposal-row {
|
||||
display: grid;
|
||||
|
|
@ -442,16 +559,48 @@
|
|||
grid-column: 1 / -1;
|
||||
text-align: end;
|
||||
}
|
||||
.keep-row {
|
||||
.quantity .spacer {
|
||||
width: 36px;
|
||||
}
|
||||
/* Keep has no stepper: its count lines up with the other counts and its note gets the room. */
|
||||
.quantity.keep {
|
||||
grid-template-columns: 24px auto;
|
||||
}
|
||||
.panel .final-note {
|
||||
margin: 4px 0 0;
|
||||
font-size: 13px;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
/* The disposal confirmation and its notes share a row where there is room. */
|
||||
.confirm-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
column-gap: 4px;
|
||||
}
|
||||
.keep-row .value {
|
||||
min-width: 24px;
|
||||
.confirm-row .final-note {
|
||||
flex: 1 1 180px;
|
||||
display: grid;
|
||||
margin: 0;
|
||||
}
|
||||
.keep-row .effect {
|
||||
direction: inherit;
|
||||
.panel .choice.chosen,
|
||||
.panel .preset[aria-pressed="true"] {
|
||||
box-shadow: inset 0 0 0 2.5px var(--accent);
|
||||
background: var(--panel-alt);
|
||||
font-weight: 600;
|
||||
}
|
||||
.own,
|
||||
.why {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: var(--ink-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.why {
|
||||
font-style: italic;
|
||||
}
|
||||
.own .arrow {
|
||||
margin-inline: 0.25em;
|
||||
}
|
||||
.steppers .preset {
|
||||
width: 100%;
|
||||
|
|
@ -470,7 +619,7 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
.label > small {
|
||||
margin-top: 4px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.steppers button,
|
||||
.stepper button {
|
||||
|
|
@ -530,7 +679,8 @@
|
|||
min-height: 44px;
|
||||
}
|
||||
.steppers button,
|
||||
.stepper button {
|
||||
.stepper button,
|
||||
.quantity .spacer {
|
||||
width: 44px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { HIDDEN, parseTile, sortTiles, tileLabel, tileLegality, type Tile } from "acquire-engine";
|
||||
import { handSize, HIDDEN, parseTile, sortTiles, tileLabel, tileLegality, type Tile } from "acquire-engine";
|
||||
import { ofType, turnLimit } from "./decisions";
|
||||
import { seatName } from "./format";
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
{@const limited = hand.filter((tile) => turnLimit(state, seat, tile) !== undefined)}
|
||||
<section class="hand" aria-label={t("hand.of", { name: seatName(state, seat, store.lang) })}>
|
||||
<h2>{store.seats.length > 1 ? t("hand.seat", { seat: seat + 1 }) : t("hand.yours")}</h2>
|
||||
<div class="tiles" class:eight={state.options.twoTiles}>
|
||||
<div class="tiles" data-size={handSize(state.options)}>
|
||||
{#each hand as tile, index (index)}
|
||||
{@const permanent = dead.includes(tile)}
|
||||
{@const blocked = permanent || paused.includes(tile) || limited.includes(tile)}
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
<span><bdi>{paused.map(tileLabel).join(", ")}</bdi> — {t("hand.eighth")}</span>
|
||||
</li>
|
||||
{/if}
|
||||
{#each ["oneFounding", "foundOrMerge"] as const as limit (limit)}
|
||||
{#each ["oneFounding", "mergeFounded", "foundOrMerge"] as const as limit (limit)}
|
||||
{@const tiles = limited.filter((tile) => turnLimit(state, seat, tile) === limit)}
|
||||
{#if tiles.length}
|
||||
<li class="paused-note">
|
||||
|
|
@ -102,27 +102,52 @@
|
|||
<style>
|
||||
.hand {
|
||||
margin: 12px 0 0;
|
||||
container-type: inline-size;
|
||||
}
|
||||
.hand:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
/* Six tiles fit on one row; the 12px gaps leave room for outlines drawn outside the tiles. */
|
||||
/* Six tiles fit on one row; the 12px gaps leave room for outlines drawn outside the tiles.
|
||||
A row of n 52px tiles needs 64n + 4px; 44px tiles need 56n + 4px. */
|
||||
.tiles {
|
||||
--columns: 6;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, minmax(0, 52px));
|
||||
grid-template-columns: repeat(var(--columns), minmax(0, 52px));
|
||||
gap: 12px;
|
||||
padding: 8px;
|
||||
background: var(--rack);
|
||||
width: max-content;
|
||||
max-width: 100%;
|
||||
}
|
||||
/* Eight tiles (two tiles per turn) take one row where it fits and two rows of four on phones. */
|
||||
.tiles.eight {
|
||||
grid-template-columns: repeat(8, minmax(0, 52px));
|
||||
/* Larger hands take one row where the rack's column fits it, otherwise two even rows. */
|
||||
.tiles[data-size="8"] {
|
||||
--columns: 4;
|
||||
}
|
||||
@media (max-width: 560px) {
|
||||
.tiles.eight {
|
||||
grid-template-columns: repeat(4, minmax(0, 52px));
|
||||
.tiles[data-size="10"] {
|
||||
--columns: 5;
|
||||
}
|
||||
.tiles[data-size="12"] {
|
||||
--columns: 6;
|
||||
}
|
||||
@container (min-width: 516px) {
|
||||
.tiles[data-size="8"] {
|
||||
--columns: 8;
|
||||
}
|
||||
}
|
||||
@container (min-width: 644px) {
|
||||
.tiles[data-size="10"] {
|
||||
--columns: 10;
|
||||
}
|
||||
}
|
||||
@container (min-width: 772px) {
|
||||
.tiles[data-size="12"] {
|
||||
--columns: 12;
|
||||
}
|
||||
}
|
||||
/* Narrow phones: three rows of four rather than tiles below the 44px touch size. */
|
||||
@container (max-width: 339px) {
|
||||
.tiles[data-size="12"] {
|
||||
--columns: 4;
|
||||
}
|
||||
}
|
||||
.tile {
|
||||
|
|
|
|||
75
packages/viewer/src/lib/HoldingChange.svelte
Normal file
75
packages/viewer/src/lib/HoldingChange.svelte
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<script lang="ts">
|
||||
import ChainMark from "./ChainMark.svelte";
|
||||
import type { HoldingChange } from "./turn-summary";
|
||||
import { useStore } from "./store.svelte";
|
||||
|
||||
let {
|
||||
label,
|
||||
cash,
|
||||
shares,
|
||||
onlyChanged = false,
|
||||
}: {
|
||||
label: string;
|
||||
cash: { before: number; after: number };
|
||||
shares: HoldingChange[];
|
||||
/** Hide holdings this action leaves unchanged. */
|
||||
onlyChanged?: boolean;
|
||||
} = $props();
|
||||
const store = useStore();
|
||||
const t = $derived(store.lang.t);
|
||||
const money = $derived(store.lang.money);
|
||||
const shown = $derived(onlyChanged ? shares.filter((change) => change.before !== change.after) : shares);
|
||||
</script>
|
||||
|
||||
<!-- "Cash $6,000 → $5,400 · T 3 → 5": what the player will have once this action is sent. -->
|
||||
<p class="holding-change" aria-live="polite">
|
||||
<span class="label">{label}</span>
|
||||
<span class="item" class:changed={cash.before !== cash.after}
|
||||
>{t("players.cash")}
|
||||
<bdi dir="ltr"
|
||||
>{#if cash.before !== cash.after}{money(cash.before)}<span class="arrow">→</span>{/if}<strong
|
||||
>{money(cash.after)}</strong
|
||||
></bdi
|
||||
></span
|
||||
>
|
||||
{#each shown as change (change.chain)}
|
||||
<span class="item" class:changed={change.before !== change.after}
|
||||
><ChainMark chain={change.chain} small />
|
||||
<bdi dir="ltr"
|
||||
>{#if change.before !== change.after}{change.before}<span class="arrow">→</span>{/if}<strong
|
||||
>{change.after}</strong
|
||||
></bdi
|
||||
></span
|
||||
>
|
||||
{/each}
|
||||
</p>
|
||||
|
||||
<style>
|
||||
.holding-change {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 2px 12px;
|
||||
margin: 0 0 8px;
|
||||
font-size: 14px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.label {
|
||||
flex-basis: 100%;
|
||||
color: var(--ink-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
.item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
white-space: nowrap;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.item.changed {
|
||||
color: var(--ink);
|
||||
}
|
||||
.arrow {
|
||||
margin-inline: 0.25em;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
<script lang="ts">
|
||||
import type { GameState } from "acquire-engine";
|
||||
import { describeEntryParts, type LogPart } from "./format";
|
||||
import { CHAIN_STYLES, themeInk } from "./palette";
|
||||
import { playerColor } from "./playerAppearance";
|
||||
import LogParts from "./LogParts.svelte";
|
||||
import { useStore } from "./store.svelte";
|
||||
|
||||
let { state: game }: { state: GameState } = $props();
|
||||
|
|
@ -41,21 +40,7 @@
|
|||
<ol class="log">
|
||||
{#each showAll ? lines : lines.slice(0, RECENT) as line (line.index)}
|
||||
<li class:turn={line.turn} class:hidden={line.hidden}>
|
||||
{#each line.parts as part}
|
||||
{#if part.kind === "player" || part.kind === "chain"}
|
||||
{@const color =
|
||||
part.kind === "player"
|
||||
? playerColor(game.seatOwner[part.seat] ?? part.seat, store.appearance?.playerColors)
|
||||
: CHAIN_STYLES[part.chain].fill}
|
||||
<span
|
||||
class="name"
|
||||
class:player-name={part.kind === "player"}
|
||||
class:chain-name={part.kind === "chain"}
|
||||
style:--name-ink-light={themeInk(color, "light")}
|
||||
style:--name-ink-dark={themeInk(color, "dark")}>{part.text}</span
|
||||
>
|
||||
{:else if part.kind === "money"}<span class="money">{part.text}</span>{:else}{part.text}{/if}
|
||||
{/each}
|
||||
<LogParts {game} parts={line.parts} />
|
||||
</li>
|
||||
{/each}
|
||||
</ol>
|
||||
|
|
@ -86,14 +71,6 @@
|
|||
color: var(--ink-muted);
|
||||
font-style: italic;
|
||||
}
|
||||
.name,
|
||||
.money {
|
||||
font-weight: 600;
|
||||
}
|
||||
.money {
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.more {
|
||||
margin: 8px 0 0;
|
||||
padding: 6px 12px;
|
||||
|
|
|
|||
37
packages/viewer/src/lib/LogParts.svelte
Normal file
37
packages/viewer/src/lib/LogParts.svelte
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<script lang="ts">
|
||||
import type { GameState } from "acquire-engine";
|
||||
import type { LogPart } from "./format";
|
||||
import { CHAIN_STYLES, themeInk } from "./palette";
|
||||
import { playerColor } from "./playerAppearance";
|
||||
import { useStore } from "./store.svelte";
|
||||
|
||||
let { game, parts }: { game: GameState; parts: LogPart[] } = $props();
|
||||
const store = useStore();
|
||||
</script>
|
||||
|
||||
{#each parts as part}
|
||||
{#if part.kind === "player" || part.kind === "chain"}
|
||||
{@const color =
|
||||
part.kind === "player"
|
||||
? playerColor(game.seatOwner[part.seat] ?? part.seat, store.appearance?.playerColors)
|
||||
: CHAIN_STYLES[part.chain].fill}
|
||||
<span
|
||||
class="name"
|
||||
class:player-name={part.kind === "player"}
|
||||
class:chain-name={part.kind === "chain"}
|
||||
style:--name-ink-light={themeInk(color, "light")}
|
||||
style:--name-ink-dark={themeInk(color, "dark")}>{part.text}</span
|
||||
>
|
||||
{:else if part.kind === "money"}<span class="money">{part.text}</span>{:else}{part.text}{/if}
|
||||
{/each}
|
||||
|
||||
<style>
|
||||
.name,
|
||||
.money {
|
||||
font-weight: 600;
|
||||
}
|
||||
.money {
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
83
packages/viewer/src/lib/PlaceConfirm.svelte
Normal file
83
packages/viewer/src/lib/PlaceConfirm.svelte
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<script lang="ts">
|
||||
import { tileLabel } from "acquire-engine";
|
||||
import { describePlacement } from "./decisions";
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
|
||||
let {
|
||||
store,
|
||||
nearHand = false,
|
||||
}: {
|
||||
store: ViewerStore;
|
||||
/** The copy under the rack on phones, where the decision panel is above the board, out of view. */
|
||||
nearHand?: boolean;
|
||||
} = $props();
|
||||
|
||||
const t = $derived(store.lang.t);
|
||||
const tile = $derived(
|
||||
store.state?.phase === "place" && store.moves.length > 0 && !store.sending ? store.selected : undefined
|
||||
);
|
||||
|
||||
// Placing can cross a commit boundary mid-turn (e.g. paying merger bonuses), ending undo.
|
||||
const final = $derived(
|
||||
tile !== undefined && store.drafting && !!store.outcome({ type: "place", tile: tileLabel(tile) })?.commits
|
||||
);
|
||||
|
||||
let row = $state<HTMLElement>();
|
||||
// Bring the confirmation into view when it opens below a rack at the bottom of the screen.
|
||||
$effect(() => {
|
||||
if (nearHand && row && tile !== undefined && row.getClientRects().length > 0) {
|
||||
const still = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
row.scrollIntoView({ block: "nearest", behavior: still ? "auto" : "smooth" });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if tile !== undefined}
|
||||
<div class="place-confirm" class:near-hand={nearHand} bind:this={row}>
|
||||
<p>{t("place.effect", { tile: tileLabel(tile), effect: describePlacement(store.state!, tile, store.lang) })}</p>
|
||||
<button
|
||||
type="button"
|
||||
class="actionable primary"
|
||||
onclick={() => store.send({ type: "place", tile: tileLabel(tile) })}
|
||||
>{t("place.button", { tile: tileLabel(tile) })}</button
|
||||
>
|
||||
<button type="button" class="actionable" onclick={() => (store.selected = undefined)}>{t("place.another")}</button>
|
||||
{#if final}<p class="final-note">{t("turn.finalStep")}</p>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.place-confirm.near-hand {
|
||||
margin-top: 8px;
|
||||
padding: 10px 12px 12px;
|
||||
background: var(--panel);
|
||||
}
|
||||
p {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
.final-note {
|
||||
margin: 4px 0 0;
|
||||
font-size: 13px;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
button {
|
||||
margin-block: 4px;
|
||||
margin-inline: 0 8px;
|
||||
padding: 6px 12px;
|
||||
min-height: 36px;
|
||||
background: var(--page);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
border: none;
|
||||
}
|
||||
button.primary {
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
button {
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -30,7 +30,8 @@
|
|||
<tbody>
|
||||
{#each state.seats as seat, index (index)}
|
||||
{@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)}>
|
||||
<td>
|
||||
{#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
|
||||
>
|
||||
{: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}
|
||||
<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>
|
||||
{:else if held.length === 0}
|
||||
<span class="none">{t("players.none")}</span>
|
||||
|
|
@ -149,4 +154,7 @@
|
|||
.none {
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.share-count {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,17 @@
|
|||
activeChains,
|
||||
chainSize,
|
||||
sharePrice,
|
||||
sharePurchaseLimit,
|
||||
stockSwapCost,
|
||||
stockSwapsRemaining,
|
||||
type ChainId,
|
||||
} from "acquire-engine";
|
||||
import ChainMark from "./ChainMark.svelte";
|
||||
import HoldingChange from "./HoldingChange.svelte";
|
||||
import { ofType } from "./decisions";
|
||||
import { chainName } from "./format";
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
import { holdingsAfter, moveEffect } from "./turn-summary";
|
||||
|
||||
let { store, open = $bindable(false) }: { store: ViewerStore; open?: boolean } = $props();
|
||||
const game = $derived(store.state!);
|
||||
|
|
@ -18,11 +21,12 @@
|
|||
const money = $derived(store.lang.money);
|
||||
const choices = $derived(ofType(store.moves, "swap"));
|
||||
const active = $derived(activeChains(game.board));
|
||||
const held = $derived(game.seats[game.activeSeat]!.shares);
|
||||
const seat = $derived(game.seats[game.activeSeat]!);
|
||||
const held = $derived(seat.shares);
|
||||
const remaining = $derived(stockSwapsRemaining(game));
|
||||
let from = $state<ChainId>("tower");
|
||||
let to = $state<ChainId>("continental");
|
||||
let count = $state<number | undefined>(1);
|
||||
let count = $state(1);
|
||||
$effect(() => {
|
||||
void store.state;
|
||||
const first = choices[0];
|
||||
|
|
@ -39,7 +43,27 @@
|
|||
const cash = $derived(
|
||||
cost === 0 ? t("swap.even") : t(cost > 0 ? "swap.pay" : "swap.receive", { amount: money(Math.abs(cost)) })
|
||||
);
|
||||
const price = (chain: ChainId) => money(sharePrice(chain, chainSize(game.board, chain)));
|
||||
// Chains off the board have no price; they are never offered, but the defaults may name one.
|
||||
const priceOf = (chain: ChainId) => (active.includes(chain) ? sharePrice(chain, chainSize(game.board, chain)) : 0);
|
||||
const after = $derived.by(() => {
|
||||
const effect = selected && moveEffect(game, selected);
|
||||
return effect ? holdingsAfter(game, effect) : undefined;
|
||||
});
|
||||
/** Why this pair cannot be swapped at all, most specific reason first. */
|
||||
const blocked = $derived.by(() => {
|
||||
if (remaining <= 0) {
|
||||
return t("swap.noneLeft");
|
||||
}
|
||||
if (!active.includes(from) || !active.includes(to)) {
|
||||
return t("swap.unavailable");
|
||||
}
|
||||
if (game.bank[to] <= 0) {
|
||||
return t("swap.bankEmpty", { chain: chainName(to) });
|
||||
}
|
||||
return priceOf(to) > priceOf(from) && seat.cash < priceOf(to) - priceOf(from)
|
||||
? t("swap.cash")
|
||||
: t("swap.unavailable");
|
||||
});
|
||||
</script>
|
||||
|
||||
<details class="stock-swap" bind:open>
|
||||
|
|
@ -48,7 +72,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
|
||||
|
|
@ -62,7 +86,13 @@
|
|||
}}
|
||||
>
|
||||
{#each active.filter((chain) => held[chain] > 0) as chain (chain)}
|
||||
<option value={chain}>{chainName(chain)} · {held[chain]} · {price(chain)}</option>
|
||||
<option value={chain}
|
||||
>{t("swap.optionGive", {
|
||||
chain: chainName(chain),
|
||||
count: held[chain],
|
||||
price: money(priceOf(chain)),
|
||||
})}</option
|
||||
>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
|
|
@ -70,26 +100,76 @@
|
|||
>{t("swap.take")}
|
||||
<select aria-label={t("swap.take")} bind:value={to} onchange={() => (count = 1)}>
|
||||
{#each active.filter((chain) => chain !== from) as chain (chain)}
|
||||
<option value={chain}>{chainName(chain)} · {game.bank[chain]} · {price(chain)}</option>
|
||||
<option value={chain}
|
||||
>{t("swap.optionTake", {
|
||||
chain: chainName(chain),
|
||||
count: game.bank[chain],
|
||||
price: money(priceOf(chain)),
|
||||
})}</option
|
||||
>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="swap-controls">
|
||||
<label>{t("swap.count")}<input type="number" min="1" {max} step="1" bind:value={count} /></label>
|
||||
<div class="exchange" aria-live="polite">
|
||||
<ChainMark chain={from} /><span aria-hidden="true">→</span><ChainMark chain={to} />
|
||||
<strong>{selected ? cash : t("swap.unavailable")}</strong>
|
||||
<span class="count-label">{t("swap.count")}</span>
|
||||
<div class="stepper">
|
||||
<button
|
||||
type="button"
|
||||
class:actionable={count > 1 && max > 0}
|
||||
disabled={count <= 1 || max === 0}
|
||||
onclick={() => count--}
|
||||
aria-label={t("swap.fewer")}>−</button
|
||||
>
|
||||
<span class="value">{max === 0 ? 0 : count}</span>
|
||||
<button
|
||||
type="button"
|
||||
class:actionable={count < max}
|
||||
disabled={count >= max}
|
||||
onclick={() => count++}
|
||||
aria-label={t("swap.more")}>+</button
|
||||
>
|
||||
</div>
|
||||
{#if max > 0}<small>{t("swap.max", { count: max })}</small>{/if}
|
||||
</div>
|
||||
{#if selected}
|
||||
<p class="exchange" aria-live="polite">
|
||||
<span class="leg"
|
||||
><ChainMark chain={from} small />
|
||||
{t("swap.giveDetail", {
|
||||
count: selected.count,
|
||||
chain: chainName(from),
|
||||
value: money(selected.count * priceOf(from)),
|
||||
})}</span
|
||||
>
|
||||
<span class="leg"
|
||||
><ChainMark chain={to} small />
|
||||
{t("swap.takeDetail", {
|
||||
count: selected.count,
|
||||
chain: chainName(to),
|
||||
value: money(selected.count * priceOf(to)),
|
||||
})}</span
|
||||
>
|
||||
<strong>{cash}</strong>
|
||||
</p>
|
||||
{#if after}
|
||||
<HoldingChange label={t("swap.after")} cash={after.cash} shares={after.shares} onlyChanged />
|
||||
{/if}
|
||||
{:else}
|
||||
<p class="why">{blocked}</p>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="confirm"
|
||||
class:actionable={!!selected}
|
||||
disabled={!selected}
|
||||
onclick={() => selected && store.send(selected)}>{t("swap.confirm")}</button
|
||||
onclick={() => selected && store.send(selected)}
|
||||
>{selected
|
||||
? t("swap.confirmExact", { count: selected.count, from: chainName(from), to: chainName(to), cash })
|
||||
: t("swap.confirm")}</button
|
||||
>
|
||||
{:else}
|
||||
<p>{t("swap.unavailable")}</p>
|
||||
<p class="why">{remaining <= 0 ? t("swap.noneLeft") : t("swap.unavailable")}</p>
|
||||
{/if}
|
||||
</details>
|
||||
|
||||
|
|
@ -102,13 +182,18 @@
|
|||
summary {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
min-height: 32px;
|
||||
}
|
||||
small,
|
||||
.note {
|
||||
.note,
|
||||
.why {
|
||||
color: var(--ink-muted);
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
}
|
||||
.why {
|
||||
font-style: italic;
|
||||
}
|
||||
p {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
|
@ -123,8 +208,7 @@
|
|||
font-size: 13px;
|
||||
min-width: 0;
|
||||
}
|
||||
select,
|
||||
input {
|
||||
select {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
|
|
@ -135,26 +219,44 @@
|
|||
padding: 6px;
|
||||
}
|
||||
.swap-controls {
|
||||
display: flex;
|
||||
align-items: end;
|
||||
gap: 12px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.swap-controls label {
|
||||
flex: 0 0 72px;
|
||||
}
|
||||
.exchange {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
gap: 4px 12px;
|
||||
margin: 10px 0 4px;
|
||||
}
|
||||
.exchange strong {
|
||||
flex-basis: 100%;
|
||||
.count-label {
|
||||
font-size: 13px;
|
||||
}
|
||||
.stepper {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
.stepper button {
|
||||
width: 44px;
|
||||
padding: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
.value {
|
||||
display: inline-block;
|
||||
min-width: 24px;
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.exchange {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
font-size: 14px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.leg {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
button {
|
||||
min-height: 44px;
|
||||
padding: 6px 12px;
|
||||
|
|
@ -165,6 +267,10 @@
|
|||
}
|
||||
button:disabled {
|
||||
color: var(--ink-muted);
|
||||
background: transparent;
|
||||
}
|
||||
.confirm {
|
||||
text-align: start;
|
||||
}
|
||||
@media (max-width: 400px) {
|
||||
.chains {
|
||||
|
|
|
|||
111
packages/viewer/src/lib/TurnSummary.svelte
Normal file
111
packages/viewer/src/lib/TurnSummary.svelte
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<script lang="ts">
|
||||
import HoldingChange from "./HoldingChange.svelte";
|
||||
import LogParts from "./LogParts.svelte";
|
||||
import UndoButton from "./UndoButton.svelte";
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
import { holdingsAfter, moveEffect, turnSummary } from "./turn-summary";
|
||||
|
||||
let { store }: { store: ViewerStore } = $props();
|
||||
|
||||
const review = $derived(store.review!);
|
||||
const game = $derived(store.state!);
|
||||
const t = $derived(store.lang.t);
|
||||
// Without private drafts every sent move is already final, so nothing is greyed out.
|
||||
const lines = $derived(turnSummary(game, review.move, store.lang, store.drafting ? store.undoFrom : 0));
|
||||
const effect = $derived(moveEffect(game, review.move));
|
||||
const holdings = $derived(effect && holdingsAfter(game, effect));
|
||||
const mixed = $derived(store.canUndo && lines.some((line) => line.final));
|
||||
const note = $derived(
|
||||
review.outcome.endsGame ? t("turn.gameEnds") : review.kind === "end" ? t("turn.endNote") : t("turn.finalStep")
|
||||
);
|
||||
</script>
|
||||
|
||||
<section class="panel turn-summary" aria-label={t("turn.summary")}>
|
||||
<div class="head">
|
||||
<h3>{t("turn.summary")}</h3>
|
||||
{#if store.canUndo}<UndoButton {store} />{/if}
|
||||
</div>
|
||||
<ol class="lines">
|
||||
{#each lines as line (line.key)}
|
||||
<li class:final={line.final} class:pending={line.pending}><LogParts {game} parts={line.parts} /></li>
|
||||
{/each}
|
||||
</ol>
|
||||
{#if mixed}<p class="note">{t("turn.finalLines")}</p>{/if}
|
||||
{#if holdings}
|
||||
<HoldingChange label={t("turn.after")} cash={holdings.cash} shares={holdings.shares} />
|
||||
{/if}
|
||||
<p class="note warning">{note}</p>
|
||||
<div class="actions">
|
||||
<button type="button" class="actionable primary" onclick={() => store.send(review.move, true)}
|
||||
>{review.kind === "commit" && review.move.type === "place"
|
||||
? t("place.button", { tile: review.move.tile })
|
||||
: t("turn.end")}</button
|
||||
>
|
||||
<button type="button" class="actionable" onclick={() => (store.review = undefined)}>{t("turn.back")}</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.turn-summary {
|
||||
background: var(--panel);
|
||||
padding: 10px 12px 12px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
.lines {
|
||||
list-style: none;
|
||||
margin: 6px 0 8px;
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
.lines li {
|
||||
padding: 3px 0 3px 10px;
|
||||
border-inline-start: 3px solid var(--panel-alt);
|
||||
}
|
||||
.lines li.final {
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.lines li.pending {
|
||||
border-inline-start-color: var(--accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
.note {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.note.warning {
|
||||
color: var(--ink);
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
.actions button {
|
||||
padding: 6px 16px;
|
||||
min-height: 40px;
|
||||
background: var(--page);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
border: none;
|
||||
}
|
||||
.actions button.primary {
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
.actions button {
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
33
packages/viewer/src/lib/UndoButton.svelte
Normal file
33
packages/viewer/src/lib/UndoButton.svelte
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<script lang="ts">
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
|
||||
let { store }: { store: ViewerStore } = $props();
|
||||
</script>
|
||||
|
||||
<button type="button" class="actionable undo" onclick={() => store.undo()}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"
|
||||
><path d="M9 4 3 10l6 6M3 10h11a7 7 0 0 1 0 14" transform="translate(0 -2)" /></svg
|
||||
>
|
||||
{store.lang.t("turn.undo")}
|
||||
</button>
|
||||
|
||||
<style>
|
||||
.undo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-block: 4px;
|
||||
margin-inline: auto 0;
|
||||
padding: 6px 12px;
|
||||
min-height: 36px;
|
||||
background: var(--page);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
border: none;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
.undo {
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -137,8 +137,15 @@ test("two-tile limits explain exactly the tiles the engine blocks this turn", ()
|
|||
continue;
|
||||
}
|
||||
assert.ok(!placeable.includes(tileLabel(tile)));
|
||||
const founding = placementEffect(state.board, tile).kind === "found";
|
||||
assert.equal(limit, founding && turnPlacements(state).founded ? "oneFounding" : "foundOrMerge");
|
||||
const effect = placementEffect(state.board, tile);
|
||||
const { founded } = turnPlacements(state);
|
||||
assert.ok(founded, "only a founding earlier this turn limits the second tile");
|
||||
if (effect.kind === "merge") {
|
||||
assert.equal(limit, "mergeFounded");
|
||||
assert.ok(effect.chains.includes(founded));
|
||||
} else {
|
||||
assert.deepEqual([effect.kind, limit], ["found", "oneFounding"]);
|
||||
}
|
||||
assert.equal(turnLimit(state, (seat + 1) % 4, tile), undefined, "limits apply only to the active seat");
|
||||
}
|
||||
const view = stripSecret(state, seat);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
// Which choices the viewer offers. Validity always comes from the engine: these helpers only
|
||||
// filter and look up engine.legalMoves(), so no rule is re-implemented here.
|
||||
import {
|
||||
blockedThisTurn,
|
||||
CHAIN_IDS,
|
||||
chainSize,
|
||||
currentSeat,
|
||||
legalMoves,
|
||||
placementEffect,
|
||||
turnPlacements,
|
||||
twoTileLimit,
|
||||
type ChainId,
|
||||
type GameState,
|
||||
type Move,
|
||||
type Shares,
|
||||
type Tile,
|
||||
type TwoTileLimit,
|
||||
} from "acquire-engine";
|
||||
import { chainName, type Lang } from "./format.ts";
|
||||
|
||||
|
|
@ -49,13 +49,8 @@ export function describePlacement(state: GameState, tile: Tile, lang: Lang): str
|
|||
* Why `tile` in `seat`'s hand can't be placed this turn under the two-tiles limits
|
||||
* (rules.md §4.1), or undefined when they don't block it.
|
||||
*/
|
||||
export function turnLimit(state: GameState, seat: number, tile: Tile): "oneFounding" | "foundOrMerge" | undefined {
|
||||
if (seat !== state.activeSeat || state.ended || !blockedThisTurn(state, tile)) {
|
||||
return undefined;
|
||||
}
|
||||
return placementEffect(state.board, tile).kind === "found" && turnPlacements(state).founded
|
||||
? "oneFounding"
|
||||
: "foundOrMerge";
|
||||
export function turnLimit(state: GameState, seat: number, tile: Tile): TwoTileLimit | undefined {
|
||||
return seat === state.activeSeat && !state.ended ? twoTileLimit(state, tile) : undefined;
|
||||
}
|
||||
|
||||
function sameShares(a: Partial<Shares>, b: Partial<Shares>): boolean {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
CHAINS,
|
||||
HIDDEN,
|
||||
PUBLIC_HOLDINGS_OVERRIDE,
|
||||
currentSeat,
|
||||
merger,
|
||||
secondPlacementDue,
|
||||
|
|
@ -98,6 +99,9 @@ export function describeEntry(
|
|||
case "init":
|
||||
return t("log.init", { count: entry.players });
|
||||
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;
|
||||
return count !== undefined && entry.reason.startsWith("only applies")
|
||||
? t("log.optionIgnored.players", { option: entry.option, count })
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const da: Catalog = {
|
|||
"swap.receive": "Modtag {amount}",
|
||||
"swap.even": "Ingen prisforskel",
|
||||
"swap.unavailable": "Intet bytte muligt med dette antal, grænsen, aktierne og kontanterne.",
|
||||
"swap.optionGive": "{chain} · du har {count} · {price}",
|
||||
"swap.optionTake": "{chain} · banken har {count} · {price}",
|
||||
"swap.fewer": "Byt én færre",
|
||||
"swap.more": "Byt én mere",
|
||||
"swap.max": "op til {count}",
|
||||
"swap.giveDetail": "afgiv {count} {chain} ({value})",
|
||||
"swap.takeDetail": "få {count} {chain} ({value})",
|
||||
"swap.after": "Efter dette bytte",
|
||||
"swap.confirmExact": "Byt {count} {from} for {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Ingen bytter tilbage denne tur.",
|
||||
"swap.bankEmpty": "Banken har ingen {chain}-aktier.",
|
||||
"swap.cash": "Ikke penge nok til prisforskellen.",
|
||||
"log.swapped": "{name} bytter {count} {from} for {count} {to} · {cash}",
|
||||
|
||||
loading: "Indlæser spillet…",
|
||||
|
|
@ -31,6 +43,14 @@ export const da: Catalog = {
|
|||
"panel.label": "Din beslutning",
|
||||
"panel.sending": "Sender…",
|
||||
"turn.undo": "Fortryd",
|
||||
"turn.summary": "Gennemse din tur",
|
||||
"turn.end": "Afslut tur",
|
||||
"turn.back": "Tilbage",
|
||||
"turn.after": "Efter denne tur",
|
||||
"turn.endNote": "Når turen afsluttes, trækkes nye brikker, så den kan ikke fortrydes.",
|
||||
"turn.gameEnds": "Dette afslutter spillet: Slutbonusser udbetales, og alle aktier sælges.",
|
||||
"turn.finalStep": "Fortryd er ikke muligt efter dette trin.",
|
||||
"turn.finalLines": "Grå linjer er endelige; Fortryd går tilbage gennem resten én ad gangen.",
|
||||
"announce.ask": "Afslut spillet efter denne tur?",
|
||||
"announce.confirm": "Meld afslutning",
|
||||
"announce.cancel": "Spil videre",
|
||||
|
|
@ -47,10 +67,13 @@ export const da: Catalog = {
|
|||
"place.pass": "Fortsæt uden at lægge",
|
||||
"found.prompt": "Navngiv den nye kæde. Du får én gratis aktie.",
|
||||
"survivor.prompt": "Disse kæder er lige store og størst. Vælg, hvilken der overlever.",
|
||||
"survivor.choose": "Vælg den overlevende kæde",
|
||||
"survivor.confirm": "Bekræft: {survivor} overtager {defunct}",
|
||||
tiles: { one: "{count} brik", other: "{count} brikker" },
|
||||
"order.prompt":
|
||||
"{survivor} overlever. Nogle opslugte kæder er lige store: vælg rækkefølgen, de afregnes i, fra første til sidste.",
|
||||
"order.confirm": "Bekræft rækkefølge",
|
||||
"order.confirmChains": "Afvikl {chains} i denne rækkefølge",
|
||||
"order.reset": "Start forfra",
|
||||
"dispose.takenOver": "{defunct} bliver opslugt af {survivor}.",
|
||||
"dispose.holding": { one: "Du har {count} {chain}-aktie.", other: "Du har {count} {chain}-aktier." },
|
||||
|
|
@ -68,16 +91,30 @@ 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.",
|
||||
"dispose.choose": "Vælg først sælg, byt eller behold.",
|
||||
"dispose.keepAll": "Behold alle",
|
||||
"dispose.tradeRate": "2 {defunct} for 1 {survivor}",
|
||||
"dispose.tradeNone": "Banken har ikke flere {chain}-aktier",
|
||||
"dispose.tradeFew": "Bytte kræver mindst 2 aktier",
|
||||
"dispose.after": "Efter dette valg",
|
||||
"dispose.doSell": "sælg {count} for {amount}",
|
||||
"dispose.doTrade": "byt {give} for {receive} {chain}",
|
||||
"dispose.doKeep": "behold {count} {chain}",
|
||||
"dispose.doKeepAll": "behold alle {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "Du ejer",
|
||||
"buy.soldOut": "Ingen tilbage i banken",
|
||||
"buy.cantAfford": "Ikke penge nok til én mere",
|
||||
"buy.limitReached": "Grænsen er nået: {limit} aktier pr. tur.",
|
||||
"board.label": "Spilleplade",
|
||||
"board.empty": "{tile} tom",
|
||||
"board.loose": "{tile} enlig brik",
|
||||
|
|
@ -92,6 +129,7 @@ export const da: Catalog = {
|
|||
"hand.eighth": "kan ikke grundlægge en 8. kæde",
|
||||
"hand.deadNextTurn": "Udskiftes ved starten af din næste tur",
|
||||
"hand.oneFounding": "kan ikke grundlægge en kæde mere i denne tur",
|
||||
"hand.mergeFounded": "kan ikke fusionere kæden, du grundlagde i denne tur",
|
||||
"hand.foundOrMerge": "kan ikke både grundlægge en kæde og fusionere i samme tur",
|
||||
"chains.label": "Hotelkæder",
|
||||
"chains.title": "Kæder",
|
||||
|
|
@ -132,6 +170,10 @@ export const da: Catalog = {
|
|||
"players.turn": "tur",
|
||||
"players.left": "forladt",
|
||||
"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",
|
||||
"seat.name": "{name} (plads {seat})",
|
||||
"log.label": "Spillets log",
|
||||
|
|
@ -228,8 +270,7 @@ export const da: Catalog = {
|
|||
"Du ejer allerede 3 Tower-aktier. Én mere giver dig 4 for i alt $700 brugt.\n\nHver tur må du købe op til 3 nye aktier. Du kan også købe ingenting og spare pengene.",
|
||||
"tutorial.mergers.3": "Læg 8F mellem Worldwide og Festival. Begge har 2 brikker.",
|
||||
"tutorial.mergers.4": "Vælg Worldwide som den overlevende kæde.",
|
||||
"tutorial.mergers.5":
|
||||
"Du fik begge Festival-bonusser. Behold din Festival-aktie: Lad salg og bytte stå på 0, og bekræft.",
|
||||
"tutorial.mergers.5": "Du fik begge Festival-bonusser. Behold din Festival-aktie: Vælg “Behold alle”, og bekræft.",
|
||||
"tutorial.mergers.6": "Vælg “Køb intet og afslut turen” for at afslutte den anden fusion.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Når de største kæder er lige store, vælger spilleren, der lægger den forbindende brik, den overlevende kæde. Antallet af aktier afgør ikke ligheden.\n\nHer har begge kæder 2 brikker. Du ejer den eneste Festival-aktie uden for banken.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const de: Catalog = {
|
|||
"swap.receive": "{amount} erhalten",
|
||||
"swap.even": "Keine Preisdifferenz",
|
||||
"swap.unavailable": "Mit dieser Menge, dem Limit, Aktienbestand und Bargeld ist kein Tausch möglich.",
|
||||
"swap.optionGive": "{chain} · du hast {count} · {price}",
|
||||
"swap.optionTake": "{chain} · Bank hat {count} · {price}",
|
||||
"swap.fewer": "Eine weniger tauschen",
|
||||
"swap.more": "Eine mehr tauschen",
|
||||
"swap.max": "bis zu {count}",
|
||||
"swap.giveDetail": "{count} {chain} abgeben ({value})",
|
||||
"swap.takeDetail": "{count} {chain} erhalten ({value})",
|
||||
"swap.after": "Nach diesem Tausch",
|
||||
"swap.confirmExact": "{count} {from} gegen {count} {to} tauschen · {cash}",
|
||||
"swap.noneLeft": "In diesem Zug sind keine Tausche mehr übrig.",
|
||||
"swap.bankEmpty": "Die Bank hat keine {chain}-Aktien.",
|
||||
"swap.cash": "Nicht genug Geld für die Preisdifferenz.",
|
||||
"log.swapped": "{name} tauscht {count} {from} gegen {count} {to} · {cash}",
|
||||
|
||||
loading: "Spiel wird geladen…",
|
||||
|
|
@ -31,6 +43,14 @@ export const de: Catalog = {
|
|||
"panel.label": "Deine Entscheidung",
|
||||
"panel.sending": "Wird gesendet…",
|
||||
"turn.undo": "Rückgängig",
|
||||
"turn.summary": "Zug überprüfen",
|
||||
"turn.end": "Zug beenden",
|
||||
"turn.back": "Zurück",
|
||||
"turn.after": "Nach diesem Zug",
|
||||
"turn.endNote": "Beim Beenden des Zugs werden neue Plättchen gezogen; das lässt sich nicht rückgängig machen.",
|
||||
"turn.gameEnds": "Damit endet das Spiel: Schlussprämien werden gezahlt und alle Aktien verkauft.",
|
||||
"turn.finalStep": "Nach diesem Schritt ist Rückgängig nicht mehr möglich.",
|
||||
"turn.finalLines": "Graue Zeilen sind endgültig; Rückgängig nimmt die übrigen Schritt für Schritt zurück.",
|
||||
"announce.ask": "Das Spiel nach diesem Zug beenden?",
|
||||
"announce.confirm": "Spielende ankündigen",
|
||||
"announce.cancel": "Weiterspielen",
|
||||
|
|
@ -47,10 +67,13 @@ export const de: Catalog = {
|
|||
"place.pass": "Ohne Legen weiter",
|
||||
"found.prompt": "Benenne die neue Kette. Du erhältst eine Gratisaktie.",
|
||||
"survivor.prompt": "Diese Ketten sind gleich groß und die größten. Wähle, welche bestehen bleibt.",
|
||||
"survivor.choose": "Überlebende Kette wählen",
|
||||
"survivor.confirm": "Bestätigen: {survivor} übernimmt {defunct}",
|
||||
tiles: { one: "{count} Plättchen", other: "{count} Plättchen" },
|
||||
"order.prompt":
|
||||
"{survivor} bleibt bestehen. Einige übernommene Ketten sind gleich groß: Wähle die Reihenfolge, in der sie abgerechnet werden, von der ersten bis zur letzten.",
|
||||
"order.confirm": "Reihenfolge bestätigen",
|
||||
"order.confirmChains": "{chains} in dieser Reihenfolge abwickeln",
|
||||
"order.reset": "Neu beginnen",
|
||||
"dispose.takenOver": "{defunct} wird von {survivor} übernommen.",
|
||||
"dispose.holding": { one: "Du besitzt {count} {chain}-Aktie.", other: "Du besitzt {count} {chain}-Aktien." },
|
||||
|
|
@ -68,16 +91,30 @@ 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.",
|
||||
"dispose.choose": "Wähle zuerst Verkaufen, Tauschen oder Behalten.",
|
||||
"dispose.keepAll": "Alle behalten",
|
||||
"dispose.tradeRate": "2 {defunct} gegen 1 {survivor}",
|
||||
"dispose.tradeNone": "Die Bank hat keine {chain}-Aktien mehr",
|
||||
"dispose.tradeFew": "Zum Tauschen brauchst du mindestens 2 Aktien",
|
||||
"dispose.after": "Nach dieser Wahl",
|
||||
"dispose.doSell": "{count} für {amount} verkaufen",
|
||||
"dispose.doTrade": "{give} gegen {receive} {chain} tauschen",
|
||||
"dispose.doKeep": "{count} {chain} behalten",
|
||||
"dispose.doKeepAll": "alle {count} {chain} behalten",
|
||||
"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",
|
||||
"buy.owned": "Im Besitz",
|
||||
"buy.soldOut": "Die Bank hat keine mehr",
|
||||
"buy.cantAfford": "Nicht genug Geld für eine weitere",
|
||||
"buy.limitReached": "Limit erreicht: {limit} Aktien pro Zug.",
|
||||
"board.label": "Spielplan",
|
||||
"board.empty": "{tile} leer",
|
||||
"board.loose": "{tile} einzelnes Plättchen",
|
||||
|
|
@ -92,6 +129,7 @@ export const de: Catalog = {
|
|||
"hand.eighth": "keine 8. Kette möglich",
|
||||
"hand.deadNextTurn": "Werden zu Beginn deines nächsten Zuges ersetzt",
|
||||
"hand.oneFounding": "keine zweite Kettengründung in diesem Zug",
|
||||
"hand.mergeFounded": "keine Fusion mit der in diesem Zug gegründeten Kette",
|
||||
"hand.foundOrMerge": "nicht Gründung und Fusion im selben Zug",
|
||||
"chains.label": "Hotelketten",
|
||||
"chains.title": "Ketten",
|
||||
|
|
@ -132,6 +170,10 @@ export const de: Catalog = {
|
|||
"players.turn": "am Zug",
|
||||
"players.left": "ausgeschieden",
|
||||
"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",
|
||||
"seat.name": "{name} (Platz {seat})",
|
||||
"log.label": "Spielprotokoll",
|
||||
|
|
@ -229,7 +271,7 @@ export const de: Catalog = {
|
|||
"tutorial.mergers.3": "Lege 8F zwischen Worldwide und Festival. Beide haben 2 Plättchen.",
|
||||
"tutorial.mergers.4": "Wähle Worldwide als überlebende Kette.",
|
||||
"tutorial.mergers.5":
|
||||
"Du hast beide Festival-Boni erhalten. Behalte deine Festival-Aktie: Lass Verkauf und Tausch auf 0 und bestätige.",
|
||||
"Du hast beide Festival-Boni erhalten. Behalte deine Festival-Aktie: Wähle „Alle behalten“ und bestätige.",
|
||||
"tutorial.mergers.6": "Wähle „Nichts kaufen und Zug beenden“, um die zweite Fusion abzuschließen.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Sind die größten Ketten gleich groß, wählt die Person, die das verbindende Plättchen legt, die überlebende Kette. Aktienzahlen entscheiden nicht.\n\nHier haben beide Ketten 2 Plättchen. Du besitzt die einzige Festival-Aktie außerhalb der Bank.",
|
||||
|
|
|
|||
|
|
@ -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": "Δίνετε (μετοχές σας)",
|
||||
|
|
@ -13,6 +13,18 @@ export const el: Catalog = {
|
|||
"swap.receive": "Είσπραξη {amount}",
|
||||
"swap.even": "Χωρίς διαφορά τιμής",
|
||||
"swap.unavailable": "Δεν γίνεται ανταλλαγή με αυτή την ποσότητα, το όριο, τις μετοχές και τα μετρητά.",
|
||||
"swap.optionGive": "{chain} · έχεις {count} · {price}",
|
||||
"swap.optionTake": "{chain} · τράπεζα {count} · {price}",
|
||||
"swap.fewer": "Ανταλλαγή μίας λιγότερης",
|
||||
"swap.more": "Ανταλλαγή μίας ακόμη",
|
||||
"swap.max": "έως {count}",
|
||||
"swap.giveDetail": "δίνεις {count} {chain} ({value})",
|
||||
"swap.takeDetail": "παίρνεις {count} {chain} ({value})",
|
||||
"swap.after": "Μετά από αυτή την ανταλλαγή",
|
||||
"swap.confirmExact": "Ανταλλαγή {count} {from} με {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Δεν απομένουν ανταλλαγές σε αυτόν τον γύρο.",
|
||||
"swap.bankEmpty": "Η τράπεζα δεν έχει μετοχές {chain}.",
|
||||
"swap.cash": "Δεν φτάνουν τα μετρητά για τη διαφορά τιμής.",
|
||||
"log.swapped": "{name}: ανταλλαγή {count} {from} με {count} {to} · {cash}",
|
||||
|
||||
loading: "Φόρτωση παιχνιδιού…",
|
||||
|
|
@ -31,6 +43,14 @@ export const el: Catalog = {
|
|||
"panel.label": "Η απόφασή σου",
|
||||
"panel.sending": "Αποστολή…",
|
||||
"turn.undo": "Αναίρεση",
|
||||
"turn.summary": "Έλεγχος γύρου",
|
||||
"turn.end": "Τέλος γύρου",
|
||||
"turn.back": "Πίσω",
|
||||
"turn.after": "Μετά από αυτόν τον γύρο",
|
||||
"turn.endNote": "Με το τέλος του γύρου τραβιούνται νέα πλακίδια, οπότε δεν αναιρείται.",
|
||||
"turn.gameEnds": "Έτσι τελειώνει το παιχνίδι: πληρώνονται τα τελικά μπόνους και πωλούνται όλες οι μετοχές.",
|
||||
"turn.finalStep": "Μετά από αυτό το βήμα δεν υπάρχει αναίρεση.",
|
||||
"turn.finalLines": "Οι γκρίζες γραμμές είναι οριστικές· η Αναίρεση γυρίζει πίσω τις υπόλοιπες μία μία.",
|
||||
"announce.ask": "Να τελειώσει το παιχνίδι μετά από αυτόν τον γύρο;",
|
||||
"announce.confirm": "Ανακοίνωση τέλους",
|
||||
"announce.cancel": "Συνέχεια παιχνιδιού",
|
||||
|
|
@ -47,10 +67,13 @@ export const el: Catalog = {
|
|||
"place.pass": "Συνέχεια χωρίς τοποθέτηση",
|
||||
"found.prompt": "Ονόμασε τη νέα αλυσίδα. Παίρνεις μία δωρεάν μετοχή.",
|
||||
"survivor.prompt": "Αυτές οι αλυσίδες είναι ισόπαλες ως οι μεγαλύτερες. Διάλεξε ποια επιβιώνει.",
|
||||
"survivor.choose": "Διάλεξε την αλυσίδα που επιβιώνει",
|
||||
"survivor.confirm": "Επιβεβαίωση: η {survivor} απορροφά τη {defunct}",
|
||||
tiles: { one: "{count} πλακίδιο", other: "{count} πλακίδια" },
|
||||
"order.prompt":
|
||||
"Η {survivor} επιβιώνει. Ορισμένες αλυσίδες που απορροφώνται έχουν το ίδιο μέγεθος: διάλεξε τη σειρά εκκαθάρισής τους, από την πρώτη ως την τελευταία.",
|
||||
"order.confirm": "Επιβεβαίωση σειράς",
|
||||
"order.confirmChains": "Εκκαθάριση {chains} με αυτή τη σειρά",
|
||||
"order.reset": "Από την αρχή",
|
||||
"dispose.takenOver": "Η {defunct} απορροφάται από την {survivor}.",
|
||||
"dispose.holding": { one: "Έχεις {count} μετοχή {chain}.", other: "Έχεις {count} μετοχές {chain}." },
|
||||
|
|
@ -68,16 +91,30 @@ export const el: Catalog = {
|
|||
"dispose.tradeFewer": "Ανταλλαγή δύο λιγότερων",
|
||||
"dispose.tradeMore": "Ανταλλαγή δύο ακόμη",
|
||||
"dispose.confirm": "Επιβεβαίωση",
|
||||
"buy.prompt": "Αγόρασε έως 3 μετοχές. Οι τιμές μένουν σταθερές σε αυτόν τον γύρο.",
|
||||
"dispose.choose": "Διάλεξε πρώτα πώληση, ανταλλαγή ή διατήρηση.",
|
||||
"dispose.keepAll": "Διατήρηση όλων",
|
||||
"dispose.tradeRate": "2 {defunct} για 1 {survivor}",
|
||||
"dispose.tradeNone": "Η τράπεζα δεν έχει άλλες μετοχές {chain}",
|
||||
"dispose.tradeFew": "Για ανταλλαγή χρειάζονται τουλάχιστον 2 μετοχές",
|
||||
"dispose.after": "Μετά από αυτή την επιλογή",
|
||||
"dispose.doSell": "πώληση {count} για {amount}",
|
||||
"dispose.doTrade": "ανταλλαγή {give} για {receive} {chain}",
|
||||
"dispose.doKeep": "διατήρηση {count} {chain}",
|
||||
"dispose.doKeepAll": "διατήρηση και των {count} {chain}",
|
||||
"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} και τέλος γύρου",
|
||||
"buy.owned": "Έχεις",
|
||||
"buy.soldOut": "Δεν έμειναν στην τράπεζα",
|
||||
"buy.cantAfford": "Δεν φτάνουν τα μετρητά για άλλη",
|
||||
"buy.limitReached": "Έφτασες το όριο: {limit} μετοχές ανά γύρο.",
|
||||
"board.label": "Ταμπλό",
|
||||
"board.empty": "{tile} κενό",
|
||||
"board.loose": "{tile} μεμονωμένο πλακίδιο",
|
||||
|
|
@ -92,6 +129,7 @@ export const el: Catalog = {
|
|||
"hand.eighth": "δεν ιδρύεται 8η αλυσίδα",
|
||||
"hand.deadNextTurn": "Αντικατάσταση στην αρχή του επόμενου γύρου σου",
|
||||
"hand.oneFounding": "δεν ιδρύεται δεύτερη αλυσίδα σε αυτόν τον γύρο",
|
||||
"hand.mergeFounded": "όχι συγχώνευση της αλυσίδας που ιδρύθηκε σε αυτόν τον γύρο",
|
||||
"hand.foundOrMerge": "όχι ίδρυση αλυσίδας και συγχώνευση στον ίδιο γύρο",
|
||||
"chains.label": "Αλυσίδες ξενοδοχείων",
|
||||
"chains.title": "Αλυσίδες",
|
||||
|
|
@ -132,6 +170,10 @@ export const el: Catalog = {
|
|||
"players.turn": "σειρά",
|
||||
"players.left": "αποχώρησε",
|
||||
"players.none": "καμία",
|
||||
"players.shareCount": { one: "{count} μετοχή", other: "{count} μετοχές" },
|
||||
"players.shareCountHint": "Σύνολο σε όλες τις αλυσίδες· οι μετοχές ανά αλυσίδα είναι κρυφές",
|
||||
"log.optionIgnored.publicHoldings":
|
||||
"Η επιλογή {option} αγνοήθηκε: το publicHoldings δείχνει ήδη όλες τις μετοχές και τα μετρητά",
|
||||
hidden: "κρυφό",
|
||||
"seat.name": "{name} (θέση {seat})",
|
||||
"log.label": "Ημερολόγιο παιχνιδιού",
|
||||
|
|
@ -229,7 +271,7 @@ export const el: Catalog = {
|
|||
"tutorial.mergers.3": "Τοποθέτησε το 8F ανάμεσα στη Worldwide και τη Festival. Και οι δύο έχουν 2 πλακίδια.",
|
||||
"tutorial.mergers.4": "Επίλεξε τη Worldwide ως επιζώσα αλυσίδα.",
|
||||
"tutorial.mergers.5":
|
||||
"Πήρες και τα δύο μπόνους της Festival. Κράτησε τη μετοχή Festival: άφησε πώληση και ανταλλαγή στο 0 και επιβεβαίωσε.",
|
||||
"Πήρες και τα δύο μπόνους της Festival. Κράτησε τη μετοχή Festival: διάλεξε «Διατήρηση όλων» και επιβεβαίωσε.",
|
||||
"tutorial.mergers.6": "Επίλεξε «Καμία αγορά και τέλος σειράς» για να ολοκληρώσεις τη δεύτερη συγχώνευση.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Όταν οι μεγαλύτερες αλυσίδες ισοβαθμούν σε μέγεθος, ο παίκτης που τοποθετεί το συνδετικό πλακίδιο επιλέγει ποια επιβιώνει. Ο αριθμός μετοχών δεν λύνει την ισοπαλία.\n\nΕδώ και οι δύο έχουν 2 πλακίδια. Κατέχεις τη μοναδική μετοχή Festival εκτός τράπεζας.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -14,6 +14,18 @@ export const en = {
|
|||
"swap.receive": "Receive {amount}",
|
||||
"swap.even": "No cash difference",
|
||||
"swap.unavailable": "No swap available with this quantity, allowance, stock and cash.",
|
||||
"swap.optionGive": "{chain} · you have {count} · {price}",
|
||||
"swap.optionTake": "{chain} · bank has {count} · {price}",
|
||||
"swap.fewer": "Swap one fewer",
|
||||
"swap.more": "Swap one more",
|
||||
"swap.max": "up to {count}",
|
||||
"swap.giveDetail": "give {count} {chain} ({value})",
|
||||
"swap.takeDetail": "get {count} {chain} ({value})",
|
||||
"swap.after": "After this swap",
|
||||
"swap.confirmExact": "Swap {count} {from} for {count} {to} · {cash}",
|
||||
"swap.noneLeft": "No swaps left this turn.",
|
||||
"swap.bankEmpty": "The bank has no {chain} shares.",
|
||||
"swap.cash": "Not enough cash to pay the price difference.",
|
||||
"log.swapped": "{name} swapped {count} {from} for {count} {to} · {cash}",
|
||||
|
||||
loading: "Loading game…",
|
||||
|
|
@ -36,6 +48,14 @@ export const en = {
|
|||
"panel.label": "Your decision",
|
||||
"panel.sending": "Sending…",
|
||||
"turn.undo": "Undo",
|
||||
"turn.summary": "Review your turn",
|
||||
"turn.end": "End turn",
|
||||
"turn.back": "Back",
|
||||
"turn.after": "After this turn",
|
||||
"turn.endNote": "Ending your turn draws new tiles, so it can’t be undone.",
|
||||
"turn.gameEnds": "This ends the game: final bonuses are paid and all shares are sold.",
|
||||
"turn.finalStep": "Undo isn’t available after this step.",
|
||||
"turn.finalLines": "Greyed lines are final; Undo steps back through the rest.",
|
||||
"announce.ask": "End the game after this turn?",
|
||||
"announce.confirm": "Announce the end",
|
||||
"announce.cancel": "Keep playing",
|
||||
|
|
@ -52,10 +72,13 @@ export const en = {
|
|||
"place.pass": "Continue without placing",
|
||||
"found.prompt": "Name the new chain. You receive one free share.",
|
||||
"survivor.prompt": "These chains are tied for largest. Choose which one survives.",
|
||||
"survivor.choose": "Choose the surviving chain",
|
||||
"survivor.confirm": "Confirm: {survivor} takes over {defunct}",
|
||||
tiles: { one: "{count} tile", other: "{count} tiles" },
|
||||
"order.prompt":
|
||||
"{survivor} survives. Some defunct chains are the same size: choose the order they are resolved in, first to last.",
|
||||
"order.confirm": "Confirm order",
|
||||
"order.confirmChains": "Resolve {chains} in this order",
|
||||
"order.reset": "Start over",
|
||||
"dispose.takenOver": "{defunct} is taken over by {survivor}.",
|
||||
"dispose.holding": { one: "You hold {count} {chain} share.", other: "You hold {count} {chain} shares." },
|
||||
|
|
@ -73,16 +96,30 @@ 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.",
|
||||
"dispose.choose": "Choose sell, trade or keep first.",
|
||||
"dispose.keepAll": "Keep all",
|
||||
"dispose.tradeRate": "2 {defunct} for 1 {survivor}",
|
||||
"dispose.tradeNone": "The bank has no {chain} shares left",
|
||||
"dispose.tradeFew": "Trading needs at least 2 shares",
|
||||
"dispose.after": "After this choice",
|
||||
"dispose.doSell": "sell {count} for {amount}",
|
||||
"dispose.doTrade": "trade {give} for {receive} {chain}",
|
||||
"dispose.doKeep": "keep {count} {chain}",
|
||||
"dispose.doKeepAll": "keep all {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "You own",
|
||||
"buy.soldOut": "None left in the bank",
|
||||
"buy.cantAfford": "Not enough cash for another",
|
||||
"buy.limitReached": "Limit reached: {limit} shares per turn.",
|
||||
|
||||
// Board and hand
|
||||
"board.label": "Board",
|
||||
|
|
@ -99,6 +136,7 @@ export const en = {
|
|||
"hand.eighth": "can't found an 8th chain",
|
||||
"hand.deadNextTurn": "Replaced at the start of your next turn",
|
||||
"hand.oneFounding": "can't found a second chain this turn",
|
||||
"hand.mergeFounded": "can't merge the chain you founded this turn",
|
||||
"hand.foundOrMerge": "can't both found a chain and merge in one turn",
|
||||
|
||||
// Chain and price tables
|
||||
|
|
@ -142,6 +180,9 @@ export const en = {
|
|||
"players.turn": "turn",
|
||||
"players.left": "left",
|
||||
"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",
|
||||
"seat.name": "{name} (seat {seat})",
|
||||
|
||||
|
|
@ -243,7 +284,7 @@ export const en = {
|
|||
"tutorial.mergers.3": "Place 8F between Worldwide and Festival. Both have 2 tiles.",
|
||||
"tutorial.mergers.4": "Choose Worldwide as the surviving chain.",
|
||||
"tutorial.mergers.5":
|
||||
"You received both Festival bonuses. Keep your Festival share: leave sell and trade at 0, then confirm.",
|
||||
"You received both Festival bonuses. Keep your Festival share: choose “Keep all”, then confirm.",
|
||||
"tutorial.mergers.6": "Choose “Buy nothing and end turn” to finish the second merger.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"When the largest chains tie in size, the player placing the connecting tile chooses the survivor. Share counts do not break the tie.\n\nHere both chains have 2 tiles. You own Festival’s only share.",
|
||||
|
|
|
|||
|
|
@ -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": "واگذاری (سهام شما)",
|
||||
|
|
@ -13,6 +13,18 @@ export const fa: Catalog = {
|
|||
"swap.receive": "دریافت {amount}",
|
||||
"swap.even": "بدون اختلاف قیمت",
|
||||
"swap.unavailable": "با این تعداد، سقف تعویض، سهام و وجه نقد، تعویض ممکن نیست.",
|
||||
"swap.optionGive": "{chain} · دارید {count} · {price}",
|
||||
"swap.optionTake": "{chain} · بانک {count} · {price}",
|
||||
"swap.fewer": "یکی کمتر تعویض کن",
|
||||
"swap.more": "یکی بیشتر تعویض کن",
|
||||
"swap.max": "تا {count}",
|
||||
"swap.giveDetail": "واگذاری {count} {chain} ({value})",
|
||||
"swap.takeDetail": "دریافت {count} {chain} ({value})",
|
||||
"swap.after": "پس از این تعویض",
|
||||
"swap.confirmExact": "تعویض {count} {from} با {count} {to} · {cash}",
|
||||
"swap.noneLeft": "در این نوبت تعویضی باقی نمانده است.",
|
||||
"swap.bankEmpty": "بانک سهم {chain} ندارد.",
|
||||
"swap.cash": "پول برای پرداخت اختلاف قیمت کافی نیست.",
|
||||
"log.swapped": "{name} تعداد {count} سهم {from} را با {count} سهم {to} تعویض کرد · {cash}",
|
||||
|
||||
loading: "در حال بارگذاری بازی…",
|
||||
|
|
@ -31,6 +43,14 @@ export const fa: Catalog = {
|
|||
"panel.label": "تصمیم شما",
|
||||
"panel.sending": "در حال ارسال…",
|
||||
"turn.undo": "واگرد",
|
||||
"turn.summary": "مرور نوبت",
|
||||
"turn.end": "پایان نوبت",
|
||||
"turn.back": "بازگشت",
|
||||
"turn.after": "پس از این نوبت",
|
||||
"turn.endNote": "با پایان نوبت کاشیهای تازه کشیده میشوند، پس قابل واگرد نیست.",
|
||||
"turn.gameEnds": "بازی تمام میشود: پاداشهای پایانی پرداخت و همهی سهام فروخته میشود.",
|
||||
"turn.finalStep": "پس از این مرحله واگرد ممکن نیست.",
|
||||
"turn.finalLines": "خطهای خاکستری قطعیاند؛ واگرد بقیه را یکییکی برمیگرداند.",
|
||||
"announce.ask": "بازی بعد از این نوبت تمام شود؟",
|
||||
"announce.confirm": "اعلام پایان",
|
||||
"announce.cancel": "ادامهی بازی",
|
||||
|
|
@ -47,10 +67,13 @@ export const fa: Catalog = {
|
|||
"place.pass": "ادامه بدون گذاشتن",
|
||||
"found.prompt": "برای زنجیرهی جدید نام انتخاب کنید. یک سهم رایگان میگیرید.",
|
||||
"survivor.prompt": "این زنجیرهها هماندازه و بزرگتریناند. انتخاب کنید کدام بماند.",
|
||||
"survivor.choose": "زنجیرهی ماندگار را انتخاب کنید",
|
||||
"survivor.confirm": "تأیید: {survivor} زنجیرهی {defunct} را تصاحب میکند",
|
||||
tiles: { one: "{count} کاشی", other: "{count} کاشی" },
|
||||
"order.prompt":
|
||||
"{survivor} میماند. برخی زنجیرههای ادغامشونده هماندازهاند: ترتیب تسویهی آنها را از اول تا آخر انتخاب کنید.",
|
||||
"order.confirm": "تأیید ترتیب",
|
||||
"order.confirmChains": "تسویهی {chains} به همین ترتیب",
|
||||
"order.reset": "از نو",
|
||||
"dispose.takenOver": "{defunct} در {survivor} ادغام میشود.",
|
||||
"dispose.holding": { one: "شما {count} سهم {chain} دارید.", other: "شما {count} سهم {chain} دارید." },
|
||||
|
|
@ -68,16 +91,30 @@ export const fa: Catalog = {
|
|||
"dispose.tradeFewer": "دو تا کمتر معاوضه کن",
|
||||
"dispose.tradeMore": "دو تا بیشتر معاوضه کن",
|
||||
"dispose.confirm": "تأیید",
|
||||
"buy.prompt": "حداکثر 3 سهم بخرید. قیمتها در این نوبت ثابتاند.",
|
||||
"dispose.choose": "ابتدا فروش، معاوضه یا نگهداشتن را انتخاب کنید.",
|
||||
"dispose.keepAll": "نگهداشتن همه",
|
||||
"dispose.tradeRate": "2 {defunct} به 1 {survivor}",
|
||||
"dispose.tradeNone": "بانک دیگر سهم {chain} ندارد",
|
||||
"dispose.tradeFew": "برای معاوضه دستکم 2 سهم لازم است",
|
||||
"dispose.after": "پس از این انتخاب",
|
||||
"dispose.doSell": "فروش {count} به {amount}",
|
||||
"dispose.doTrade": "معاوضهی {give} با {receive} {chain}",
|
||||
"dispose.doKeep": "نگهداشتن {count} {chain}",
|
||||
"dispose.doKeepAll": "نگهداشتن هر {count} {chain}",
|
||||
"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} و پایان نوبت",
|
||||
"buy.owned": "دارایی شما",
|
||||
"buy.soldOut": "در بانک نمانده",
|
||||
"buy.cantAfford": "پول برای یکی دیگر کافی نیست",
|
||||
"buy.limitReached": "به سقف رسیدید: {limit} سهم در هر نوبت.",
|
||||
"board.label": "صفحهی بازی",
|
||||
"board.empty": "{tile} خالی",
|
||||
"board.loose": "{tile} کاشی تنها",
|
||||
|
|
@ -92,6 +129,7 @@ export const fa: Catalog = {
|
|||
"hand.eighth": "زنجیرهی هشتم ممکن نیست",
|
||||
"hand.deadNextTurn": "در آغاز نوبت بعدی شما جایگزین میشوند",
|
||||
"hand.oneFounding": "در این نوبت زنجیرهی دوم ممکن نیست",
|
||||
"hand.mergeFounded": "ادغام زنجیرهای که در این نوبت تأسیس شد ممکن نیست",
|
||||
"hand.foundOrMerge": "تأسیس زنجیره و ادغام در یک نوبت ممکن نیست",
|
||||
"chains.label": "زنجیرههای هتل",
|
||||
"chains.title": "زنجیرهها",
|
||||
|
|
@ -131,6 +169,10 @@ export const fa: Catalog = {
|
|||
"players.turn": "نوبت",
|
||||
"players.left": "رفته",
|
||||
"players.none": "هیچ",
|
||||
"players.shareCount": { one: "{count} سهم", other: "{count} سهم" },
|
||||
"players.shareCountHint": "مجموع در همهی زنجیرهها؛ سهام هر زنجیره پنهان است",
|
||||
"log.optionIgnored.publicHoldings":
|
||||
"گزینهی {option} نادیده گرفته شد: publicHoldings از قبل همهی داراییها را نشان میدهد",
|
||||
hidden: "پنهان",
|
||||
"seat.name": "{name} (جایگاه {seat})",
|
||||
"log.label": "گزارش بازی",
|
||||
|
|
@ -228,7 +270,7 @@ export const fa: Catalog = {
|
|||
"tutorial.mergers.3": "8F را بین Worldwide و Festival بگذارید. هر دو ۲ کاشی دارند.",
|
||||
"tutorial.mergers.4": "Worldwide را بهعنوان زنجیرهٔ باقیمانده انتخاب کنید.",
|
||||
"tutorial.mergers.5":
|
||||
"هر دو پاداش Festival را گرفتید. سهم Festival را نگه دارید: فروش و معاوضه را روی ۰ بگذارید و تأیید کنید.",
|
||||
"هر دو پاداش Festival را گرفتید. سهم Festival را نگه دارید: «نگهداشتن همه» را انتخاب و تأیید کنید.",
|
||||
"tutorial.mergers.6": "برای پایان ادغام دوم، «چیزی نخر و نوبت را تمام کن» را انتخاب کنید.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"وقتی بزرگترین زنجیرهها هماندازهاند، بازیکنی که کاشی اتصال را میگذارد زنجیرهٔ باقیمانده را انتخاب میکند. تعداد سهام تساوی را نمیشکند.\n\nاینجا هر دو ۲ کاشی دارند. تنها سهم Festival خارج از بانک متعلق به شماست.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +14,18 @@ export const fr: Catalog = {
|
|||
"swap.receive": "Recevoir {amount}",
|
||||
"swap.even": "Sans différence de prix",
|
||||
"swap.unavailable": "Échange impossible avec cette quantité, la limite, les actions et les fonds disponibles.",
|
||||
"swap.optionGive": "{chain} · vous en avez {count} · {price}",
|
||||
"swap.optionTake": "{chain} · banque : {count} · {price}",
|
||||
"swap.fewer": "Échanger une de moins",
|
||||
"swap.more": "Échanger une de plus",
|
||||
"swap.max": "jusqu’à {count}",
|
||||
"swap.giveDetail": "donner {count} {chain} ({value})",
|
||||
"swap.takeDetail": "recevoir {count} {chain} ({value})",
|
||||
"swap.after": "Après cet échange",
|
||||
"swap.confirmExact": "Échanger {count} {from} contre {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Plus aucun échange possible ce tour.",
|
||||
"swap.bankEmpty": "La banque n’a pas d’actions {chain}.",
|
||||
"swap.cash": "Pas assez d’argent pour payer la différence de prix.",
|
||||
"log.swapped": "{name} échange {count} {from} contre {count} {to} · {cash}",
|
||||
|
||||
loading: "Chargement de la partie…",
|
||||
|
|
@ -31,6 +44,14 @@ export const fr: Catalog = {
|
|||
"panel.label": "Votre décision",
|
||||
"panel.sending": "Envoi…",
|
||||
"turn.undo": "Annuler",
|
||||
"turn.summary": "Vérifier votre tour",
|
||||
"turn.end": "Finir le tour",
|
||||
"turn.back": "Retour",
|
||||
"turn.after": "Après ce tour",
|
||||
"turn.endNote": "Finir le tour pioche de nouvelles tuiles : impossible de l’annuler ensuite.",
|
||||
"turn.gameEnds": "Cela termine la partie : les primes finales sont versées et toutes les actions vendues.",
|
||||
"turn.finalStep": "Annuler ne sera plus possible après cette étape.",
|
||||
"turn.finalLines": "Les lignes grisées sont définitives ; Annuler revient sur les autres une à une.",
|
||||
"announce.ask": "Terminer la partie après ce tour ?",
|
||||
"announce.confirm": "Annoncer la fin",
|
||||
"announce.cancel": "Continuer à jouer",
|
||||
|
|
@ -47,10 +68,13 @@ export const fr: Catalog = {
|
|||
"place.pass": "Continuer sans poser",
|
||||
"found.prompt": "Nommez la nouvelle chaîne. Vous recevez une action gratuite.",
|
||||
"survivor.prompt": "Ces chaînes sont à égalité pour la plus grande. Choisissez celle qui survit.",
|
||||
"survivor.choose": "Choisissez la chaîne survivante",
|
||||
"survivor.confirm": "Confirmer : {survivor} absorbe {defunct}",
|
||||
tiles: { one: "{count} tuile", many: "{count} tuiles", other: "{count} tuiles" },
|
||||
"order.prompt":
|
||||
"{survivor} survit. Certaines chaînes absorbées ont la même taille : choisissez l’ordre dans lequel elles sont réglées, de la première à la dernière.",
|
||||
"order.confirm": "Confirmer l’ordre",
|
||||
"order.confirmChains": "Liquider {chains} dans cet ordre",
|
||||
"order.reset": "Recommencer",
|
||||
"dispose.takenOver": "{defunct} est absorbée par {survivor}.",
|
||||
"dispose.holding": {
|
||||
|
|
@ -72,16 +96,30 @@ 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.",
|
||||
"dispose.choose": "Choisissez d’abord vendre, échanger ou garder.",
|
||||
"dispose.keepAll": "Tout garder",
|
||||
"dispose.tradeRate": "2 {defunct} contre 1 {survivor}",
|
||||
"dispose.tradeNone": "La banque n’a plus d’actions {chain}",
|
||||
"dispose.tradeFew": "Il faut au moins 2 actions pour échanger",
|
||||
"dispose.after": "Après ce choix",
|
||||
"dispose.doSell": "vendre {count} pour {amount}",
|
||||
"dispose.doTrade": "échanger {give} contre {receive} {chain}",
|
||||
"dispose.doKeep": "garder {count} {chain}",
|
||||
"dispose.doKeepAll": "garder les {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "Vous avez",
|
||||
"buy.soldOut": "Plus aucune en banque",
|
||||
"buy.cantAfford": "Pas assez d’argent pour une de plus",
|
||||
"buy.limitReached": "Limite atteinte : {limit} actions par tour.",
|
||||
"board.label": "Plateau",
|
||||
"board.empty": "{tile} vide",
|
||||
"board.loose": "{tile} tuile isolée",
|
||||
|
|
@ -96,6 +134,7 @@ export const fr: Catalog = {
|
|||
"hand.eighth": "impossible de fonder une 8e chaîne",
|
||||
"hand.deadNextTurn": "Remplacement au début de votre prochain tour",
|
||||
"hand.oneFounding": "impossible de fonder une deuxième chaîne ce tour-ci",
|
||||
"hand.mergeFounded": "impossible de fusionner la chaîne fondée ce tour-ci",
|
||||
"hand.foundOrMerge": "impossible de fonder une chaîne et de fusionner dans le même tour",
|
||||
"chains.label": "Chaînes d’hôtels",
|
||||
"chains.title": "Chaînes",
|
||||
|
|
@ -136,6 +175,9 @@ export const fr: Catalog = {
|
|||
"players.turn": "son tour",
|
||||
"players.left": "parti",
|
||||
"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é",
|
||||
"seat.name": "{name} (place {seat})",
|
||||
"log.label": "Journal de la partie",
|
||||
|
|
@ -247,7 +289,7 @@ export const fr: Catalog = {
|
|||
"tutorial.mergers.3": "Posez 8F entre Worldwide et Festival. Les deux ont 2 tuiles.",
|
||||
"tutorial.mergers.4": "Choisissez Worldwide comme chaîne survivante.",
|
||||
"tutorial.mergers.5":
|
||||
"Vous avez reçu les deux primes Festival. Gardez votre action : laissez vente et échange à 0, puis confirmez.",
|
||||
"Vous avez reçu les deux primes Festival. Gardez votre action : choisissez « Tout garder », puis confirmez.",
|
||||
"tutorial.mergers.6": "Choisissez « Ne rien acheter et terminer » pour conclure la deuxième fusion.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Quand les plus grandes chaînes ont la même taille, le joueur qui pose la tuile de liaison choisit la survivante. Le nombre d’actions ne départage pas l’égalité.\n\nIci, chaque chaîne a 2 tuiles. Vous possédez la seule action Festival en circulation.",
|
||||
|
|
|
|||
|
|
@ -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": "दें (आपके शेयर)",
|
||||
|
|
@ -13,6 +13,18 @@ export const hi: Catalog = {
|
|||
"swap.receive": "{amount} लें",
|
||||
"swap.even": "कीमत में कोई अंतर नहीं",
|
||||
"swap.unavailable": "इस मात्रा, सीमा, शेयरों और नकद के साथ अदला-बदली उपलब्ध नहीं है।",
|
||||
"swap.optionGive": "{chain} · आपके पास {count} · {price}",
|
||||
"swap.optionTake": "{chain} · बैंक में {count} · {price}",
|
||||
"swap.fewer": "एक कम बदलें",
|
||||
"swap.more": "एक और बदलें",
|
||||
"swap.max": "{count} तक",
|
||||
"swap.giveDetail": "{count} {chain} दें ({value})",
|
||||
"swap.takeDetail": "{count} {chain} लें ({value})",
|
||||
"swap.after": "इस अदला-बदली के बाद",
|
||||
"swap.confirmExact": "{count} {from} के बदले {count} {to} लें · {cash}",
|
||||
"swap.noneLeft": "इस बारी में कोई अदला-बदली बाकी नहीं।",
|
||||
"swap.bankEmpty": "बैंक में {chain} के शेयर नहीं हैं।",
|
||||
"swap.cash": "कीमत का अंतर चुकाने के लिए नकद पर्याप्त नहीं।",
|
||||
"log.swapped": "{name} ने {count} {from} के बदले {count} {to} लिए · {cash}",
|
||||
|
||||
loading: "खेल लोड हो रहा है…",
|
||||
|
|
@ -31,6 +43,14 @@ export const hi: Catalog = {
|
|||
"panel.label": "आपका निर्णय",
|
||||
"panel.sending": "भेजा जा रहा है…",
|
||||
"turn.undo": "पूर्ववत करें",
|
||||
"turn.summary": "अपनी बारी जाँचें",
|
||||
"turn.end": "बारी समाप्त करें",
|
||||
"turn.back": "वापस",
|
||||
"turn.after": "इस बारी के बाद",
|
||||
"turn.endNote": "बारी समाप्त करने पर नई टाइलें ली जाती हैं, इसलिए इसे पूर्ववत नहीं किया जा सकता।",
|
||||
"turn.gameEnds": "इससे खेल समाप्त होगा: अंतिम बोनस दिए जाएँगे और सभी शेयर बेचे जाएँगे।",
|
||||
"turn.finalStep": "इस चरण के बाद पूर्ववत उपलब्ध नहीं होगा।",
|
||||
"turn.finalLines": "धूसर पंक्तियाँ अंतिम हैं; पूर्ववत बाकी को एक-एक करके वापस लेता है।",
|
||||
"announce.ask": "इस बारी के बाद खेल समाप्त करें?",
|
||||
"announce.confirm": "अंत की घोषणा करें",
|
||||
"announce.cancel": "खेलना जारी रखें",
|
||||
|
|
@ -47,9 +67,12 @@ export const hi: Catalog = {
|
|||
"place.pass": "बिना रखे आगे बढ़ें",
|
||||
"found.prompt": "नई श्रृंखला का नाम चुनें। आपको एक मुफ़्त शेयर मिलेगा।",
|
||||
"survivor.prompt": "ये श्रृंखलाएँ सबसे बड़ी होने में बराबर हैं। चुनें कि कौन सी बचेगी।",
|
||||
"survivor.choose": "बचने वाली श्रृंखला चुनें",
|
||||
"survivor.confirm": "पुष्टि करें: {survivor}, {defunct} का अधिग्रहण करेगी",
|
||||
tiles: { one: "{count} टाइल", other: "{count} टाइलें" },
|
||||
"order.prompt": "{survivor} बचती है। विलय होने वाली कुछ श्रृंखलाएँ एक ही आकार की हैं: पहली से आख़िरी तक, उनके निपटान का क्रम चुनें।",
|
||||
"order.confirm": "क्रम की पुष्टि करें",
|
||||
"order.confirmChains": "{chains} को इसी क्रम में निपटाएँ",
|
||||
"order.reset": "फिर से शुरू करें",
|
||||
"dispose.takenOver": "{defunct} का {survivor} में विलय हो रहा है।",
|
||||
"dispose.holding": { one: "आपके पास {chain} का {count} शेयर है।", other: "आपके पास {chain} के {count} शेयर हैं।" },
|
||||
|
|
@ -67,16 +90,30 @@ export const hi: Catalog = {
|
|||
"dispose.tradeFewer": "दो कम बदलें",
|
||||
"dispose.tradeMore": "दो और बदलें",
|
||||
"dispose.confirm": "पुष्टि करें",
|
||||
"buy.prompt": "अधिकतम 3 शेयर खरीदें। इस बारी में कीमतें नहीं बदलतीं।",
|
||||
"dispose.choose": "पहले बेचना, बदलना या रखना चुनें।",
|
||||
"dispose.keepAll": "सभी रखें",
|
||||
"dispose.tradeRate": "2 {defunct} के बदले 1 {survivor}",
|
||||
"dispose.tradeNone": "बैंक में {chain} के शेयर नहीं बचे",
|
||||
"dispose.tradeFew": "अदला-बदली के लिए कम से कम 2 शेयर चाहिए",
|
||||
"dispose.after": "इस चुनाव के बाद",
|
||||
"dispose.doSell": "{amount} में {count} बेचें",
|
||||
"dispose.doTrade": "{give} के बदले {receive} {chain} लें",
|
||||
"dispose.doKeep": "{count} {chain} रखें",
|
||||
"dispose.doKeepAll": "सभी {count} {chain} रखें",
|
||||
"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} में खरीदें और बारी समाप्त करें",
|
||||
"buy.owned": "आपके पास",
|
||||
"buy.soldOut": "बैंक में नहीं बचे",
|
||||
"buy.cantAfford": "एक और के लिए नकद पर्याप्त नहीं",
|
||||
"buy.limitReached": "सीमा पूरी: हर बारी में {limit} शेयर।",
|
||||
"board.label": "बोर्ड",
|
||||
"board.empty": "{tile} खाली",
|
||||
"board.loose": "{tile} अकेली टाइल",
|
||||
|
|
@ -91,6 +128,7 @@ export const hi: Catalog = {
|
|||
"hand.eighth": "8वीं श्रृंखला स्थापित नहीं हो सकती",
|
||||
"hand.deadNextTurn": "आपकी अगली बारी की शुरुआत में बदल दी जाएँगी",
|
||||
"hand.oneFounding": "इस बारी में दूसरी श्रृंखला स्थापित नहीं हो सकती",
|
||||
"hand.mergeFounded": "इस बारी में स्थापित श्रृंखला का विलय नहीं हो सकता",
|
||||
"hand.foundOrMerge": "एक ही बारी में श्रृंखला स्थापित करना और विलय दोनों नहीं हो सकते",
|
||||
"chains.label": "होटल श्रृंखलाएँ",
|
||||
"chains.title": "श्रृंखलाएँ",
|
||||
|
|
@ -129,6 +167,9 @@ export const hi: Catalog = {
|
|||
"players.turn": "बारी",
|
||||
"players.left": "छोड़ गए",
|
||||
"players.none": "कोई नहीं",
|
||||
"players.shareCount": { one: "{count} शेयर", other: "{count} शेयर" },
|
||||
"players.shareCountHint": "सभी श्रृंखलाओं में कुल; हर श्रृंखला के शेयर छिपे हैं",
|
||||
"log.optionIgnored.publicHoldings": "विकल्प {option} अनदेखा किया गया: publicHoldings पहले से सारी होल्डिंग दिखाता है",
|
||||
hidden: "छिपा",
|
||||
"seat.name": "{name} (सीट {seat})",
|
||||
"log.label": "खेल का लॉग",
|
||||
|
|
@ -225,7 +266,7 @@ export const hi: Catalog = {
|
|||
"आपके पास पहले से Tower के 3 शेयर हैं। एक और खरीदने पर कुल 4 हो जाएँगे और कुल खर्च $700 होगा।\n\nहर बारी में आप अधिकतम 3 नए शेयर खरीद सकते हैं। आप कुछ न खरीदकर पैसे बचा भी सकते हैं।",
|
||||
"tutorial.mergers.3": "Worldwide और Festival के बीच 8F रखें। दोनों में 2 टाइल हैं।",
|
||||
"tutorial.mergers.4": "बचने वाली शृंखला के रूप में Worldwide चुनें।",
|
||||
"tutorial.mergers.5": "आपको Festival के दोनों बोनस मिले। अपना Festival शेयर रखें: बिक्री और अदला-बदली 0 पर छोड़ें और पुष्टि करें।",
|
||||
"tutorial.mergers.5": "आपको Festival के दोनों बोनस मिले। अपना Festival शेयर रखें: “सभी रखें” चुनें और पुष्टि करें।",
|
||||
"tutorial.mergers.6": "दूसरा विलय पूरा करने के लिए “कुछ न खरीदें और बारी समाप्त करें” चुनें।",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"जब सबसे बड़ी शृंखलाओं का आकार बराबर हो, तो जोड़ने वाली टाइल रखने वाला खिलाड़ी तय करता है कि कौन बचेगी। शेयरों की संख्या बराबरी नहीं तोड़ती।\n\nयहाँ दोनों में 2 टाइल हैं। बैंक के बाहर Festival का एकमात्र शेयर आपके पास है।",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const it: Catalog = {
|
|||
"swap.receive": "Ricevi {amount}",
|
||||
"swap.even": "Nessuna differenza di prezzo",
|
||||
"swap.unavailable": "Scambio impossibile con questa quantità, il limite, le azioni e il denaro disponibili.",
|
||||
"swap.optionGive": "{chain} · ne hai {count} · {price}",
|
||||
"swap.optionTake": "{chain} · banca {count} · {price}",
|
||||
"swap.fewer": "Scambia un’azione in meno",
|
||||
"swap.more": "Scambia un’azione in più",
|
||||
"swap.max": "fino a {count}",
|
||||
"swap.giveDetail": "cedi {count} {chain} ({value})",
|
||||
"swap.takeDetail": "ricevi {count} {chain} ({value})",
|
||||
"swap.after": "Dopo questo scambio",
|
||||
"swap.confirmExact": "Scambia {count} {from} con {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Nessuno scambio rimasto in questo turno.",
|
||||
"swap.bankEmpty": "La banca non ha azioni {chain}.",
|
||||
"swap.cash": "Denaro insufficiente per la differenza di prezzo.",
|
||||
"log.swapped": "{name} scambia {count} {from} con {count} {to} · {cash}",
|
||||
|
||||
loading: "Caricamento della partita…",
|
||||
|
|
@ -31,6 +43,14 @@ export const it: Catalog = {
|
|||
"panel.label": "La tua decisione",
|
||||
"panel.sending": "Invio…",
|
||||
"turn.undo": "Annulla",
|
||||
"turn.summary": "Rivedi il turno",
|
||||
"turn.end": "Termina il turno",
|
||||
"turn.back": "Indietro",
|
||||
"turn.after": "Dopo questo turno",
|
||||
"turn.endNote": "Terminando il turno si pescano nuove tessere, quindi non si può annullare.",
|
||||
"turn.gameEnds": "Questo termina la partita: si pagano i premi finali e si vendono tutte le azioni.",
|
||||
"turn.finalStep": "Dopo questo passo non potrai annullare.",
|
||||
"turn.finalLines": "Le righe grigie sono definitive; Annulla torna indietro sulle altre una alla volta.",
|
||||
"announce.ask": "Terminare la partita dopo questo turno?",
|
||||
"announce.confirm": "Annuncia la fine",
|
||||
"announce.cancel": "Continua a giocare",
|
||||
|
|
@ -47,10 +67,13 @@ export const it: Catalog = {
|
|||
"place.pass": "Continua senza piazzare",
|
||||
"found.prompt": "Dai un nome alla nuova catena. Ricevi un'azione gratuita.",
|
||||
"survivor.prompt": "Queste catene sono le più grandi a pari merito. Scegli quale sopravvive.",
|
||||
"survivor.choose": "Scegli la catena che sopravvive",
|
||||
"survivor.confirm": "Conferma: {survivor} assorbe {defunct}",
|
||||
tiles: { one: "{count} tessera", many: "{count} tessere", other: "{count} tessere" },
|
||||
"order.prompt":
|
||||
"{survivor} sopravvive. Alcune catene assorbite hanno la stessa dimensione: scegli l'ordine in cui vengono liquidate, dalla prima all'ultima.",
|
||||
"order.confirm": "Conferma l'ordine",
|
||||
"order.confirmChains": "Liquida {chains} in quest’ordine",
|
||||
"order.reset": "Ricomincia",
|
||||
"dispose.takenOver": "{defunct} viene assorbita da {survivor}.",
|
||||
"dispose.holding": {
|
||||
|
|
@ -72,16 +95,30 @@ 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.",
|
||||
"dispose.choose": "Scegli prima se vendere, scambiare o tenere.",
|
||||
"dispose.keepAll": "Tieni tutto",
|
||||
"dispose.tradeRate": "2 {defunct} per 1 {survivor}",
|
||||
"dispose.tradeNone": "La banca non ha più azioni {chain}",
|
||||
"dispose.tradeFew": "Per scambiare servono almeno 2 azioni",
|
||||
"dispose.after": "Dopo questa scelta",
|
||||
"dispose.doSell": "vendi {count} per {amount}",
|
||||
"dispose.doTrade": "scambia {give} per {receive} {chain}",
|
||||
"dispose.doKeep": "tieni {count} {chain}",
|
||||
"dispose.doKeepAll": "tieni tutte le {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "Possiedi",
|
||||
"buy.soldOut": "Nessuna in banca",
|
||||
"buy.cantAfford": "Denaro insufficiente per un’altra",
|
||||
"buy.limitReached": "Limite raggiunto: {limit} azioni per turno.",
|
||||
"board.label": "Tabellone",
|
||||
"board.empty": "{tile} vuota",
|
||||
"board.loose": "{tile} tessera isolata",
|
||||
|
|
@ -96,6 +133,7 @@ export const it: Catalog = {
|
|||
"hand.eighth": "non si può fondare un'8ª catena",
|
||||
"hand.deadNextTurn": "Sostituite all'inizio del tuo prossimo turno",
|
||||
"hand.oneFounding": "non si può fondare una seconda catena in questo turno",
|
||||
"hand.mergeFounded": "non si può fondere la catena fondata in questo turno",
|
||||
"hand.foundOrMerge": "non si può fondare una catena e fondere nello stesso turno",
|
||||
"chains.label": "Catene alberghiere",
|
||||
"chains.title": "Catene",
|
||||
|
|
@ -137,6 +175,9 @@ export const it: Catalog = {
|
|||
"players.turn": "turno",
|
||||
"players.left": "uscito",
|
||||
"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",
|
||||
"seat.name": "{name} (posto {seat})",
|
||||
"log.label": "Registro della partita",
|
||||
|
|
@ -252,7 +293,7 @@ export const it: Catalog = {
|
|||
"tutorial.mergers.3": "Piazza 8F tra Worldwide e Festival. Entrambe hanno 2 tessere.",
|
||||
"tutorial.mergers.4": "Scegli Worldwide come catena superstite.",
|
||||
"tutorial.mergers.5":
|
||||
"Hai ricevuto entrambi i premi Festival. Conserva la tua azione Festival: lascia vendita e scambio a 0, poi conferma.",
|
||||
"Hai ricevuto entrambi i premi Festival. Conserva la tua azione Festival: scegli “Tieni tutto”, poi conferma.",
|
||||
"tutorial.mergers.6": "Scegli “Non comprare e termina il turno” per concludere la seconda fusione.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Se le catene più grandi hanno la stessa dimensione, il giocatore che piazza la tessera di collegamento sceglie la superstite. Il numero di azioni non risolve la parità.\n\nQui entrambe hanno 2 tessere. Possiedi l’unica azione Festival fuori dalla banca.",
|
||||
|
|
|
|||
|
|
@ -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": "제공 (보유 주식)",
|
||||
|
|
@ -13,6 +13,18 @@ export const ko: Catalog = {
|
|||
"swap.receive": "{amount} 수령",
|
||||
"swap.even": "차액 없음",
|
||||
"swap.unavailable": "이 수량, 교환 한도, 주식 및 현금으로는 교환할 수 없습니다.",
|
||||
"swap.optionGive": "{chain} · 보유 {count} · {price}",
|
||||
"swap.optionTake": "{chain} · 은행 {count} · {price}",
|
||||
"swap.fewer": "한 주 덜 교환",
|
||||
"swap.more": "한 주 더 교환",
|
||||
"swap.max": "최대 {count}",
|
||||
"swap.giveDetail": "{chain} {count}주 제공 ({value})",
|
||||
"swap.takeDetail": "{chain} {count}주 수령 ({value})",
|
||||
"swap.after": "이 교환 후",
|
||||
"swap.confirmExact": "{from} {count}주를 {to} {count}주로 교환 · {cash}",
|
||||
"swap.noneLeft": "이번 턴에 남은 교환이 없습니다.",
|
||||
"swap.bankEmpty": "은행에 {chain} 주식이 없습니다.",
|
||||
"swap.cash": "가격 차이를 낼 현금이 부족합니다.",
|
||||
"log.swapped": "{name}: {from} {count}주를 {to} {count}주로 교환 · {cash}",
|
||||
|
||||
loading: "게임을 불러오는 중…",
|
||||
|
|
@ -31,6 +43,14 @@ export const ko: Catalog = {
|
|||
"panel.label": "내 결정",
|
||||
"panel.sending": "보내는 중…",
|
||||
"turn.undo": "되돌리기",
|
||||
"turn.summary": "턴 확인",
|
||||
"turn.end": "턴 끝내기",
|
||||
"turn.back": "뒤로",
|
||||
"turn.after": "이번 턴 후",
|
||||
"turn.endNote": "턴을 끝내면 새 타일을 뽑으므로 되돌릴 수 없습니다.",
|
||||
"turn.gameEnds": "게임이 끝납니다. 최종 보너스가 지급되고 모든 주식이 매도됩니다.",
|
||||
"turn.finalStep": "이 단계 이후에는 되돌릴 수 없습니다.",
|
||||
"turn.finalLines": "회색 줄은 확정되었습니다. 되돌리기는 나머지를 하나씩 취소합니다.",
|
||||
"announce.ask": "이번 턴이 끝나면 게임을 끝낼까요?",
|
||||
"announce.confirm": "종료 선언",
|
||||
"announce.cancel": "계속 플레이",
|
||||
|
|
@ -47,10 +67,13 @@ export const ko: Catalog = {
|
|||
"place.pass": "놓지 않고 계속하기",
|
||||
"found.prompt": "새 체인의 이름을 고르세요. 무료 주식 1주를 받습니다.",
|
||||
"survivor.prompt": "이 체인들이 가장 크고 크기가 같습니다. 살아남을 체인을 고르세요.",
|
||||
"survivor.choose": "살아남을 체인을 고르세요",
|
||||
"survivor.confirm": "확정: {survivor}이(가) {defunct}을(를) 인수",
|
||||
tiles: { other: "타일 {count}개" },
|
||||
"order.prompt":
|
||||
"{survivor}이(가) 살아남습니다. 흡수되는 체인 중 크기가 같은 것이 있습니다. 처음부터 마지막까지 정산할 순서를 고르세요.",
|
||||
"order.confirm": "순서 확정",
|
||||
"order.confirmChains": "{chains} 순서로 정리",
|
||||
"order.reset": "다시 고르기",
|
||||
"dispose.takenOver": "{survivor}이(가) {defunct}을(를) 흡수합니다.",
|
||||
"dispose.holding": { other: "{chain} 주식을 {count}주 가지고 있습니다." },
|
||||
|
|
@ -68,16 +91,30 @@ export const ko: Catalog = {
|
|||
"dispose.tradeFewer": "2주 덜 교환",
|
||||
"dispose.tradeMore": "2주 더 교환",
|
||||
"dispose.confirm": "확정",
|
||||
"buy.prompt": "주식을 최대 3주까지 사세요. 이번 턴에는 가격이 바뀌지 않습니다.",
|
||||
"dispose.choose": "먼저 매도, 교환, 보유 중에서 고르세요.",
|
||||
"dispose.keepAll": "모두 보유",
|
||||
"dispose.tradeRate": "{defunct} 2주 → {survivor} 1주",
|
||||
"dispose.tradeNone": "은행에 {chain} 주식이 없습니다",
|
||||
"dispose.tradeFew": "교환하려면 2주 이상 필요합니다",
|
||||
"dispose.after": "이 선택 후",
|
||||
"dispose.doSell": "{count}주를 {amount}에 매도",
|
||||
"dispose.doTrade": "{give}주를 {chain} {receive}주로 교환",
|
||||
"dispose.doKeep": "{chain} {count}주 보유",
|
||||
"dispose.doKeepAll": "{chain} {count}주 모두 보유",
|
||||
"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}에 사고 턴 끝내기",
|
||||
"buy.owned": "보유",
|
||||
"buy.soldOut": "은행에 남은 주식 없음",
|
||||
"buy.cantAfford": "한 주 더 살 현금 부족",
|
||||
"buy.limitReached": "한도 도달: 턴당 {limit}주.",
|
||||
"board.label": "게임판",
|
||||
"board.empty": "{tile} 빈칸",
|
||||
"board.loose": "{tile} 따로 놓인 타일",
|
||||
|
|
@ -92,6 +129,7 @@ export const ko: Catalog = {
|
|||
"hand.eighth": "8번째 체인은 세울 수 없음",
|
||||
"hand.deadNextTurn": "다음 차례가 시작될 때 교체됩니다",
|
||||
"hand.oneFounding": "이번 차례에 두 번째 체인은 세울 수 없음",
|
||||
"hand.mergeFounded": "이번 차례에 세운 체인은 합병할 수 없음",
|
||||
"hand.foundOrMerge": "한 차례에 체인 설립과 합병을 모두 할 수 없음",
|
||||
"chains.label": "호텔 체인",
|
||||
"chains.title": "체인",
|
||||
|
|
@ -131,6 +169,9 @@ export const ko: Catalog = {
|
|||
"players.turn": "차례",
|
||||
"players.left": "나감",
|
||||
"players.none": "없음",
|
||||
"players.shareCount": { other: "{count}주" },
|
||||
"players.shareCountHint": "모든 체인의 합계이며, 체인별 보유량은 비공개입니다",
|
||||
"log.optionIgnored.publicHoldings": "{option} 옵션 무시됨: publicHoldings가 이미 모든 보유량을 공개함",
|
||||
hidden: "비공개",
|
||||
"seat.name": "{name} ({seat}번 자리)",
|
||||
"log.label": "게임 기록",
|
||||
|
|
@ -222,7 +263,7 @@ export const ko: Catalog = {
|
|||
"tutorial.mergers.3": "Worldwide와 Festival 사이에 8F를 놓으세요. 둘 다 2칸입니다.",
|
||||
"tutorial.mergers.4": "존속할 체인으로 Worldwide를 선택하세요.",
|
||||
"tutorial.mergers.5":
|
||||
"Festival의 두 보너스를 모두 받았습니다. Festival 주식을 보유하세요. 판매와 교환을 0으로 두고 확인하세요.",
|
||||
"Festival의 두 보너스를 모두 받았습니다. Festival 주식을 보유하세요. “모두 보유”를 고르고 확인하세요.",
|
||||
"tutorial.mergers.6": "“구매 없이 차례 종료”를 선택해 두 번째 합병을 마치세요.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"가장 큰 체인들의 크기가 같으면 연결 타일을 놓은 플레이어가 존속할 체인을 고릅니다. 주식 수로 동률을 가리지 않습니다.\n\n여기서는 두 체인 모두 2칸입니다. 은행 밖의 유일한 Festival 주식을 당신이 갖고 있습니다.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const nl: Catalog = {
|
|||
"swap.receive": "Ontvang {amount}",
|
||||
"swap.even": "Geen prijsverschil",
|
||||
"swap.unavailable": "Geen ruil mogelijk met dit aantal, de limiet, aandelen en contanten.",
|
||||
"swap.optionGive": "{chain} · je hebt {count} · {price}",
|
||||
"swap.optionTake": "{chain} · bank heeft {count} · {price}",
|
||||
"swap.fewer": "Eén minder ruilen",
|
||||
"swap.more": "Eén meer ruilen",
|
||||
"swap.max": "tot {count}",
|
||||
"swap.giveDetail": "geef {count} {chain} ({value})",
|
||||
"swap.takeDetail": "krijg {count} {chain} ({value})",
|
||||
"swap.after": "Na deze ruil",
|
||||
"swap.confirmExact": "Ruil {count} {from} voor {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Geen ruilen meer over deze beurt.",
|
||||
"swap.bankEmpty": "De bank heeft geen {chain}-aandelen.",
|
||||
"swap.cash": "Niet genoeg geld voor het prijsverschil.",
|
||||
"log.swapped": "{name} ruilt {count} {from} voor {count} {to} · {cash}",
|
||||
|
||||
loading: "Spel laden…",
|
||||
|
|
@ -31,6 +43,14 @@ export const nl: Catalog = {
|
|||
"panel.label": "Jouw beslissing",
|
||||
"panel.sending": "Versturen…",
|
||||
"turn.undo": "Ongedaan maken",
|
||||
"turn.summary": "Controleer je beurt",
|
||||
"turn.end": "Beurt beëindigen",
|
||||
"turn.back": "Terug",
|
||||
"turn.after": "Na deze beurt",
|
||||
"turn.endNote": "Bij het beëindigen van je beurt trek je nieuwe tegels, dus dit kan niet ongedaan worden gemaakt.",
|
||||
"turn.gameEnds": "Dit beëindigt het spel: eindbonussen worden uitbetaald en alle aandelen verkocht.",
|
||||
"turn.finalStep": "Na deze stap is ongedaan maken niet meer mogelijk.",
|
||||
"turn.finalLines": "Grijze regels zijn definitief; Ongedaan maken loopt de rest stap voor stap terug.",
|
||||
"announce.ask": "Het spel na deze beurt beëindigen?",
|
||||
"announce.confirm": "Einde aankondigen",
|
||||
"announce.cancel": "Verder spelen",
|
||||
|
|
@ -47,10 +67,13 @@ export const nl: Catalog = {
|
|||
"place.pass": "Verder zonder te leggen",
|
||||
"found.prompt": "Geef de nieuwe keten een naam. Je krijgt één gratis aandeel.",
|
||||
"survivor.prompt": "Deze ketens zijn gelijk de grootste. Kies welke overleeft.",
|
||||
"survivor.choose": "Kies de overlevende keten",
|
||||
"survivor.confirm": "Bevestigen: {survivor} neemt {defunct} over",
|
||||
tiles: { one: "{count} tegel", other: "{count} tegels" },
|
||||
"order.prompt":
|
||||
"{survivor} overleeft. Sommige overgenomen ketens zijn even groot: kies de volgorde waarin ze worden afgehandeld, van eerste tot laatste.",
|
||||
"order.confirm": "Volgorde bevestigen",
|
||||
"order.confirmChains": "{chains} in deze volgorde afhandelen",
|
||||
"order.reset": "Opnieuw beginnen",
|
||||
"dispose.takenOver": "{defunct} wordt overgenomen door {survivor}.",
|
||||
"dispose.holding": { one: "Je hebt {count} {chain}-aandeel.", other: "Je hebt {count} {chain}-aandelen." },
|
||||
|
|
@ -68,16 +91,30 @@ 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.",
|
||||
"dispose.choose": "Kies eerst verkopen, ruilen of houden.",
|
||||
"dispose.keepAll": "Alles houden",
|
||||
"dispose.tradeRate": "2 {defunct} voor 1 {survivor}",
|
||||
"dispose.tradeNone": "De bank heeft geen {chain}-aandelen meer",
|
||||
"dispose.tradeFew": "Ruilen kan pas vanaf 2 aandelen",
|
||||
"dispose.after": "Na deze keuze",
|
||||
"dispose.doSell": "{count} verkopen voor {amount}",
|
||||
"dispose.doTrade": "{give} ruilen voor {receive} {chain}",
|
||||
"dispose.doKeep": "{count} {chain} houden",
|
||||
"dispose.doKeepAll": "alle {count} {chain} houden",
|
||||
"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",
|
||||
"buy.owned": "Je hebt",
|
||||
"buy.soldOut": "Geen meer in de bank",
|
||||
"buy.cantAfford": "Niet genoeg geld voor nog één",
|
||||
"buy.limitReached": "Limiet bereikt: {limit} aandelen per beurt.",
|
||||
"board.label": "Spelbord",
|
||||
"board.empty": "{tile} leeg",
|
||||
"board.loose": "{tile} losse tegel",
|
||||
|
|
@ -92,6 +129,7 @@ export const nl: Catalog = {
|
|||
"hand.eighth": "kan geen 8e keten stichten",
|
||||
"hand.deadNextTurn": "Worden aan het begin van je volgende beurt vervangen",
|
||||
"hand.oneFounding": "kan deze beurt geen tweede keten stichten",
|
||||
"hand.mergeFounded": "kan de keten die je deze beurt stichtte niet laten fuseren",
|
||||
"hand.foundOrMerge": "kan niet in één beurt een keten stichten én fuseren",
|
||||
"chains.label": "Hotelketens",
|
||||
"chains.title": "Ketens",
|
||||
|
|
@ -132,6 +170,9 @@ export const nl: Catalog = {
|
|||
"players.turn": "beurt",
|
||||
"players.left": "vertrokken",
|
||||
"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",
|
||||
"seat.name": "{name} (plaats {seat})",
|
||||
"log.label": "Spelverslag",
|
||||
|
|
@ -229,7 +270,7 @@ export const nl: Catalog = {
|
|||
"tutorial.mergers.3": "Leg 8F tussen Worldwide en Festival. Beide hebben 2 tegels.",
|
||||
"tutorial.mergers.4": "Kies Worldwide als overlevende keten.",
|
||||
"tutorial.mergers.5":
|
||||
"Je hebt beide Festival-bonussen ontvangen. Houd je Festival-aandeel: laat verkopen en ruilen op 0 staan en bevestig.",
|
||||
"Je hebt beide Festival-bonussen ontvangen. Houd je Festival-aandeel: kies ‘Alles houden’ en bevestig.",
|
||||
"tutorial.mergers.6": "Kies “Niets kopen en beurt beëindigen” om de tweede fusie af te ronden.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Als de grootste ketens even groot zijn, kiest de speler die de verbindende tegel legt welke overleeft. Het aantal aandelen beslist niet.\n\nHier hebben beide ketens 2 tegels. Jij bezit het enige Festival-aandeel buiten de bank.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const pl: Catalog = {
|
|||
"swap.receive": "Otrzymaj {amount}",
|
||||
"swap.even": "Bez dopłaty",
|
||||
"swap.unavailable": "Wymiana niemożliwa przy tej liczbie, limicie, akcjach i gotówce.",
|
||||
"swap.optionGive": "{chain} · masz {count} · {price}",
|
||||
"swap.optionTake": "{chain} · w banku {count} · {price}",
|
||||
"swap.fewer": "Wymień jedną mniej",
|
||||
"swap.more": "Wymień jedną więcej",
|
||||
"swap.max": "maks. {count}",
|
||||
"swap.giveDetail": "oddaj {count} {chain} ({value})",
|
||||
"swap.takeDetail": "otrzymaj {count} {chain} ({value})",
|
||||
"swap.after": "Po tej wymianie",
|
||||
"swap.confirmExact": "Wymień {count} {from} na {count} {to} · {cash}",
|
||||
"swap.noneLeft": "W tej turze nie zostały już wymiany.",
|
||||
"swap.bankEmpty": "Bank nie ma akcji {chain}.",
|
||||
"swap.cash": "Za mało gotówki na pokrycie różnicy cen.",
|
||||
"log.swapped": "{name} wymienia {count} {from} na {count} {to} · {cash}",
|
||||
|
||||
loading: "Wczytywanie gry…",
|
||||
|
|
@ -31,6 +43,14 @@ export const pl: Catalog = {
|
|||
"panel.label": "Twoja decyzja",
|
||||
"panel.sending": "Wysyłanie…",
|
||||
"turn.undo": "Cofnij",
|
||||
"turn.summary": "Sprawdź swoją turę",
|
||||
"turn.end": "Zakończ turę",
|
||||
"turn.back": "Wstecz",
|
||||
"turn.after": "Po tej turze",
|
||||
"turn.endNote": "Zakończenie tury dobiera nowe płytki, więc nie da się jej cofnąć.",
|
||||
"turn.gameEnds": "To kończy grę: zostaną wypłacone premie końcowe i sprzedane wszystkie akcje.",
|
||||
"turn.finalStep": "Po tym kroku cofnięcie nie będzie możliwe.",
|
||||
"turn.finalLines": "Szare wiersze są ostateczne; Cofnij wycofuje pozostałe po kolei.",
|
||||
"announce.ask": "Zakończyć grę po tej turze?",
|
||||
"announce.confirm": "Ogłoś koniec gry",
|
||||
"announce.cancel": "Graj dalej",
|
||||
|
|
@ -47,10 +67,13 @@ export const pl: Catalog = {
|
|||
"place.pass": "Kontynuuj bez kładzenia",
|
||||
"found.prompt": "Nazwij nową sieć. Otrzymujesz jedną darmową akcję.",
|
||||
"survivor.prompt": "Te sieci są równie duże i największe. Wybierz, która przetrwa.",
|
||||
"survivor.choose": "Wybierz sieć, która przetrwa",
|
||||
"survivor.confirm": "Potwierdź: {survivor} przejmuje {defunct}",
|
||||
tiles: { one: "{count} płytka", few: "{count} płytki", many: "{count} płytek", other: "{count} płytki" },
|
||||
"order.prompt":
|
||||
"{survivor} przetrwa. Niektóre przejmowane sieci są tej samej wielkości: wybierz kolejność ich rozliczenia, od pierwszej do ostatniej.",
|
||||
"order.confirm": "Potwierdź kolejność",
|
||||
"order.confirmChains": "Rozlicz {chains} w tej kolejności",
|
||||
"order.reset": "Zacznij od nowa",
|
||||
"dispose.takenOver": "{survivor} przejmuje {defunct}.",
|
||||
"dispose.holding": {
|
||||
|
|
@ -73,16 +96,30 @@ 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.",
|
||||
"dispose.choose": "Najpierw wybierz sprzedaż, wymianę lub zatrzymanie.",
|
||||
"dispose.keepAll": "Zatrzymaj wszystkie",
|
||||
"dispose.tradeRate": "2 {defunct} za 1 {survivor}",
|
||||
"dispose.tradeNone": "Bank nie ma już akcji {chain}",
|
||||
"dispose.tradeFew": "Do wymiany potrzeba co najmniej 2 akcji",
|
||||
"dispose.after": "Po tym wyborze",
|
||||
"dispose.doSell": "sprzedaj {count} za {amount}",
|
||||
"dispose.doTrade": "wymień {give} na {receive} {chain}",
|
||||
"dispose.doKeep": "zatrzymaj {count} {chain}",
|
||||
"dispose.doKeepAll": "zatrzymaj wszystkie ({count}) {chain}",
|
||||
"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ę",
|
||||
"buy.owned": "Masz",
|
||||
"buy.soldOut": "Brak w banku",
|
||||
"buy.cantAfford": "Za mało gotówki na kolejną",
|
||||
"buy.limitReached": "Osiągnięto limit: {limit} akcji na turę.",
|
||||
"board.label": "Plansza",
|
||||
"board.empty": "{tile} puste",
|
||||
"board.loose": "{tile} pojedyncza płytka",
|
||||
|
|
@ -97,6 +134,7 @@ export const pl: Catalog = {
|
|||
"hand.eighth": "nie można założyć 8. sieci",
|
||||
"hand.deadNextTurn": "Wymiana na początku twojej następnej tury",
|
||||
"hand.oneFounding": "nie można założyć drugiej sieci w tej turze",
|
||||
"hand.mergeFounded": "nie można połączyć sieci założonej w tej turze",
|
||||
"hand.foundOrMerge": "nie można w jednej turze założyć sieci i połączyć sieci",
|
||||
"chains.label": "Sieci hoteli",
|
||||
"chains.title": "Sieci",
|
||||
|
|
@ -136,6 +174,9 @@ export const pl: Catalog = {
|
|||
"players.turn": "tura",
|
||||
"players.left": "odszedł",
|
||||
"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",
|
||||
"seat.name": "{name} (miejsce {seat})",
|
||||
"log.label": "Dziennik gry",
|
||||
|
|
@ -257,7 +298,7 @@ export const pl: Catalog = {
|
|||
"tutorial.mergers.3": "Połóż 8F między Worldwide a Festival. Obie sieci mają 2 płytki.",
|
||||
"tutorial.mergers.4": "Wybierz Worldwide jako sieć przejmującą.",
|
||||
"tutorial.mergers.5":
|
||||
"Otrzymujesz obie premie Festival. Zachowaj akcję Festival: zostaw sprzedaż i wymianę na 0, a następnie potwierdź.",
|
||||
"Otrzymujesz obie premie Festival. Zachowaj akcję Festival: wybierz „Zatrzymaj wszystkie”, a następnie potwierdź.",
|
||||
"tutorial.mergers.6": "Wybierz „Nic nie kupuj i zakończ turę”, aby zakończyć drugą fuzję.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Gdy największe sieci mają ten sam rozmiar, gracz kładący łączącą płytkę wybiera sieć przejmującą. Liczba akcji nie rozstrzyga remisu.\n\nTutaj obie mają 2 płytki. Posiadasz jedyną akcję Festival poza bankiem.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const ptBR: Catalog = {
|
|||
"swap.receive": "Receber {amount}",
|
||||
"swap.even": "Sem diferença de preço",
|
||||
"swap.unavailable": "Troca indisponível com esta quantidade, limite, ações e dinheiro.",
|
||||
"swap.optionGive": "{chain} · você tem {count} · {price}",
|
||||
"swap.optionTake": "{chain} · banco tem {count} · {price}",
|
||||
"swap.fewer": "Trocar uma a menos",
|
||||
"swap.more": "Trocar uma a mais",
|
||||
"swap.max": "até {count}",
|
||||
"swap.giveDetail": "dar {count} {chain} ({value})",
|
||||
"swap.takeDetail": "receber {count} {chain} ({value})",
|
||||
"swap.after": "Depois desta troca",
|
||||
"swap.confirmExact": "Trocar {count} {from} por {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Não restam trocas neste turno.",
|
||||
"swap.bankEmpty": "O banco não tem ações de {chain}.",
|
||||
"swap.cash": "Dinheiro insuficiente para pagar a diferença de preço.",
|
||||
"log.swapped": "{name} trocou {count} {from} por {count} {to} · {cash}",
|
||||
|
||||
loading: "Carregando o jogo…",
|
||||
|
|
@ -31,6 +43,14 @@ export const ptBR: Catalog = {
|
|||
"panel.label": "Sua decisão",
|
||||
"panel.sending": "Enviando…",
|
||||
"turn.undo": "Desfazer",
|
||||
"turn.summary": "Revise seu turno",
|
||||
"turn.end": "Encerrar turno",
|
||||
"turn.back": "Voltar",
|
||||
"turn.after": "Depois deste turno",
|
||||
"turn.endNote": "Encerrar o turno compra novas peças, então não dá para desfazer.",
|
||||
"turn.gameEnds": "Isto encerra o jogo: os bônus finais são pagos e todas as ações são vendidas.",
|
||||
"turn.finalStep": "Desfazer não estará disponível depois desta etapa.",
|
||||
"turn.finalLines": "Linhas em cinza são definitivas; Desfazer volta pelas outras uma a uma.",
|
||||
"announce.ask": "Encerrar o jogo depois deste turno?",
|
||||
"announce.confirm": "Anunciar o fim",
|
||||
"announce.cancel": "Continuar jogando",
|
||||
|
|
@ -47,10 +67,13 @@ export const ptBR: Catalog = {
|
|||
"place.pass": "Continuar sem colocar",
|
||||
"found.prompt": "Dê nome à nova rede. Você recebe uma ação grátis.",
|
||||
"survivor.prompt": "Estas redes empatam como as maiores. Escolha qual sobrevive.",
|
||||
"survivor.choose": "Escolha a rede sobrevivente",
|
||||
"survivor.confirm": "Confirmar: {survivor} absorve {defunct}",
|
||||
tiles: { one: "{count} peça", many: "{count} peças", other: "{count} peças" },
|
||||
"order.prompt":
|
||||
"A {survivor} sobrevive. Algumas redes absorvidas têm o mesmo tamanho: escolha a ordem em que são liquidadas, da primeira à última.",
|
||||
"order.confirm": "Confirmar a ordem",
|
||||
"order.confirmChains": "Liquidar {chains} nesta ordem",
|
||||
"order.reset": "Recomeçar",
|
||||
"dispose.takenOver": "A {defunct} é absorvida pela {survivor}.",
|
||||
"dispose.holding": {
|
||||
|
|
@ -72,16 +95,30 @@ 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.",
|
||||
"dispose.choose": "Escolha primeiro vender, trocar ou manter.",
|
||||
"dispose.keepAll": "Manter todas",
|
||||
"dispose.tradeRate": "2 {defunct} por 1 {survivor}",
|
||||
"dispose.tradeNone": "O banco não tem mais ações de {chain}",
|
||||
"dispose.tradeFew": "Trocar exige pelo menos 2 ações",
|
||||
"dispose.after": "Depois desta escolha",
|
||||
"dispose.doSell": "vender {count} por {amount}",
|
||||
"dispose.doTrade": "trocar {give} por {receive} {chain}",
|
||||
"dispose.doKeep": "manter {count} {chain}",
|
||||
"dispose.doKeepAll": "manter todas as {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "Você tem",
|
||||
"buy.soldOut": "Nenhuma no banco",
|
||||
"buy.cantAfford": "Dinheiro insuficiente para mais uma",
|
||||
"buy.limitReached": "Limite atingido: {limit} ações por turno.",
|
||||
"board.label": "Tabuleiro",
|
||||
"board.empty": "{tile} vazia",
|
||||
"board.loose": "{tile} peça isolada",
|
||||
|
|
@ -96,6 +133,7 @@ export const ptBR: Catalog = {
|
|||
"hand.eighth": "não dá para fundar uma 8ª rede",
|
||||
"hand.deadNextTurn": "Substituição no início do seu próximo turno",
|
||||
"hand.oneFounding": "não dá para fundar uma segunda rede neste turno",
|
||||
"hand.mergeFounded": "não dá para fundir a rede fundada neste turno",
|
||||
"hand.foundOrMerge": "não dá para fundar uma rede e fundir no mesmo turno",
|
||||
"chains.label": "Redes de hotéis",
|
||||
"chains.title": "Redes",
|
||||
|
|
@ -136,6 +174,9 @@ export const ptBR: Catalog = {
|
|||
"players.turn": "vez",
|
||||
"players.left": "saiu",
|
||||
"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",
|
||||
"seat.name": "{name} (lugar {seat})",
|
||||
"log.label": "Registro do jogo",
|
||||
|
|
@ -251,7 +292,7 @@ export const ptBR: Catalog = {
|
|||
"tutorial.mergers.3": "Coloque 8F entre Worldwide e Festival. Ambas têm 2 peças.",
|
||||
"tutorial.mergers.4": "Escolha Worldwide como a rede sobrevivente.",
|
||||
"tutorial.mergers.5":
|
||||
"Você recebeu os dois bônus de Festival. Guarde sua ação de Festival: deixe venda e troca em 0 e confirme.",
|
||||
"Você recebeu os dois bônus de Festival. Guarde sua ação de Festival: escolha “Manter todas” e confirme.",
|
||||
"tutorial.mergers.6": "Escolha “Não comprar e encerrar turno” para concluir a segunda fusão.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Quando as maiores redes empatam em tamanho, quem coloca a peça de ligação escolhe a sobrevivente. O número de ações não desempata.\n\nAqui, ambas têm 2 peças. Você tem a única ação de Festival fora do banco.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +14,18 @@ export const ro: Catalog = {
|
|||
"swap.receive": "Primești {amount}",
|
||||
"swap.even": "Fără diferență de preț",
|
||||
"swap.unavailable": "Schimb imposibil cu această cantitate, limită, stoc și numerar.",
|
||||
"swap.optionGive": "{chain} · ai {count} · {price}",
|
||||
"swap.optionTake": "{chain} · banca are {count} · {price}",
|
||||
"swap.fewer": "Schimbă una mai puțin",
|
||||
"swap.more": "Schimbă una în plus",
|
||||
"swap.max": "până la {count}",
|
||||
"swap.giveDetail": "dai {count} {chain} ({value})",
|
||||
"swap.takeDetail": "primești {count} {chain} ({value})",
|
||||
"swap.after": "După acest schimb",
|
||||
"swap.confirmExact": "Schimbă {count} {from} pe {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Nu mai ai schimburi în această tură.",
|
||||
"swap.bankEmpty": "Banca nu are acțiuni {chain}.",
|
||||
"swap.cash": "Bani insuficienți pentru diferența de preț.",
|
||||
"log.swapped": "{name} schimbă {count} {from} pentru {count} {to} · {cash}",
|
||||
|
||||
loading: "Se încarcă jocul…",
|
||||
|
|
@ -31,6 +44,14 @@ export const ro: Catalog = {
|
|||
"panel.label": "Decizia ta",
|
||||
"panel.sending": "Se trimite…",
|
||||
"turn.undo": "Anulează",
|
||||
"turn.summary": "Verifică tura",
|
||||
"turn.end": "Încheie tura",
|
||||
"turn.back": "Înapoi",
|
||||
"turn.after": "După această tură",
|
||||
"turn.endNote": "Încheierea turei trage piese noi, deci nu mai poate fi anulată.",
|
||||
"turn.gameEnds": "Aceasta încheie jocul: se plătesc bonusurile finale și se vând toate acțiunile.",
|
||||
"turn.finalStep": "După acest pas nu mai poți anula.",
|
||||
"turn.finalLines": "Liniile gri sunt definitive; Anulează revine pas cu pas asupra celorlalte.",
|
||||
"announce.ask": "Încheiem jocul după această tură?",
|
||||
"announce.confirm": "Anunță sfârșitul",
|
||||
"announce.cancel": "Continuă jocul",
|
||||
|
|
@ -47,10 +68,13 @@ export const ro: Catalog = {
|
|||
"place.pass": "Continuă fără să plasezi",
|
||||
"found.prompt": "Numește lanțul nou. Primești o acțiune gratuită.",
|
||||
"survivor.prompt": "Aceste lanțuri sunt la egalitate ca cele mai mari. Alege care supraviețuiește.",
|
||||
"survivor.choose": "Alege lanțul care supraviețuiește",
|
||||
"survivor.confirm": "Confirmă: {survivor} preia {defunct}",
|
||||
tiles: { one: "{count} piesă", few: "{count} piese", other: "{count} de piese" },
|
||||
"order.prompt":
|
||||
"{survivor} supraviețuiește. Unele lanțuri absorbite au aceeași mărime: alege ordinea în care sunt decontate, de la primul la ultimul.",
|
||||
"order.confirm": "Confirmă ordinea",
|
||||
"order.confirmChains": "Rezolvă {chains} în această ordine",
|
||||
"order.reset": "Ia de la capăt",
|
||||
"dispose.takenOver": "{defunct} este preluat de {survivor}.",
|
||||
"dispose.holding": {
|
||||
|
|
@ -72,16 +96,30 @@ 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ă.",
|
||||
"dispose.choose": "Alege întâi vânzare, schimb sau păstrare.",
|
||||
"dispose.keepAll": "Păstrează tot",
|
||||
"dispose.tradeRate": "2 {defunct} pentru 1 {survivor}",
|
||||
"dispose.tradeNone": "Banca nu mai are acțiuni {chain}",
|
||||
"dispose.tradeFew": "Pentru schimb ai nevoie de cel puțin 2 acțiuni",
|
||||
"dispose.after": "După această alegere",
|
||||
"dispose.doSell": "vinde {count} pentru {amount}",
|
||||
"dispose.doTrade": "schimbă {give} pentru {receive} {chain}",
|
||||
"dispose.doKeep": "păstrează {count} {chain}",
|
||||
"dispose.doKeepAll": "păstrează toate cele {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "Deții",
|
||||
"buy.soldOut": "Banca nu mai are",
|
||||
"buy.cantAfford": "Bani insuficienți pentru încă una",
|
||||
"buy.limitReached": "Limită atinsă: {limit} acțiuni pe tură.",
|
||||
"board.label": "Tablă",
|
||||
"board.empty": "{tile} liber",
|
||||
"board.loose": "{tile} piesă izolată",
|
||||
|
|
@ -96,6 +134,7 @@ export const ro: Catalog = {
|
|||
"hand.eighth": "nu se poate înființa un al 8-lea lanț",
|
||||
"hand.deadNextTurn": "Înlocuire la începutul turei tale următoare",
|
||||
"hand.oneFounding": "nu se poate înființa un al doilea lanț în această tură",
|
||||
"hand.mergeFounded": "nu se poate face fuziunea lanțului înființat în această tură",
|
||||
"hand.foundOrMerge": "nu se poate înființa un lanț și face o fuziune în aceeași tură",
|
||||
"chains.label": "Lanțuri hoteliere",
|
||||
"chains.title": "Lanțuri",
|
||||
|
|
@ -136,6 +175,9 @@ export const ro: Catalog = {
|
|||
"players.turn": "la rând",
|
||||
"players.left": "a plecat",
|
||||
"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",
|
||||
"seat.name": "{name} (locul {seat})",
|
||||
"log.label": "Jurnalul jocului",
|
||||
|
|
@ -251,7 +293,7 @@ export const ro: Catalog = {
|
|||
"tutorial.mergers.3": "Plasează 8F între Worldwide și Festival. Ambele au 2 plăcuțe.",
|
||||
"tutorial.mergers.4": "Alege Worldwide ca lanț supraviețuitor.",
|
||||
"tutorial.mergers.5":
|
||||
"Ai primit ambele bonusuri Festival. Păstrează acțiunea Festival: lasă vânzarea și schimbul la 0, apoi confirmă.",
|
||||
"Ai primit ambele bonusuri Festival. Păstrează acțiunea Festival: alege „Păstrează tot”, apoi confirmă.",
|
||||
"tutorial.mergers.6": "Alege „Nu cumpăra și încheie tura” pentru a termina a doua fuziune.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Când cele mai mari lanțuri au aceeași mărime, jucătorul care plasează plăcuța de legătură alege supraviețuitorul. Numărul de acțiuni nu departajează.\n\nAici ambele au 2 plăcuțe. Deții singura acțiune Festival aflată în afara băncii.",
|
||||
|
|
|
|||
|
|
@ -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": "Отдать (ваши акции)",
|
||||
|
|
@ -13,6 +13,18 @@ export const ru: Catalog = {
|
|||
"swap.receive": "Получить {amount}",
|
||||
"swap.even": "Без доплаты",
|
||||
"swap.unavailable": "Обмен невозможен с этим количеством, лимитом, запасом акций и наличными.",
|
||||
"swap.optionGive": "{chain} · у вас {count} · {price}",
|
||||
"swap.optionTake": "{chain} · в банке {count} · {price}",
|
||||
"swap.fewer": "Обменять на одну меньше",
|
||||
"swap.more": "Обменять на одну больше",
|
||||
"swap.max": "до {count}",
|
||||
"swap.giveDetail": "отдать {count} {chain} ({value})",
|
||||
"swap.takeDetail": "получить {count} {chain} ({value})",
|
||||
"swap.after": "После этого обмена",
|
||||
"swap.confirmExact": "Обменять {count} {from} на {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Обменов в этом ходу больше нет.",
|
||||
"swap.bankEmpty": "В банке нет акций {chain}.",
|
||||
"swap.cash": "Не хватает денег на разницу в цене.",
|
||||
"log.swapped": "{name} обменивает {count} {from} на {count} {to} · {cash}",
|
||||
|
||||
loading: "Загрузка игры…",
|
||||
|
|
@ -31,6 +43,14 @@ export const ru: Catalog = {
|
|||
"panel.label": "Ваше решение",
|
||||
"panel.sending": "Отправка…",
|
||||
"turn.undo": "Отменить",
|
||||
"turn.summary": "Проверьте ход",
|
||||
"turn.end": "Закончить ход",
|
||||
"turn.back": "Назад",
|
||||
"turn.after": "После этого хода",
|
||||
"turn.endNote": "В конце хода берутся новые фишки, поэтому его нельзя отменить.",
|
||||
"turn.gameEnds": "Это завершит игру: будут выплачены итоговые премии и проданы все акции.",
|
||||
"turn.finalStep": "После этого шага отмена будет недоступна.",
|
||||
"turn.finalLines": "Серые строки окончательны; «Отменить» по одной откатывает остальные.",
|
||||
"announce.ask": "Закончить игру после этого хода?",
|
||||
"announce.confirm": "Объявить конец игры",
|
||||
"announce.cancel": "Продолжить игру",
|
||||
|
|
@ -47,10 +67,13 @@ export const ru: Catalog = {
|
|||
"place.pass": "Продолжить без выкладки",
|
||||
"found.prompt": "Назовите новую сеть. Вы получаете одну бесплатную акцию.",
|
||||
"survivor.prompt": "Эти сети одинаково велики и крупнее остальных. Выберите, какая уцелеет.",
|
||||
"survivor.choose": "Выберите уцелевшую сеть",
|
||||
"survivor.confirm": "Подтвердить: {survivor} поглощает {defunct}",
|
||||
tiles: { one: "{count} фишка", few: "{count} фишки", many: "{count} фишек", other: "{count} фишки" },
|
||||
"order.prompt":
|
||||
"{survivor} уцелеет. Некоторые поглощаемые сети одного размера: выберите порядок их расчёта, от первой до последней.",
|
||||
"order.confirm": "Подтвердить порядок",
|
||||
"order.confirmChains": "Ликвидировать {chains} в этом порядке",
|
||||
"order.reset": "Начать заново",
|
||||
"dispose.takenOver": "{survivor} поглощает {defunct}.",
|
||||
"dispose.holding": {
|
||||
|
|
@ -73,16 +96,30 @@ export const ru: Catalog = {
|
|||
"dispose.tradeFewer": "Обменять на две меньше",
|
||||
"dispose.tradeMore": "Обменять на две больше",
|
||||
"dispose.confirm": "Подтвердить",
|
||||
"buy.prompt": "Купите до 3 акций. Цены в этом ходе не меняются.",
|
||||
"dispose.choose": "Сначала выберите: продать, обменять или оставить.",
|
||||
"dispose.keepAll": "Оставить все",
|
||||
"dispose.tradeRate": "2 {defunct} за 1 {survivor}",
|
||||
"dispose.tradeNone": "В банке не осталось акций {chain}",
|
||||
"dispose.tradeFew": "Для обмена нужно не меньше 2 акций",
|
||||
"dispose.after": "После этого выбора",
|
||||
"dispose.doSell": "продать {count} за {amount}",
|
||||
"dispose.doTrade": "обменять {give} на {receive} {chain}",
|
||||
"dispose.doKeep": "оставить {count} {chain}",
|
||||
"dispose.doKeepAll": "оставить все {count} {chain}",
|
||||
"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} и закончить ход",
|
||||
"buy.owned": "У вас",
|
||||
"buy.soldOut": "В банке не осталось",
|
||||
"buy.cantAfford": "Не хватает денег на ещё одну",
|
||||
"buy.limitReached": "Лимит достигнут: {limit} акций за ход.",
|
||||
"board.label": "Поле",
|
||||
"board.empty": "{tile} пусто",
|
||||
"board.loose": "{tile} одиночная фишка",
|
||||
|
|
@ -97,6 +134,7 @@ export const ru: Catalog = {
|
|||
"hand.eighth": "нельзя основать 8-ю сеть",
|
||||
"hand.deadNextTurn": "Заменяются в начале вашего следующего хода",
|
||||
"hand.oneFounding": "нельзя основать вторую сеть за этот ход",
|
||||
"hand.mergeFounded": "нельзя слить сеть, основанную в этот ход",
|
||||
"hand.foundOrMerge": "нельзя за один ход и основать сеть, и провести слияние",
|
||||
"chains.label": "Гостиничные сети",
|
||||
"chains.title": "Сети",
|
||||
|
|
@ -136,6 +174,9 @@ export const ru: Catalog = {
|
|||
"players.turn": "ход",
|
||||
"players.left": "вышел",
|
||||
"players.none": "нет",
|
||||
"players.shareCount": { one: "{count} акция", few: "{count} акции", many: "{count} акций", other: "{count} акции" },
|
||||
"players.shareCountHint": "Всего по всем сетям; акции по сетям скрыты",
|
||||
"log.optionIgnored.publicHoldings": "Опция {option} пропущена: publicHoldings уже показывает все активы",
|
||||
hidden: "скрыто",
|
||||
"seat.name": "{name} (место {seat})",
|
||||
"log.label": "Журнал игры",
|
||||
|
|
@ -257,7 +298,7 @@ export const ru: Catalog = {
|
|||
"tutorial.mergers.3": "Разместите 8F между Worldwide и Festival. У обеих сетей по 2 плитки.",
|
||||
"tutorial.mergers.4": "Выберите Worldwide в качестве выжившей сети.",
|
||||
"tutorial.mergers.5":
|
||||
"Вы получили обе премии Festival. Сохраните акцию Festival: оставьте продажу и обмен на 0 и подтвердите.",
|
||||
"Вы получили обе премии Festival. Сохраните акцию Festival: выберите «Оставить все» и подтвердите.",
|
||||
"tutorial.mergers.6": "Выберите «Ничего не покупать и закончить ход», чтобы завершить второе слияние.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Если крупнейшие сети равны по размеру, игрок, разместивший соединяющую плитку, выбирает выжившую. Число акций не разрешает ничью.\n\nЗдесь у обеих сетей по 2 плитки. Вам принадлежит единственная акция Festival вне банка.",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
@ -13,6 +13,18 @@ export const vi: Catalog = {
|
|||
"swap.receive": "Nhận {amount}",
|
||||
"swap.even": "Không chênh lệch tiền",
|
||||
"swap.unavailable": "Không thể đổi với số lượng, hạn mức, cổ phiếu và tiền mặt này.",
|
||||
"swap.optionGive": "{chain} · bạn có {count} · {price}",
|
||||
"swap.optionTake": "{chain} · ngân hàng có {count} · {price}",
|
||||
"swap.fewer": "Đổi bớt một",
|
||||
"swap.more": "Đổi thêm một",
|
||||
"swap.max": "tối đa {count}",
|
||||
"swap.giveDetail": "đưa {count} {chain} ({value})",
|
||||
"swap.takeDetail": "nhận {count} {chain} ({value})",
|
||||
"swap.after": "Sau lần đổi này",
|
||||
"swap.confirmExact": "Đổi {count} {from} lấy {count} {to} · {cash}",
|
||||
"swap.noneLeft": "Lượt này đã hết lần đổi.",
|
||||
"swap.bankEmpty": "Ngân hàng không có cổ phiếu {chain}.",
|
||||
"swap.cash": "Không đủ tiền trả phần chênh lệch giá.",
|
||||
"log.swapped": "{name} đổi {count} {from} lấy {count} {to} · {cash}",
|
||||
|
||||
loading: "Đang tải ván chơi…",
|
||||
|
|
@ -31,6 +43,14 @@ export const vi: Catalog = {
|
|||
"panel.label": "Quyết định của bạn",
|
||||
"panel.sending": "Đang gửi…",
|
||||
"turn.undo": "Hoàn tác",
|
||||
"turn.summary": "Xem lại lượt",
|
||||
"turn.end": "Kết thúc lượt",
|
||||
"turn.back": "Quay lại",
|
||||
"turn.after": "Sau lượt này",
|
||||
"turn.endNote": "Kết thúc lượt sẽ bốc ô mới nên không thể hoàn tác.",
|
||||
"turn.gameEnds": "Ván đấu sẽ kết thúc: trả thưởng cuối và bán toàn bộ cổ phiếu.",
|
||||
"turn.finalStep": "Sau bước này sẽ không thể hoàn tác.",
|
||||
"turn.finalLines": "Dòng màu xám đã cố định; Hoàn tác lùi lại từng bước cho phần còn lại.",
|
||||
"announce.ask": "Kết thúc ván chơi sau lượt này?",
|
||||
"announce.confirm": "Tuyên bố kết thúc",
|
||||
"announce.cancel": "Tiếp tục chơi",
|
||||
|
|
@ -47,10 +67,13 @@ export const vi: Catalog = {
|
|||
"place.pass": "Tiếp tục mà không đặt",
|
||||
"found.prompt": "Đặt tên cho chuỗi mới. Bạn nhận một cổ phiếu miễn phí.",
|
||||
"survivor.prompt": "Các chuỗi này lớn nhất và bằng nhau. Chọn chuỗi tồn tại.",
|
||||
"survivor.choose": "Chọn chuỗi tồn tại",
|
||||
"survivor.confirm": "Xác nhận: {survivor} thâu tóm {defunct}",
|
||||
tiles: { other: "{count} ô" },
|
||||
"order.prompt":
|
||||
"{survivor} tồn tại. Một số chuỗi bị thâu tóm có cùng kích thước: chọn thứ tự thanh toán chúng, từ đầu đến cuối.",
|
||||
"order.confirm": "Xác nhận thứ tự",
|
||||
"order.confirmChains": "Giải quyết {chains} theo thứ tự này",
|
||||
"order.reset": "Chọn lại",
|
||||
"dispose.takenOver": "{defunct} bị {survivor} thâu tóm.",
|
||||
"dispose.holding": { other: "Bạn có {count} cổ phiếu {chain}." },
|
||||
|
|
@ -68,16 +91,30 @@ 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.",
|
||||
"dispose.choose": "Hãy chọn bán, đổi hoặc giữ trước.",
|
||||
"dispose.keepAll": "Giữ tất cả",
|
||||
"dispose.tradeRate": "2 {defunct} lấy 1 {survivor}",
|
||||
"dispose.tradeNone": "Ngân hàng đã hết cổ phiếu {chain}",
|
||||
"dispose.tradeFew": "Cần ít nhất 2 cổ phiếu để đổi",
|
||||
"dispose.after": "Sau lựa chọn này",
|
||||
"dispose.doSell": "bán {count} được {amount}",
|
||||
"dispose.doTrade": "đổi {give} lấy {receive} {chain}",
|
||||
"dispose.doKeep": "giữ {count} {chain}",
|
||||
"dispose.doKeepAll": "giữ cả {count} {chain}",
|
||||
"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",
|
||||
"buy.owned": "Bạn có",
|
||||
"buy.soldOut": "Ngân hàng đã hết",
|
||||
"buy.cantAfford": "Không đủ tiền mua thêm",
|
||||
"buy.limitReached": "Đã đạt giới hạn: {limit} cổ phiếu mỗi lượt.",
|
||||
"board.label": "Bàn chơi",
|
||||
"board.empty": "{tile} trống",
|
||||
"board.loose": "{tile} ô nằm riêng",
|
||||
|
|
@ -92,6 +129,7 @@ export const vi: Catalog = {
|
|||
"hand.eighth": "không thể lập chuỗi thứ 8",
|
||||
"hand.deadNextTurn": "Được thay khi bắt đầu lượt sau của bạn",
|
||||
"hand.oneFounding": "không thể lập chuỗi thứ hai trong lượt này",
|
||||
"hand.mergeFounded": "không thể sáp nhập chuỗi vừa lập trong lượt này",
|
||||
"hand.foundOrMerge": "không thể vừa lập chuỗi vừa sáp nhập trong cùng một lượt",
|
||||
"chains.label": "Chuỗi khách sạn",
|
||||
"chains.title": "Chuỗi",
|
||||
|
|
@ -132,6 +170,9 @@ export const vi: Catalog = {
|
|||
"players.turn": "lượt",
|
||||
"players.left": "đã rời",
|
||||
"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",
|
||||
"seat.name": "{name} (ghế {seat})",
|
||||
"log.label": "Nhật ký ván chơi",
|
||||
|
|
@ -223,7 +264,7 @@ export const vi: Catalog = {
|
|||
"tutorial.mergers.3": "Đặt 8F giữa Worldwide và Festival. Cả hai đều có 2 ô.",
|
||||
"tutorial.mergers.4": "Chọn Worldwide làm chuỗi tồn tại.",
|
||||
"tutorial.mergers.5":
|
||||
"Bạn đã nhận cả hai khoản thưởng Festival. Giữ cổ phiếu Festival: để bán và đổi ở 0 rồi xác nhận.",
|
||||
"Bạn đã nhận cả hai khoản thưởng Festival. Giữ cổ phiếu Festival: chọn “Giữ tất cả” rồi xác nhận.",
|
||||
"tutorial.mergers.6": "Chọn “Không mua và kết thúc lượt” để hoàn tất vụ sáp nhập thứ hai.",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"Khi các chuỗi lớn nhất bằng nhau, người đặt ô nối chọn chuỗi tồn tại. Số cổ phiếu không quyết định kết quả hòa.\n\nỞ đây, mỗi chuỗi có 2 ô. Bạn giữ cổ phiếu Festival duy nhất ngoài ngân hàng.",
|
||||
|
|
|
|||
|
|
@ -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": "交出(持有股票)",
|
||||
|
|
@ -13,6 +13,18 @@ export const zhCN: Catalog = {
|
|||
"swap.receive": "收取 {amount}",
|
||||
"swap.even": "无价差",
|
||||
"swap.unavailable": "此数量、交换限额、股票与现金不足以完成交换。",
|
||||
"swap.optionGive": "{chain} · 持有 {count} · {price}",
|
||||
"swap.optionTake": "{chain} · 银行 {count} · {price}",
|
||||
"swap.fewer": "少换一股",
|
||||
"swap.more": "多换一股",
|
||||
"swap.max": "最多 {count}",
|
||||
"swap.giveDetail": "交出 {count} 股 {chain}({value})",
|
||||
"swap.takeDetail": "取得 {count} 股 {chain}({value})",
|
||||
"swap.after": "此交换后",
|
||||
"swap.confirmExact": "用 {count} 股 {from} 换 {count} 股 {to} · {cash}",
|
||||
"swap.noneLeft": "本回合已无交换次数。",
|
||||
"swap.bankEmpty": "银行没有 {chain} 股票。",
|
||||
"swap.cash": "现金不足以支付差价。",
|
||||
"log.swapped": "{name} 以 {count} 股 {from} 交换 {count} 股 {to} · {cash}",
|
||||
|
||||
loading: "正在加载游戏…",
|
||||
|
|
@ -31,6 +43,14 @@ export const zhCN: Catalog = {
|
|||
"panel.label": "你的决定",
|
||||
"panel.sending": "正在发送…",
|
||||
"turn.undo": "撤销",
|
||||
"turn.summary": "查看本回合",
|
||||
"turn.end": "结束回合",
|
||||
"turn.back": "返回",
|
||||
"turn.after": "本回合后",
|
||||
"turn.endNote": "结束回合会抽取新板块,因此无法撤销。",
|
||||
"turn.gameEnds": "游戏将结束:支付最终奖金并出售所有股票。",
|
||||
"turn.finalStep": "此步骤之后将无法撤销。",
|
||||
"turn.finalLines": "灰色项目已确定;撤销会逐步撤回其余项目。",
|
||||
"announce.ask": "在本回合结束后结束游戏?",
|
||||
"announce.confirm": "宣布结束",
|
||||
"announce.cancel": "继续游戏",
|
||||
|
|
@ -47,9 +67,12 @@ export const zhCN: Catalog = {
|
|||
"place.pass": "不放置,继续",
|
||||
"found.prompt": "为新连锁命名。你将获得一股免费股票。",
|
||||
"survivor.prompt": "这些连锁并列最大。请选择存续的连锁。",
|
||||
"survivor.choose": "选择存续连锁",
|
||||
"survivor.confirm": "确认:{survivor} 并购 {defunct}",
|
||||
tiles: { other: "{count} 块" },
|
||||
"order.prompt": "{survivor} 存续。部分被吞并的连锁大小相同:请从先到后选择它们的结算顺序。",
|
||||
"order.confirm": "确认顺序",
|
||||
"order.confirmChains": "按此顺序结算 {chains}",
|
||||
"order.reset": "重新选择",
|
||||
"dispose.takenOver": "{defunct} 被 {survivor} 吞并。",
|
||||
"dispose.holding": { other: "你持有 {count} 股 {chain}。" },
|
||||
|
|
@ -67,16 +90,30 @@ export const zhCN: Catalog = {
|
|||
"dispose.tradeFewer": "少换两股",
|
||||
"dispose.tradeMore": "多换两股",
|
||||
"dispose.confirm": "确认",
|
||||
"buy.prompt": "最多购买 3 股。本回合内价格不变。",
|
||||
"dispose.choose": "请先选择出售、交换或保留。",
|
||||
"dispose.keepAll": "全部保留",
|
||||
"dispose.tradeRate": "2 股 {defunct} 换 1 股 {survivor}",
|
||||
"dispose.tradeNone": "银行已没有 {chain} 股票",
|
||||
"dispose.tradeFew": "交换至少需要 2 股",
|
||||
"dispose.after": "此选择后",
|
||||
"dispose.doSell": "以 {amount} 出售 {count} 股",
|
||||
"dispose.doTrade": "用 {give} 股换 {receive} 股 {chain}",
|
||||
"dispose.doKeep": "保留 {count} 股 {chain}",
|
||||
"dispose.doKeepAll": "保留全部 {count} 股 {chain}",
|
||||
"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} 购买并结束回合",
|
||||
"buy.owned": "持有",
|
||||
"buy.soldOut": "银行已无存股",
|
||||
"buy.cantAfford": "现金不足以再买一股",
|
||||
"buy.limitReached": "已达上限:每回合 {limit} 股。",
|
||||
"board.label": "游戏版图",
|
||||
"board.empty": "{tile} 空",
|
||||
"board.loose": "{tile} 单独板块",
|
||||
|
|
@ -91,6 +128,7 @@ export const zhCN: Catalog = {
|
|||
"hand.eighth": "无法创立第 8 个连锁",
|
||||
"hand.deadNextTurn": "在你下一回合开始时更换",
|
||||
"hand.oneFounding": "本回合不能再创立第二个连锁",
|
||||
"hand.mergeFounded": "不能合并本回合创立的连锁",
|
||||
"hand.foundOrMerge": "同一回合内不能既创立连锁又进行合并",
|
||||
"chains.label": "酒店连锁",
|
||||
"chains.title": "连锁",
|
||||
|
|
@ -129,6 +167,9 @@ export const zhCN: Catalog = {
|
|||
"players.turn": "回合",
|
||||
"players.left": "已离开",
|
||||
"players.none": "无",
|
||||
"players.shareCount": { other: "{count} 股" },
|
||||
"players.shareCountHint": "所有连锁的合计;各连锁的持股不公开",
|
||||
"log.optionIgnored.publicHoldings": "已忽略选项 {option}:publicHoldings 已公开全部持股",
|
||||
hidden: "隐藏",
|
||||
"seat.name": "{name}(座位 {seat})",
|
||||
"log.label": "游戏记录",
|
||||
|
|
@ -219,7 +260,7 @@ export const zhCN: Catalog = {
|
|||
"你已有 3 股 Tower。再买 1 股后共有 4 股,总支出为 $700。\n\n每个回合都可以新购最多 3 股。你也可以不买,保留现金。",
|
||||
"tutorial.mergers.3": "在 Worldwide 和 Festival 之间放置 8F。两者都占 2 格。",
|
||||
"tutorial.mergers.4": "选择 Worldwide 作为存续连锁。",
|
||||
"tutorial.mergers.5": "你已获得 Festival 的两项奖金。保留 Festival 股票:将出售和交换保持为 0,然后确认。",
|
||||
"tutorial.mergers.5": "你已获得 Festival 的两项奖金。保留 Festival 股票:选择“全部保留”,然后确认。",
|
||||
"tutorial.mergers.6": "选择“不购买并结束回合”,完成第二次合并。",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"当最大的连锁规模相同时,由放置连接方块的玩家选择存续连锁。持股数量不能打破平局。\n\n这里两家都占 2 格。银行以外唯一的 Festival 股票在你手中。",
|
||||
|
|
|
|||
|
|
@ -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": "交出(持有股票)",
|
||||
|
|
@ -13,6 +13,18 @@ export const zhTW: Catalog = {
|
|||
"swap.receive": "收取 {amount}",
|
||||
"swap.even": "無價差",
|
||||
"swap.unavailable": "此數量、交換限額、股票與現金不足以完成交換。",
|
||||
"swap.optionGive": "{chain} · 持有 {count} · {price}",
|
||||
"swap.optionTake": "{chain} · 銀行 {count} · {price}",
|
||||
"swap.fewer": "少換一股",
|
||||
"swap.more": "多換一股",
|
||||
"swap.max": "最多 {count}",
|
||||
"swap.giveDetail": "交出 {count} 股 {chain}({value})",
|
||||
"swap.takeDetail": "取得 {count} 股 {chain}({value})",
|
||||
"swap.after": "此交換後",
|
||||
"swap.confirmExact": "以 {count} 股 {from} 換 {count} 股 {to} · {cash}",
|
||||
"swap.noneLeft": "本回合已無交換次數。",
|
||||
"swap.bankEmpty": "銀行沒有 {chain} 股票。",
|
||||
"swap.cash": "現金不足以支付差價。",
|
||||
"log.swapped": "{name} 以 {count} 股 {from} 交換 {count} 股 {to} · {cash}",
|
||||
|
||||
loading: "正在載入遊戲…",
|
||||
|
|
@ -31,6 +43,14 @@ export const zhTW: Catalog = {
|
|||
"panel.label": "你的決定",
|
||||
"panel.sending": "正在傳送…",
|
||||
"turn.undo": "復原",
|
||||
"turn.summary": "檢視本回合",
|
||||
"turn.end": "結束回合",
|
||||
"turn.back": "返回",
|
||||
"turn.after": "本回合後",
|
||||
"turn.endNote": "結束回合會抽取新圖塊,因此無法復原。",
|
||||
"turn.gameEnds": "遊戲將結束:支付最終獎金並出售所有股票。",
|
||||
"turn.finalStep": "此步驟之後將無法復原。",
|
||||
"turn.finalLines": "灰色項目已確定;復原會逐步撤回其餘項目。",
|
||||
"announce.ask": "在本回合結束後結束遊戲?",
|
||||
"announce.confirm": "宣布結束",
|
||||
"announce.cancel": "繼續遊戲",
|
||||
|
|
@ -47,9 +67,12 @@ export const zhTW: Catalog = {
|
|||
"place.pass": "不放置,繼續",
|
||||
"found.prompt": "為新連鎖命名。你將獲得一股免費股票。",
|
||||
"survivor.prompt": "這些連鎖並列最大。請選擇存續的連鎖。",
|
||||
"survivor.choose": "選擇存續連鎖",
|
||||
"survivor.confirm": "確認:{survivor} 併購 {defunct}",
|
||||
tiles: { other: "{count} 塊" },
|
||||
"order.prompt": "{survivor} 存續。部分被併購的連鎖大小相同:請由先到後選擇它們的結算順序。",
|
||||
"order.confirm": "確認順序",
|
||||
"order.confirmChains": "依此順序結算 {chains}",
|
||||
"order.reset": "重新選擇",
|
||||
"dispose.takenOver": "{defunct} 被 {survivor} 併購。",
|
||||
"dispose.holding": { other: "你持有 {count} 股 {chain}。" },
|
||||
|
|
@ -67,16 +90,30 @@ export const zhTW: Catalog = {
|
|||
"dispose.tradeFewer": "少換兩股",
|
||||
"dispose.tradeMore": "多換兩股",
|
||||
"dispose.confirm": "確認",
|
||||
"buy.prompt": "最多購買 3 股。本回合內價格不變。",
|
||||
"dispose.choose": "請先選擇出售、交換或保留。",
|
||||
"dispose.keepAll": "全部保留",
|
||||
"dispose.tradeRate": "2 股 {defunct} 換 1 股 {survivor}",
|
||||
"dispose.tradeNone": "銀行已沒有 {chain} 股票",
|
||||
"dispose.tradeFew": "交換至少需要 2 股",
|
||||
"dispose.after": "此選擇後",
|
||||
"dispose.doSell": "以 {amount} 出售 {count} 股",
|
||||
"dispose.doTrade": "以 {give} 股換 {receive} 股 {chain}",
|
||||
"dispose.doKeep": "保留 {count} 股 {chain}",
|
||||
"dispose.doKeepAll": "保留全部 {count} 股 {chain}",
|
||||
"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} 購買並結束回合",
|
||||
"buy.owned": "持有",
|
||||
"buy.soldOut": "銀行已無存股",
|
||||
"buy.cantAfford": "現金不足以再買一股",
|
||||
"buy.limitReached": "已達上限:每回合 {limit} 股。",
|
||||
"board.label": "遊戲圖板",
|
||||
"board.empty": "{tile} 空",
|
||||
"board.loose": "{tile} 單獨板塊",
|
||||
|
|
@ -91,6 +128,7 @@ export const zhTW: Catalog = {
|
|||
"hand.eighth": "無法創立第 8 個連鎖",
|
||||
"hand.deadNextTurn": "在你下一回合開始時更換",
|
||||
"hand.oneFounding": "本回合不能再創立第二個連鎖",
|
||||
"hand.mergeFounded": "不能合併本回合創立的連鎖",
|
||||
"hand.foundOrMerge": "同一回合內不能既創立連鎖又進行合併",
|
||||
"chains.label": "飯店連鎖",
|
||||
"chains.title": "連鎖",
|
||||
|
|
@ -129,6 +167,9 @@ export const zhTW: Catalog = {
|
|||
"players.turn": "回合",
|
||||
"players.left": "已離開",
|
||||
"players.none": "無",
|
||||
"players.shareCount": { other: "{count} 股" },
|
||||
"players.shareCountHint": "所有連鎖的合計;各連鎖的持股不公開",
|
||||
"log.optionIgnored.publicHoldings": "已忽略選項 {option}:publicHoldings 已公開全部持股",
|
||||
hidden: "隱藏",
|
||||
"seat.name": "{name}(座位 {seat})",
|
||||
"log.label": "遊戲紀錄",
|
||||
|
|
@ -219,7 +260,7 @@ export const zhTW: Catalog = {
|
|||
"你已有 3 股 Tower。再買 1 股後共有 4 股,總支出為 $700。\n\n每個回合都可以新購最多 3 股。你也可以不買,保留現金。",
|
||||
"tutorial.mergers.3": "在 Worldwide 和 Festival 之間放置 8F。兩者都占 2 格。",
|
||||
"tutorial.mergers.4": "選擇 Worldwide 作為存續連鎖。",
|
||||
"tutorial.mergers.5": "你已獲得 Festival 的兩項獎金。保留 Festival 股票:將出售與交換保持為 0,然後確認。",
|
||||
"tutorial.mergers.5": "你已獲得 Festival 的兩項獎金。保留 Festival 股票:選擇「全部保留」,然後確認。",
|
||||
"tutorial.mergers.6": "選擇「不購買並結束回合」,完成第二次合併。",
|
||||
"tutorial.mechanics.equalMerger":
|
||||
"當最大的連鎖規模相同時,由放置連接方塊的玩家選擇存續連鎖。持股數量不能打破平手。\n\n這裡兩家都占 2 格。銀行以外唯一的 Festival 股票在你手中。",
|
||||
|
|
|
|||
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
|
||||
// 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";
|
||||
|
||||
const HIDDEN_SHARES = Object.fromEntries(CHAIN_IDS.map((chain) => [chain, HIDDEN])) as Shares;
|
||||
import { HIDDEN, maskHoldings, positionAt, seatsOf, visibilityNow, type GameState } from "acquire-engine";
|
||||
|
||||
/** The first replay position: the board after setup, at the start of the first turn. */
|
||||
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:
|
||||
* public holdings, a finished game, or the viewer's own seats. Tiles in hand are never shown.
|
||||
* The game as it stood after `at` log entries. Holdings show only as far as they are public now
|
||||
* (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 {
|
||||
const position = positionAt(state, at);
|
||||
const own = seatsOf(state, player);
|
||||
const holdingsPublic = state.options.publicHoldings || state.ended;
|
||||
const level = visibilityNow(state);
|
||||
return {
|
||||
...state,
|
||||
board: position.board,
|
||||
bank: position.bank,
|
||||
seats: state.seats.map((seat, index) => {
|
||||
const shown = position.seats[index]!;
|
||||
const visible = holdingsPublic || own.includes(index);
|
||||
const { shareCount: _, ...rest } = seat;
|
||||
return {
|
||||
...seat,
|
||||
cash: visible ? shown.cash : HIDDEN,
|
||||
shares: visible ? shown.shares : { ...HIDDEN_SHARES },
|
||||
...rest,
|
||||
...maskHoldings(shown, own.includes(index) ? "public" : level),
|
||||
hand: Array.from({ length: shown.tiles }, () => HIDDEN),
|
||||
};
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,14 @@ import { movesFor } from "./decisions";
|
|||
import { langFor } from "./format";
|
||||
import { isRightToLeft, type Locale } from "./i18n";
|
||||
import { replayStart, replayView } from "./replay";
|
||||
import { TurnDraft } from "./turn-draft";
|
||||
import { moveOutcome, reviewFor, TurnDraft, type MoveOutcome } from "./turn-draft";
|
||||
|
||||
/** A move held back for confirmation: the end of the turn, or a step that ends undo. */
|
||||
export interface PendingReview {
|
||||
move: Move;
|
||||
kind: "end" | "commit";
|
||||
outcome: MoveOutcome;
|
||||
}
|
||||
|
||||
/** Context key: the store is given to every component at mount, for viewer-wide settings. */
|
||||
export const STORE = Symbol("viewer-store");
|
||||
|
|
@ -53,20 +60,35 @@ export class ViewerStore {
|
|||
|
||||
private readonly draft = new TurnDraft();
|
||||
undoCount = $state(0);
|
||||
/** The first log entry that Undo can still take back (earlier entries are final). */
|
||||
undoFrom = $state(0);
|
||||
/** The move awaiting confirmation in the turn summary, if any. */
|
||||
review = $state<PendingReview | undefined>();
|
||||
reviewing = $derived(this.review !== undefined && this.moves.length > 0 && !this.sending);
|
||||
canUndo = $derived(
|
||||
this.undoCount > 0 && !this.sending && !this.readOnly && !this.analysis && this.replayAt === undefined
|
||||
);
|
||||
|
||||
constructor(
|
||||
private readonly sendMove: (move: Move | TurnRequest) => boolean,
|
||||
private readonly options: { turnDrafts?: boolean; onState?: (state: GameState) => void } = {}
|
||||
private readonly options: {
|
||||
turnDrafts?: boolean;
|
||||
/** Confirm the end of each turn with a summary (off in tutorials, whose steps name each button). */
|
||||
reviewTurns?: boolean;
|
||||
onState?: (state: GameState) => void;
|
||||
} = {}
|
||||
) {}
|
||||
|
||||
private display(state: GameState): void {
|
||||
this.state = state;
|
||||
if (!this.replayable) {
|
||||
this.replayAt = undefined;
|
||||
}
|
||||
this.selected = undefined;
|
||||
this.sending = false;
|
||||
this.review = undefined;
|
||||
this.undoCount = this.draft.count;
|
||||
this.undoFrom = this.draft.base?.log.length ?? state.log.length;
|
||||
this.options.onState?.(state);
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +123,7 @@ export class ViewerStore {
|
|||
if (!this.canUndo) {
|
||||
return;
|
||||
}
|
||||
this.review = undefined;
|
||||
const previous = this.draft.undo();
|
||||
if (previous) {
|
||||
this.display(previous);
|
||||
|
|
@ -108,7 +131,7 @@ export class ViewerStore {
|
|||
}
|
||||
|
||||
/** With a limited log (rules.md §13), replay waits until the game ends and the log is whole. */
|
||||
replayable = $derived(!this.state?.log.some((entry) => entry.type === "hidden"));
|
||||
replayable = $derived(!this.state?.options.limitedLog || this.state.ended);
|
||||
|
||||
/** The replay range BGS shows in its controls: setup done, up to the live position. */
|
||||
replayRange(): { start: number; end: number } {
|
||||
|
|
@ -116,11 +139,32 @@ export class ViewerStore {
|
|||
return { start: this.replayable ? replayStart(this.state!) : end, end };
|
||||
}
|
||||
|
||||
send(move: Move): void {
|
||||
/** Moves are private drafts that can be undone until a commit boundary. */
|
||||
get drafting(): boolean {
|
||||
return !!(this.options.turnDrafts && this.state?.supportsTurnDrafts && !this.analysis);
|
||||
}
|
||||
|
||||
/** What sending `move` now would do to the private turn draft. */
|
||||
outcome(move: Move): MoveOutcome | undefined {
|
||||
return this.state ? moveOutcome($state.snapshot(this.state), move, this.player) : undefined;
|
||||
}
|
||||
|
||||
/** Sends a move, first holding back the end of the turn for its summary unless `confirmed`. */
|
||||
send(move: Move, confirmed = false): void {
|
||||
if (this.sending || this.readOnly || this.replayAt !== undefined) {
|
||||
return;
|
||||
}
|
||||
const action = $state.snapshot(move);
|
||||
if (!confirmed && this.options.reviewTurns && this.state) {
|
||||
const view = $state.snapshot(this.state);
|
||||
const outcome = moveOutcome(view, action, this.player);
|
||||
const kind = reviewFor(view, action, outcome, this.drafting ? this.undoCount : 0);
|
||||
if (kind) {
|
||||
this.review = { move: action, kind, outcome };
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.review = undefined;
|
||||
const request =
|
||||
this.options.turnDrafts && this.state?.supportsTurnDrafts && !this.analysis ? this.draft.begin(action) : action;
|
||||
this.sending = true;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,20 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { type Move } from "acquire-engine";
|
||||
import {
|
||||
applyMove,
|
||||
currentSeat,
|
||||
draftCanContinue,
|
||||
dropPlayerSeats,
|
||||
initGame,
|
||||
legalMoves,
|
||||
parseTile,
|
||||
tileLabel,
|
||||
type GameState,
|
||||
type Move,
|
||||
} from "acquire-engine";
|
||||
import * as engine from "acquire-engine/wrapper";
|
||||
import { preparedPosition } from "../tutorial/lessons.ts";
|
||||
import { TurnDraft } from "./turn-draft.ts";
|
||||
import { currentTurnEntries, moveOutcome, reviewFor, TurnDraft, type MoveOutcome } from "./turn-draft.ts";
|
||||
|
||||
function setup() {
|
||||
const full = preparedPosition("founding");
|
||||
|
|
@ -81,3 +92,120 @@ test("new committed states and player changes close undo; repeated revisions sta
|
|||
draft.reset();
|
||||
assert.equal(draft.base, undefined);
|
||||
});
|
||||
|
||||
function truth(full: GameState, move: Move, player: number): MoveOutcome {
|
||||
const seat = currentSeat(full)!;
|
||||
const after = applyMove(structuredClone(full), move, seat);
|
||||
// A dropped player's automatic turn depends on their hidden hand and cash.
|
||||
const automatic = after.log.slice(full.log.length).some((entry) => entry.type === "move" && entry.auto);
|
||||
return {
|
||||
commits: !draftCanContinue(full, after, player),
|
||||
endsTurn: seat === full.activeSeat && (after.ended || after.turn !== full.turn),
|
||||
endsGame: after.ended && !automatic,
|
||||
};
|
||||
}
|
||||
|
||||
test("commit boundaries predicted from a private view match the engine's draft boundaries", () => {
|
||||
// The second twoTiles seed drops a player, whose later turns are played automatically.
|
||||
const variants: [number, Record<string, unknown>, string][] = [
|
||||
[4, {}, "a"],
|
||||
[3, { twoTiles: true }, "a"],
|
||||
[3, { twoTiles: true }, "drop"],
|
||||
[3, { stockSwap: "3" }, "a"],
|
||||
[2, {}, "a"],
|
||||
[2, { twoPlayerMode: "fourHands", twoTiles: true }, "a"],
|
||||
[4, { publicHoldings: true, autoEnd: true, endSize: "31" }, "a"],
|
||||
[4, { limitedLog: true, stockSwap: "5" }, "a"],
|
||||
[6, { sharesPerTurn: "5" }, "a"],
|
||||
];
|
||||
const seen = new Set<string>();
|
||||
for (const [players, options, seed] of variants) {
|
||||
const state = initGame(players, options, `outcome-${seed}`);
|
||||
for (let step = 0; step < 400 && !state.ended; step++) {
|
||||
if (seed === "drop" && step === 150) {
|
||||
dropPlayerSeats(state, 2);
|
||||
continue;
|
||||
}
|
||||
const seat = currentSeat(state)!;
|
||||
const player = state.seatOwner[seat]!;
|
||||
const view = engine.stripSecret(state, player);
|
||||
const moves = legalMoves(state);
|
||||
const buys = moves.filter((move) => move.type === "buy");
|
||||
const sample = [...moves.filter((move) => move.type !== "buy").slice(0, 3), buys[0], buys.at(-1)];
|
||||
for (const move of sample) {
|
||||
if (!move) {
|
||||
continue;
|
||||
}
|
||||
const expected = truth(state, move, player);
|
||||
assert.deepEqual(moveOutcome(view, move, player), expected, `${players} ${JSON.stringify(options)} ${step}`);
|
||||
seen.add(`${move.type}:${expected.commits}:${expected.endsTurn}:${expected.endsGame}`);
|
||||
}
|
||||
const choices = moves.filter((move) => move.type !== "announce" || step > 250);
|
||||
applyMove(state, choices[(step * 7919) % choices.length]!, seat);
|
||||
}
|
||||
}
|
||||
for (const kind of [
|
||||
"place:false:false:false",
|
||||
"place:true:false:false",
|
||||
"place:true:true:false",
|
||||
"survivor:true:false:false",
|
||||
"dispose:true:false:false",
|
||||
"dispose:false:false:false",
|
||||
"swap:false:false:false",
|
||||
"announce:false:false:false",
|
||||
"buy:true:true:false",
|
||||
"buy:true:true:true",
|
||||
]) {
|
||||
assert.ok(seen.has(kind), `covered ${kind}`);
|
||||
}
|
||||
});
|
||||
|
||||
const review = (view: GameState, move: Move, player: number, undoable: number) =>
|
||||
reviewFor(view, move, moveOutcome(view, move, player), undoable);
|
||||
|
||||
test("only the turn's final step, or a placement that ends undo, asks for review", () => {
|
||||
const full = preparedPosition("founding");
|
||||
const view = () => engine.stripSecret(full, 0);
|
||||
assert.equal(review(view(), place, 0, 0), undefined, "placing a founding tile continues");
|
||||
applyMove(full, place, 0);
|
||||
applyMove(full, found, 0);
|
||||
assert.equal(review(view(), { type: "buy", shares: {} }, 0, 2), "end");
|
||||
assert.equal(review(view(), { type: "announce" }, 0, 2), undefined);
|
||||
assert.deepEqual(
|
||||
currentTurnEntries(view()).flatMap((entry) => (entry.type === "move" ? [entry.move.type] : [])),
|
||||
["place", "found"]
|
||||
);
|
||||
|
||||
// A lone placement that ends the turn already has the placement confirmation.
|
||||
const quiet = initGame(3, {}, "lone");
|
||||
const seat = quiet.activeSeat;
|
||||
quiet.board.fill(null);
|
||||
const tile = quiet.seats[seat]!.hand[0]!;
|
||||
const lone: Move = { type: "place", tile: tileLabel(tile) };
|
||||
assert.equal(moveOutcome(engine.stripSecret(quiet, seat), lone, seat).endsTurn, true);
|
||||
assert.equal(review(engine.stripSecret(quiet, seat), lone, seat, 0), undefined);
|
||||
|
||||
// With two tiles, the second placement ends the turn after an earlier move.
|
||||
const two = initGame(3, { twoTiles: true }, "two");
|
||||
two.board.fill(null);
|
||||
const turnSeat = two.activeSeat;
|
||||
two.seats[turnSeat]!.hand = ["1A", "5E", "9I"].map((label) => parseTile(label)!);
|
||||
applyMove(two, { type: "place", tile: "1A" }, turnSeat);
|
||||
const second: Move = { type: "place", tile: "5E" };
|
||||
assert.equal(two.phase, "place");
|
||||
assert.equal(moveOutcome(engine.stripSecret(two, turnSeat), second, turnSeat).endsTurn, true);
|
||||
assert.equal(review(engine.stripSecret(two, turnSeat), second, turnSeat, 1), "end");
|
||||
});
|
||||
|
||||
test("a placement that pays merger bonuses after an undoable move warns before undo ends", () => {
|
||||
const full = preparedPosition("mergers");
|
||||
full.options = { ...full.options, twoTiles: true };
|
||||
full.seats[0]!.hand = [parseTile("12I")!, parseTile("4A")!];
|
||||
applyMove(full, { type: "place", tile: "12I" }, 0);
|
||||
const view = engine.stripSecret(full, 0);
|
||||
const merge: Move = { type: "place", tile: "4A" };
|
||||
assert.deepEqual(moveOutcome(view, merge, 0), { commits: true, endsTurn: false, endsGame: false });
|
||||
assert.equal(review(view, merge, 0, 1), "commit");
|
||||
assert.equal(review(view, merge, 0, 0), undefined, "nothing to lose without undoable moves");
|
||||
assert.equal(moveOutcome(view, merge, undefined).commits, true, "spectators never act");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,69 @@
|
|||
import type { GameState, Move, TurnRequest } from "acquire-engine";
|
||||
import { applyMove, currentSeat, draftCanContinue, type GameState, type Move, type TurnRequest } from "acquire-engine";
|
||||
|
||||
/** What sending a move would do to the acting player's private turn draft. */
|
||||
export interface MoveOutcome {
|
||||
/** Undo stops here: hidden information, another player's decision or the turn's end follows. */
|
||||
commits: boolean;
|
||||
/** The acting seat's own turn passes on (tiles are drawn) or the game ends. */
|
||||
endsTurn: boolean;
|
||||
/** Known to end the game; a dropped player's automatic turn afterwards is not foreseen. */
|
||||
endsGame: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Predicts the commit boundary of `move` with the engine's own draftCanContinue, on a throwaway
|
||||
* copy of the player's view. Everything that decides the boundary is visible to the acting
|
||||
* player (merger plans and disposer lists, their own hand and cash, waiting bank tiles, end
|
||||
* conditions); numbers derived from hidden values on the copy are discarded unseen.
|
||||
*/
|
||||
export function moveOutcome(view: GameState, move: Move, player: number | undefined): MoveOutcome {
|
||||
const seat = currentSeat(view);
|
||||
try {
|
||||
if (seat === undefined || player === undefined) {
|
||||
throw new Error("Not acting");
|
||||
}
|
||||
const copy = structuredClone(view);
|
||||
// Dropped players' automatic moves would use their hidden hands and cash; stopping before
|
||||
// them still shows the boundary, since a move by another seat always commits.
|
||||
copy.seats.forEach((other) => (other.dropped = false));
|
||||
const after = applyMove(copy, structuredClone(move), seat);
|
||||
return {
|
||||
commits: !draftCanContinue(view, after, player),
|
||||
endsTurn: seat === view.activeSeat && (after.ended || after.turn !== view.turn),
|
||||
endsGame: after.ended,
|
||||
};
|
||||
} catch {
|
||||
// Buying always ends the turn; anything else unexpected is treated as final.
|
||||
return { commits: true, endsTurn: move.type === "buy", endsGame: false };
|
||||
}
|
||||
}
|
||||
|
||||
/** Log entries of the turn in progress: everything after its "turn" heading. */
|
||||
export function currentTurnEntries(state: GameState): GameState["log"] {
|
||||
const start = state.log.map((entry) => entry.type).lastIndexOf("turn");
|
||||
return state.log.slice(start + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Which confirmation a move needs before it is sent: a turn summary when it ends the turn
|
||||
* (except a lone placement, which has its own confirmation), or a final-step warning when a
|
||||
* placement would make earlier undoable moves permanent. Merger decisions confirm in place.
|
||||
*/
|
||||
export function reviewFor(
|
||||
view: GameState,
|
||||
move: Move,
|
||||
outcome: MoveOutcome,
|
||||
undoable: number
|
||||
): "end" | "commit" | undefined {
|
||||
if (outcome.endsTurn) {
|
||||
const seat = currentSeat(view);
|
||||
const earlier = currentTurnEntries(view).some(
|
||||
(entry) => entry.type === "move" && entry.seat === seat && !entry.auto
|
||||
);
|
||||
return earlier || (move.type !== "place" && move.type !== "pass") ? "end" : undefined;
|
||||
}
|
||||
return outcome.commits && undoable > 0 && move.type === "place" ? "commit" : undefined;
|
||||
}
|
||||
|
||||
/** Only server-validated private views are cached; hidden holdings are never simulated here. */
|
||||
export class TurnDraft {
|
||||
|
|
|
|||
76
packages/viewer/src/lib/turn-summary.spec.ts
Normal file
76
packages/viewer/src/lib/turn-summary.spec.ts
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { applyMove, type Move } from "acquire-engine";
|
||||
import * as engine from "acquire-engine/wrapper";
|
||||
import { preparedPosition } from "../tutorial/lessons.ts";
|
||||
import { langFor } from "./format.ts";
|
||||
import { holdingsAfter, moveEffect, turnSummary } from "./turn-summary.ts";
|
||||
|
||||
const lang = langFor("en");
|
||||
const text = (lines: ReturnType<typeof turnSummary>) =>
|
||||
lines.map((line) => line.parts.map((part) => part.text).join(""));
|
||||
|
||||
test("the turn summary lists this turn's moves, then the pending move and the cash it leaves", () => {
|
||||
const full = preparedPosition("founding");
|
||||
const start = full.log.length;
|
||||
applyMove(full, { type: "place", tile: "2A" }, 0);
|
||||
const afterPlace = full.log.length;
|
||||
applyMove(full, { type: "found", chain: "tower" }, 0);
|
||||
const view = engine.stripSecret(full, 0);
|
||||
const buy: Move = { type: "buy", shares: { tower: 2 } };
|
||||
|
||||
const lines = turnSummary(view, buy, lang, afterPlace);
|
||||
assert.deepEqual(text(lines), [
|
||||
"Alex placed 2A",
|
||||
"Alex founded Tower (2 tiles) and received a free share",
|
||||
"Alex bought 2 Tower for $400",
|
||||
]);
|
||||
assert.deepEqual(
|
||||
lines.map((line) => [line.final, line.pending]),
|
||||
[
|
||||
[true, false],
|
||||
[false, false],
|
||||
[false, true],
|
||||
]
|
||||
);
|
||||
assert.ok(turnSummary(view, buy, lang, start).every((line) => !line.final));
|
||||
|
||||
const effect = moveEffect(view, buy)!;
|
||||
assert.deepEqual(effect, { cash: -400, shares: { tower: 2 } });
|
||||
assert.deepEqual(holdingsAfter(view, effect), {
|
||||
cash: { before: 6000, after: 5600 },
|
||||
shares: [{ chain: "tower", before: 1, after: 3 }],
|
||||
});
|
||||
});
|
||||
|
||||
test("disposal and swap effects use the defunct sale price, the 2:1 trade and current prices", () => {
|
||||
const full = preparedPosition("mergers");
|
||||
applyMove(full, { type: "place", tile: "4A" }, 0);
|
||||
const view = engine.stripSecret(full, 0);
|
||||
assert.equal(view.phase, "dispose");
|
||||
const dispose: Move = { type: "dispose", sell: 1, trade: 2 };
|
||||
assert.deepEqual(moveEffect(view, dispose), { cash: 200, shares: { luxor: -3, tower: 1 } });
|
||||
const after = holdingsAfter(view, moveEffect(view, dispose)!);
|
||||
assert.equal(after.cash.after - after.cash.before, 200);
|
||||
assert.deepEqual(
|
||||
after.shares.map(({ chain, before, after }) => [chain, before, after]),
|
||||
[
|
||||
["tower", 0, 1],
|
||||
["luxor", 3, 0],
|
||||
["festival", 1, 1],
|
||||
]
|
||||
);
|
||||
assert.equal(
|
||||
text(turnSummary(view, dispose, lang, 0)).at(-1),
|
||||
"Alex sold 1 Luxor share for $200 and traded 2 Luxor shares for 1 of the survivor"
|
||||
);
|
||||
|
||||
// Merger moves pay bonuses that may depend on hidden holdings: no forecast.
|
||||
const before = preparedPosition("mergers");
|
||||
assert.equal(moveEffect(engine.stripSecret(before, 0), { type: "place", tile: "4A" }), undefined);
|
||||
assert.deepEqual(moveEffect(engine.stripSecret(before, 0), { type: "place", tile: "12I" }), { cash: 0, shares: {} });
|
||||
assert.deepEqual(moveEffect(view, { type: "swap", from: "tower", to: "luxor", count: 1 })?.shares, {
|
||||
tower: -1,
|
||||
luxor: 1,
|
||||
});
|
||||
});
|
||||
169
packages/viewer/src/lib/turn-summary.ts
Normal file
169
packages/viewer/src/lib/turn-summary.ts
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
// The turn summary shown before a move that ends the turn: this turn's log lines, the move
|
||||
// about to be sent, and the acting seat's cash and shares afterwards. Only the acting seat's own
|
||||
// numbers are used; nothing is inferred about hidden holdings.
|
||||
import {
|
||||
CHAIN_IDS,
|
||||
chainSize,
|
||||
connectedLoose,
|
||||
currentSeat,
|
||||
placementEffect,
|
||||
sharePrice,
|
||||
stockSwapCost,
|
||||
parseTile,
|
||||
type ChainId,
|
||||
type GameState,
|
||||
type LogEntry,
|
||||
type Move,
|
||||
type Shares,
|
||||
} from "acquire-engine";
|
||||
import { describePlacement } from "./decisions.ts";
|
||||
import { describeEntryParts, type Lang, type LogPart } from "./format.ts";
|
||||
import { currentTurnEntries } from "./turn-draft.ts";
|
||||
|
||||
export interface Effect {
|
||||
cash: number;
|
||||
shares: Partial<Shares>;
|
||||
}
|
||||
|
||||
/** The change `move` makes to the acting seat's cash and shares, or undefined when it pays bonuses. */
|
||||
export function moveEffect(state: GameState, move: Move): Effect | undefined {
|
||||
const seat = currentSeat(state);
|
||||
if (seat === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const price = (chain: ChainId) => sharePrice(chain, chainSize(state.board, chain));
|
||||
switch (move.type) {
|
||||
case "buy": {
|
||||
const shares = Object.entries(move.shares) as [ChainId, number][];
|
||||
return {
|
||||
cash: -shares.reduce((sum, [chain, count]) => sum + count * price(chain), 0),
|
||||
shares: move.shares,
|
||||
};
|
||||
}
|
||||
case "swap":
|
||||
return {
|
||||
cash: -stockSwapCost(state, move.from, move.to, move.count),
|
||||
shares: { [move.from]: -move.count, [move.to]: move.count },
|
||||
};
|
||||
case "dispose": {
|
||||
const merger = state.merger!;
|
||||
const defunct = merger.current!;
|
||||
return {
|
||||
cash: move.sell * sharePrice(defunct, merger.sizes[defunct]!),
|
||||
shares: { [defunct]: -(move.sell + move.trade), [merger.survivor!]: move.trade / 2 },
|
||||
};
|
||||
}
|
||||
case "found":
|
||||
return { cash: 0, shares: state.bank[move.chain] > 0 ? { [move.chain]: 1 } : {} };
|
||||
case "place":
|
||||
return placementEffect(state.board, parseTile(move.tile)!).kind === "merge" ? undefined : { cash: 0, shares: {} };
|
||||
case "pass":
|
||||
case "announce":
|
||||
return { cash: 0, shares: {} };
|
||||
case "survivor":
|
||||
case "defunctOrder":
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export interface HoldingChange {
|
||||
chain: ChainId;
|
||||
before: number;
|
||||
after: number;
|
||||
}
|
||||
|
||||
/** The acting seat's cash and every holding it has or gains, before and after `effect`. */
|
||||
export function holdingsAfter(state: GameState, effect: Effect) {
|
||||
const seat = state.seats[currentSeat(state)!]!;
|
||||
const shares: HoldingChange[] = CHAIN_IDS.flatMap((chain) => {
|
||||
const before = seat.shares[chain];
|
||||
const after = before + (effect.shares[chain] ?? 0);
|
||||
return before > 0 || after > 0 ? [{ chain, before, after }] : [];
|
||||
});
|
||||
return { cash: { before: seat.cash, after: seat.cash + effect.cash }, shares };
|
||||
}
|
||||
|
||||
export interface SummaryLine {
|
||||
key: string;
|
||||
parts: LogPart[];
|
||||
/** Already saved: Undo cannot take it back. */
|
||||
final: boolean;
|
||||
/** The move that confirming will send. */
|
||||
pending: boolean;
|
||||
}
|
||||
|
||||
/** How the pending move will be logged, built from the same log entries and translations. */
|
||||
function pendingEntry(state: GameState, move: Move, seat: number): LogEntry | undefined {
|
||||
switch (move.type) {
|
||||
case "buy": {
|
||||
const cost = -(moveEffect(state, move)?.cash ?? 0);
|
||||
return { type: "bought", seat, shares: move.shares, cost };
|
||||
}
|
||||
case "swap":
|
||||
return {
|
||||
type: "swapped",
|
||||
seat,
|
||||
from: move.from,
|
||||
to: move.to,
|
||||
count: move.count,
|
||||
cost: stockSwapCost(state, move.from, move.to, move.count),
|
||||
};
|
||||
case "dispose": {
|
||||
const merger = state.merger!;
|
||||
const chain = merger.current!;
|
||||
return {
|
||||
type: "disposed",
|
||||
seat,
|
||||
chain,
|
||||
sold: move.sell,
|
||||
traded: move.trade,
|
||||
held: state.seats[seat]!.shares[chain] - move.sell - move.trade,
|
||||
proceeds: move.sell * sharePrice(chain, merger.sizes[chain]!),
|
||||
};
|
||||
}
|
||||
case "pass":
|
||||
return { type: "skipPlace", seat };
|
||||
case "announce":
|
||||
return { type: "announced", seat };
|
||||
case "found":
|
||||
return {
|
||||
type: "founded",
|
||||
seat,
|
||||
chain: move.chain,
|
||||
size: connectedLoose(state.board, state.pendingTile!).length,
|
||||
bonus: state.bank[move.chain] > 0,
|
||||
};
|
||||
default:
|
||||
return { type: "move", seat, move };
|
||||
}
|
||||
}
|
||||
|
||||
/** This turn's lines, oldest first, ending with the move about to be sent. */
|
||||
export function turnSummary(state: GameState, move: Move, lang: Lang, undoFrom: number): SummaryLine[] {
|
||||
const seat = currentSeat(state)!;
|
||||
const start = state.log.length - currentTurnEntries(state).length;
|
||||
const lines: SummaryLine[] = [];
|
||||
state.log.slice(start).forEach((entry, offset) => {
|
||||
const index = start + offset;
|
||||
const parts = describeEntryParts(state, entry, lang);
|
||||
if (parts) {
|
||||
lines.push({ key: String(index), parts, final: index < undoFrom, pending: false });
|
||||
}
|
||||
});
|
||||
const parts =
|
||||
move.type === "place"
|
||||
? [
|
||||
{
|
||||
kind: "text" as const,
|
||||
text: lang.t("place.effect", {
|
||||
tile: move.tile,
|
||||
effect: describePlacement(state, parseTile(move.tile)!, lang),
|
||||
}),
|
||||
},
|
||||
]
|
||||
: describeEntryParts(state, pendingEntry(state, move, seat)!, lang);
|
||||
if (parts) {
|
||||
lines.push({ key: "pending", parts, final: false, pending: true });
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
|
@ -16,7 +16,11 @@ export const viewer = registerViewer<GameState, Move | TurnRequest>(
|
|||
style.textContent = themeCss();
|
||||
document.head.append(style);
|
||||
const sounds = createActionSounds(target);
|
||||
const store = new ViewerStore(move, { turnDrafts: true, onState: (state) => sounds.onState(state) });
|
||||
const store = new ViewerStore(move, {
|
||||
turnDrafts: true,
|
||||
reviewTurns: true,
|
||||
onState: (state) => sounds.onState(state),
|
||||
});
|
||||
store.theme = initialTheme();
|
||||
const app = mount(App, { target, props: { store }, context: new Map([[STORE, store]]) });
|
||||
return {
|
||||
|
|
|
|||
91
rules.md
91
rules.md
|
|
@ -41,7 +41,8 @@ original 1976 rules were silent or ambiguous, the choice made here is marked
|
|||
3. The player who placed the **lowest** tile goes first. Compare by number first, then
|
||||
letter: `2B` beats `2E` and `3A`. Play then proceeds clockwise (in seat order) from
|
||||
that player. **[DECISION]** "Clockwise" means ascending seat order, wrapping around.
|
||||
4. Each player then draws **6** tiles into their private hand.
|
||||
4. Each player then draws **6** tiles into their private hand (the `handSize` option, §15,
|
||||
may set 8, 10 or 12).
|
||||
5. **[DECISION]** Options are never rejected at setup. An option that does not apply to
|
||||
the player count (see §15) is ignored, and the game log records that it was ignored.
|
||||
|
||||
|
|
@ -53,11 +54,12 @@ 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).
|
||||
5. **Draw** one tile to bring the hand back to 6, if the pool is not empty.
|
||||
5. **Draw** one tile to bring the hand back to 6 (or the `handSize`, §15), if the pool is
|
||||
not empty.
|
||||
|
||||
If the game was announced as over during this turn, run final scoring (§11.2) after
|
||||
the turn completes instead of passing to the next player.
|
||||
|
|
@ -70,8 +72,7 @@ they cannot buy anything.
|
|||
|
||||
### 4.1 Two tiles per turn (house rule)
|
||||
|
||||
With `twoTiles` enabled (§15), hands hold **8** tiles instead of 6 (at setup and when
|
||||
drawing), and each turn places two tiles:
|
||||
With `twoTiles` enabled (§15), each turn places two tiles:
|
||||
|
||||
1. At the start of the turn, the active seat discards its permanently unplayable tiles
|
||||
(§5.2) and draws replacements. They are not replaced at the end of the turn.
|
||||
|
|
@ -81,13 +82,19 @@ drawing), and each turn places two tiles:
|
|||
3. Place the second tile if any tile in hand is playable now; otherwise go straight to
|
||||
buying. A tile that became permanently unplayable during this turn cannot be placed and
|
||||
is replaced at the start of the seat's next turn.
|
||||
4. A turn founds at most one chain, and never both founds a chain and causes a merger, in
|
||||
either order. It may cause two mergers, one per tile. Mergers caused by bank tiles do
|
||||
not count towards these limits.
|
||||
5. Buy (§9, including §9.1 swaps) once, after both tiles, then draw back up to 8.
|
||||
4. A turn founds at most one chain, and the second tile cannot cause a merger involving the
|
||||
chain the first tile founded (as survivor or defunct). Otherwise each tile follows the
|
||||
usual rules: a merger may be followed by a founding or another merger, and a founding by
|
||||
a merger of other chains. **[DECISION]** Games created before this revision (init
|
||||
options without `twoTilesRelaxed`) keep the earlier limit, also when replayed: a turn
|
||||
never both founds a chain and causes a merger, in either order, and mergers caused by
|
||||
bank tiles do not count towards it.
|
||||
5. Buy (§9, including §9.1 swaps) once, after both tiles, then draw back up to the hand size.
|
||||
|
||||
The end may also be announced between the two tiles, if an end condition holds at that
|
||||
moment. Dropped seats place their first two playable tiles by the §16 default.
|
||||
moment. Dropped seats place their first two playable tiles by the §16 default. The hand
|
||||
size is the separate `handSize` option (§15); games created before it hold **8** tiles with
|
||||
`twoTiles`.
|
||||
|
||||
## 5. Placing a Tile
|
||||
|
||||
|
|
@ -208,7 +215,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
|
||||
|
|
@ -217,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
|
||||
(§11.2). There is no trading between players.
|
||||
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
|
||||
`publicHoldings` is off (§13), it is never skipped because the player cannot afford a
|
||||
share, since that would reveal their cash; they get the step and may buy nothing. When
|
||||
`publicHoldings` is on, it is also skipped when the player cannot afford any share.
|
||||
is on the board, or the bank has no shares left in any active chain. While cash is
|
||||
private (`holdingsVisibility` `private`, §13), it is never skipped because the player
|
||||
cannot afford a share, since that would reveal their cash; they get the step and may buy
|
||||
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)
|
||||
|
||||
|
|
@ -233,7 +244,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,
|
||||
|
|
@ -328,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 public:** the board, chain names and sizes, current prices, and the number of
|
||||
shares left in the bank for each chain.
|
||||
- **[DECISION] Game option `publicHoldings` (default: `false`):** When off, each player's
|
||||
current share holdings and cash are visible only to that player. When on, they are
|
||||
public.
|
||||
- **[DECISION] Game option `holdingsVisibility` (default: `private`):** what everyone sees
|
||||
of other players' current cash and share holdings during play.
|
||||
- `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
|
||||
every action: tile placements, stock purchases, bonuses paid, and each player's disposal
|
||||
choices. Only the *current* holdings and cash are hidden, even though they can be
|
||||
reconstructed from the log.
|
||||
- **Game option `limitedLog` (default: `false`):** each player sees only the log from the
|
||||
start of their own last turn before the current one, so the current turn, including a
|
||||
merger in progress, is always shown. Spectators see as much as the active player.
|
||||
Setup entries (options, turn order) stay visible. Earlier entries are replaced by
|
||||
placeholders, keeping the log's length. The whole log is revealed when the game ends,
|
||||
and replay is only available after that.
|
||||
- **[DECISION] Scores during play:** When `publicHoldings` is off, every player's score
|
||||
is 0 until the game ends. When it is on, the score is projected net worth: cash,
|
||||
- **Game option `limitedLog` (default: `false`):** everyone sees the same part of the log:
|
||||
the current turn, including a merger in progress, and the full round of turns before it
|
||||
(one turn per seat, so four turns in four-hands games). **[DECISION]** Every player and
|
||||
spectator gets this same window, wherever they sit, and it always reaches back at least to
|
||||
the start of their own previous turn. Setup entries (options, turn order) stay visible.
|
||||
Earlier entries are replaced by placeholders, keeping the log's length. The whole log is
|
||||
revealed when the game ends, and replay is only available after that.
|
||||
- **[DECISION] Scores during play:** 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
|
||||
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
|
||||
|
|
@ -376,13 +402,16 @@ switches on one engine, not as separate code paths. Defaults reproduce the stand
|
|||
|
||||
| Option | Values | Default | Effect |
|
||||
|---|---|---|---|
|
||||
| `publicHoldings` | true / false | false | See §13. When false, share holdings and cash are private. |
|
||||
| `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. |
|
||||
| `holdingsVisibility` | `private` / `cash` / `cashAndShareCount` / `public` | `private` | See §13. What everyone sees of other players' cash and holdings during play. |
|
||||
| `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. |
|
||||
| `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. |
|
||||
| `twoTiles` | true / false | false | Two placements per turn (house rule). See §4.1. |
|
||||
| `handSize` | 6 / 8 / 10 / 12 | 6 | Tiles each seat draws at setup and refills to (house rule), with or without `twoTiles`. **[DECISION]** Without `handSize` in the init options (games created before it), hands hold 6, or 8 with `twoTiles`; normalized options omit `handSize` at that legacy size so those games replay identically. Twelve tiles for each of 6 players use 78 of the 108 tiles at setup, counting turn-order tiles. |
|
||||
| `limitedLog` | true / false | false | The log shows only 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. |
|
||||
|
||||
**[DECISION]** Invalid combinations are never rejected. An option that does not apply to
|
||||
|
|
|
|||
|
|
@ -104,6 +104,195 @@ 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();
|
||||
// The final step waits for the turn summary.
|
||||
assert.match(await page.locator(".turn-summary").innerText(), /bought/);
|
||||
assert.equal(await page.evaluate(() => window.acquireDev.state.turn), 1);
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).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 });
|
||||
await open("players=3&hotseat=0&view=0&twoTiles=1&limitedLog=1");
|
||||
await page.evaluate((state) => {
|
||||
const { parseTile, allTiles } = window.acquireDev.rules;
|
||||
state.options.twoTiles = true;
|
||||
state.options.twoTilesRelaxed = true;
|
||||
state.options.limitedLog = true;
|
||||
state.board[parseTile("1C")] = "loose";
|
||||
state.seats[0].hand = ["2A", "3A", "2C", "5E", "7E", "9E", "7G", "9G"].map(parseTile);
|
||||
const held = new Set(state.seats.flatMap((seat) => seat.hand));
|
||||
state.pool = allTiles().filter((tile) => state.board[tile] === null && !held.has(tile));
|
||||
window.acquireDev.load(state);
|
||||
}, preparedPosition("founding"));
|
||||
await settle();
|
||||
assert.equal(await page.locator("section.hand .tile").count(), 8);
|
||||
const original = await page.evaluate(() => JSON.stringify(window.acquireDev.state));
|
||||
await page.locator(".board").getByRole("button", { name: "Place 2A", exact: true }).click();
|
||||
await page.locator(".choices button").filter({ hasText: "Tower" }).click();
|
||||
await settle();
|
||||
assert.match(await page.locator(".status").innerText(), /second tile/);
|
||||
assert.equal(await page.locator("table.buy").count(), 0);
|
||||
assert.equal(await page.locator("section.hand .tile.paused").count(), 1);
|
||||
assert.equal(await page.locator(".board").getByRole("button", { name: "Place 2C", exact: true }).count(), 0);
|
||||
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("section.hand .tile-notes").innerText()).length > 5);
|
||||
}
|
||||
await preferences({ locale: "en" });
|
||||
await page.screenshot({ path: fileURLToPath(new URL(`two-tiles-${theme}-${width}.png`, output)) });
|
||||
}
|
||||
for (let revision = 0; revision < 3; revision++) {
|
||||
await page.locator(".board").getByRole("button", { name: "Place 3A", exact: true }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
assert.equal(await page.evaluate(() => JSON.stringify(window.acquireDev.state)), original);
|
||||
await page.getByRole("button", { name: "Undo", exact: true }).click();
|
||||
await settle();
|
||||
assert.match(await page.locator(".status").innerText(), /second tile/);
|
||||
}
|
||||
await page.locator(".board").getByRole("button", { name: "Place 3A", exact: true }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
await page.locator(".panel .primary").click();
|
||||
assert.match(await page.locator(".turn-summary").innerText(), /placed 2A[\s\S]*placed 3A/);
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
assert.deepEqual(
|
||||
await page.evaluate(() => ({
|
||||
moves: window.acquireDev.state.log.filter((entry) => entry.type === "move").length,
|
||||
increments: window.acquireDev.engine.timeIncrements(window.acquireDev.state),
|
||||
hand: window.acquireDev.state.seats[0].hand.length,
|
||||
})),
|
||||
{ moves: 4, increments: [1, 0, 0], hand: 8 }
|
||||
);
|
||||
}
|
||||
report.scenarios.push(
|
||||
"two-tile placement limits, 17 locales/both themes/phone layouts, repeated undo and one turn increment"
|
||||
);
|
||||
|
||||
// Limited logs never enter replay during play, including before the first hidden entry.
|
||||
for (const mode of ["players=4", "players=2&twoPlayerMode=fourHands"]) {
|
||||
await open(`${mode}&twoTiles=1&limitedLog=1&hotseat=0&view=0`);
|
||||
for (const later of [false, true]) {
|
||||
if (later) {
|
||||
await page.evaluate(() => {
|
||||
const { rules, state, load } = window.acquireDev;
|
||||
for (let i = 0; state.turn < 15 && i < 300; i++) {
|
||||
const moves = rules.legalMoves(state).filter((move) => move.type !== "announce");
|
||||
rules.applyMove(state, moves[i % moves.length], rules.currentSeat(state));
|
||||
}
|
||||
load(state);
|
||||
});
|
||||
}
|
||||
const count = mode.startsWith("players=4") ? 4 : 2;
|
||||
for (let viewer = 0; viewer <= count; viewer++) {
|
||||
await page.evaluate(
|
||||
(player) => {
|
||||
const { engine, emitter, state } = window.acquireDev;
|
||||
const index = player ?? undefined;
|
||||
emitter.emit("player", { index });
|
||||
emitter.emit("state", engine.stripSecret(state, index));
|
||||
},
|
||||
viewer === count ? null : viewer
|
||||
);
|
||||
await settle();
|
||||
const board = await page.locator(".board").first().innerText();
|
||||
const hands = await page.locator("section.hand").count();
|
||||
await page.evaluate(() => {
|
||||
const { emitter } = window.acquireDev;
|
||||
emitter.emit("replay:start");
|
||||
emitter.emit("replay:to", 0);
|
||||
});
|
||||
await settle();
|
||||
assert.equal(await page.locator(".board").first().innerText(), board);
|
||||
assert.equal(await page.locator("section.hand").count(), hands);
|
||||
await page.evaluate(() => window.acquireDev.emitter.emit("replay:end"));
|
||||
}
|
||||
}
|
||||
await page.evaluate(() => {
|
||||
const { rules, state, load } = window.acquireDev;
|
||||
for (let i = 0; !state.ended && i < 2000; i++) {
|
||||
const moves = rules.legalMoves(state);
|
||||
rules.applyMove(
|
||||
state,
|
||||
moves.find((move) => move.type === "announce") ?? moves[i % moves.length],
|
||||
rules.currentSeat(state)
|
||||
);
|
||||
}
|
||||
load(state);
|
||||
});
|
||||
await settle();
|
||||
assert.equal(await page.evaluate(() => window.acquireDev.state.ended), true);
|
||||
assert.equal(await page.locator(".log li.hidden").count(), 0);
|
||||
const endedBoard = await page.locator(".board").first().innerText();
|
||||
await page.evaluate(() => {
|
||||
window.acquireDev.emitter.emit("replay:start");
|
||||
window.acquireDev.emitter.emit("replay:to", 0);
|
||||
});
|
||||
await settle();
|
||||
assert.notEqual(await page.locator(".board").first().innerText(), endedBoard);
|
||||
}
|
||||
report.scenarios.push("limited log: players/four hands/spectators, live replay lock and full replay after game end");
|
||||
|
||||
// Optional swaps are private drafts, with one shared allowance and separate purchases.
|
||||
for (const width of [1280, 390, 320]) {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
|
|
@ -136,8 +325,9 @@ try {
|
|||
window.acquireDev.load(state);
|
||||
}, preparedPosition("founding"));
|
||||
await page.locator(".stock-swap summary").click();
|
||||
await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2");
|
||||
await page.getByRole("button", { name: "Swap one more", exact: true }).click();
|
||||
assert.match(await page.locator(".exchange").innerText(), /Pay \$800/);
|
||||
assert.match(await page.locator(".stock-swap .holding-change").innerText(), /\$6,000\s*→\s*\$5,200/);
|
||||
for (const theme of ["dark", "light"]) {
|
||||
await page.evaluate((theme) => window.acquireDev.emitter.emit("theme", { dark: theme === "dark" }), theme);
|
||||
for (const locale of locales) {
|
||||
|
|
@ -146,17 +336,18 @@ try {
|
|||
await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1),
|
||||
`stock swap ${locale} ${theme} ${width}px`
|
||||
);
|
||||
assert.equal(await page.locator(".stock-swap button").isEnabled(), true);
|
||||
assert.equal(await page.locator(".stock-swap button.confirm").isEnabled(), true);
|
||||
}
|
||||
await preferences({ locale: "en" });
|
||||
await page
|
||||
.locator(".panel")
|
||||
.screenshot({ path: fileURLToPath(new URL(`stock-swap-${theme}-${width}.png`, output)) });
|
||||
}
|
||||
await page.getByRole("button", { name: "Swap one fewer", exact: true }).click();
|
||||
const original = await page.evaluate(() => JSON.stringify(window.acquireDev.state));
|
||||
for (let revision = 0; revision < 3; revision++) {
|
||||
await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2");
|
||||
await page.getByRole("button", { name: "Swap shares", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Swap one more", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Swap 2 Tower for 2 Continental · Pay $800", exact: true }).click();
|
||||
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("1 left"));
|
||||
assert.equal(
|
||||
await page.evaluate(() => JSON.stringify(window.acquireDev.state)),
|
||||
|
|
@ -166,18 +357,23 @@ try {
|
|||
await page.getByRole("button", { name: "Undo", exact: true }).click();
|
||||
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("3 left"));
|
||||
}
|
||||
await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2");
|
||||
await page.getByRole("button", { name: "Swap shares", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Swap one more", exact: true }).click();
|
||||
await page.locator(".stock-swap button.confirm").click();
|
||||
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("1 left"));
|
||||
await page.getByLabel("Give (your stock)", { exact: true }).selectOption("continental");
|
||||
await settle();
|
||||
assert.match(await page.locator(".exchange").innerText(), /Receive \$400/);
|
||||
await page.getByRole("button", { name: "Swap shares", exact: true }).click();
|
||||
await page.locator(".stock-swap button.confirm").click();
|
||||
await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("0 left"));
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await page.getByRole("button", { name: "Buy one more Tower", exact: true }).click();
|
||||
}
|
||||
await page.getByRole("button", { name: "Buy for $900 and end turn", exact: true }).click();
|
||||
assert.match(
|
||||
await page.locator(".turn-summary").innerText(),
|
||||
/swapped[\s\S]*swapped[\s\S]*bought 3 Tower for \$900/
|
||||
);
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
assert.deepEqual(
|
||||
await page.evaluate(() => ({
|
||||
|
|
@ -194,6 +390,10 @@ try {
|
|||
window.acquireDev.load(state);
|
||||
}, preparedPosition("scoring"));
|
||||
assert.equal(await page.locator(".stock-swap").count(), 0, "off never adds UI to existing games");
|
||||
// A random buy step where the panel's default chains (Tower, Continental) are not both on the
|
||||
// board: the swap panel must not price a chain off the board.
|
||||
await open("players=4&moves=16&stockSwap=3");
|
||||
assert.equal(await page.locator(".stock-swap").count(), 1, "swaps render when a default chain is off the board");
|
||||
report.scenarios.push(
|
||||
"stock swaps in 17 languages and both themes at 1280/390/320px, pay/receive previews, shared allowance, undo without saved history and a separate three-share purchase"
|
||||
);
|
||||
|
|
@ -295,6 +495,9 @@ try {
|
|||
beforePreset,
|
||||
"presets wait for Confirm"
|
||||
);
|
||||
assert.equal(await page.locator(".panel button.primary").innerText(), "Trade 6 for 3 Imperial and keep 1 Festival");
|
||||
await page.locator(".keep-all").click();
|
||||
assert.equal(await page.locator(".panel button.primary").innerText(), "Keep all 7 Festival");
|
||||
for (const locale of locales) {
|
||||
await preferences({ locale });
|
||||
assert.ok(
|
||||
|
|
@ -379,6 +582,7 @@ try {
|
|||
await page.waitForSelector("table.buy");
|
||||
// Disposal remains an undoable private draft until this player finishes buying.
|
||||
await page.getByRole("button", { name: "Buy nothing and end turn", exact: true }).click();
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
const result = await page.evaluate(() => window.acquireDev.state.seats[0]);
|
||||
assert.equal(result.shares.tower, expectedTrade / 2);
|
||||
|
|
@ -486,7 +690,7 @@ try {
|
|||
await open(`players=4&moves=95&publicHoldings=1&theme=${theme}`);
|
||||
const geometry = await page.evaluate(() => {
|
||||
const main = document.querySelector("main");
|
||||
const column = document.querySelector(".layout > .board");
|
||||
const column = document.querySelector(".board-column > .board");
|
||||
const frame = column.querySelector(".frame");
|
||||
return {
|
||||
margin: getComputedStyle(document.body).margin,
|
||||
|
|
@ -827,6 +1031,16 @@ try {
|
|||
await page.waitForSelector("table.buy");
|
||||
await page.screenshot({ path: fileURLToPath(new URL(`undo-${width}.png`, output)), fullPage: true });
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "Back", exact: true }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.screenshot({ path: fileURLToPath(new URL(`turn-summary-${width}.png`, output)), fullPage: true });
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "Undo", exact: true }).click();
|
||||
await page.waitForSelector(".choices");
|
||||
await page.locator(".choices button").filter({ hasText: "Luxor" }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
await settle();
|
||||
assert.equal(await undo.count(), 0, "no undo after drawing and handing over");
|
||||
|
|
@ -846,17 +1060,28 @@ try {
|
|||
"desktop/phone undo, repeated private revisions, refresh, no undo network calls, one saved turn and one clock increment"
|
||||
);
|
||||
|
||||
// The desktop used to stack every supporting panel in one tall sidebar. Check the rendered
|
||||
// arrangement and height, not only horizontal overflow, before creating gallery images.
|
||||
// The desktop used to stack every supporting panel in one tall sidebar, and later left empty
|
||||
// areas beside the board. Each column now stacks its own panels; check the rendered arrangement.
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await open("players=4&moves=95&publicHoldings=1");
|
||||
const board = await page.locator(".layout > .board").boundingBox();
|
||||
const panels = await Promise.all(
|
||||
[".players", ".history", ".conversation"].map((selector) => page.locator(`.layout > ${selector}`).boundingBox())
|
||||
);
|
||||
for (const panel of panels) {
|
||||
assert.ok(panel.y >= board.y + board.height, "supporting panels sit below the board");
|
||||
assert.ok(Math.abs(panel.y - panels[0].y) < 1, "supporting panels share a desktop row");
|
||||
const box = (selector) => page.locator(`.layout ${selector}`).boundingBox();
|
||||
const columns = [
|
||||
[".board-column > .board", ".board-column > .players"],
|
||||
[".turn-column > .controls", ".turn-column > .hand", ".turn-column > .market"],
|
||||
[".talk-column > .history", ".talk-column > .conversation"],
|
||||
];
|
||||
let previousColumn;
|
||||
for (const column of columns) {
|
||||
const boxes = await Promise.all(column.map(box));
|
||||
for (const [index, panel] of boxes.entries()) {
|
||||
assert.ok(Math.abs(panel.x - boxes[0].x) < 1, `${column[index]} stays in its column`);
|
||||
if (index > 0) {
|
||||
const gap = panel.y - (boxes[index - 1].y + boxes[index - 1].height);
|
||||
assert.ok(gap >= 0 && gap < 40, `${column[index]} follows the panel above it without an empty area`);
|
||||
}
|
||||
}
|
||||
assert.ok(!previousColumn || boxes[0].x > previousColumn.x + previousColumn.width, "desktop columns side by side");
|
||||
previousColumn = boxes[0];
|
||||
}
|
||||
assert.ok((await page.locator("main").boundingBox()).height <= 900, "desktop game fits within 900px");
|
||||
assert.equal(await page.locator(".log li").count(), 8);
|
||||
|
|
@ -864,7 +1089,7 @@ try {
|
|||
assert.ok((await page.locator(".log li").count()) > 100, "full history remains available");
|
||||
await page.locator(".history button").click();
|
||||
assert.equal(await page.locator(".log li").count(), 8);
|
||||
report.scenarios.push("balanced desktop panels, compact recent history and expandable full log");
|
||||
report.scenarios.push("independent desktop columns, compact recent history and expandable full log");
|
||||
|
||||
for (const [name, params, width, height] of [
|
||||
["overview", "players=4&moves=95&publicHoldings=1", 1280, 900],
|
||||
|
|
@ -875,7 +1100,7 @@ try {
|
|||
for (const theme of ["light", "dark"]) {
|
||||
await open(`${params}&theme=${theme}`);
|
||||
const main = await page.locator("main").boundingBox();
|
||||
const hand = await page.locator(".layout > .hand").boundingBox();
|
||||
const hand = await page.locator(".turn-column > .hand").boundingBox();
|
||||
// Desktop shows the whole compact layout. On phones frame the complete decision, board
|
||||
// and hand, without appending a long column of tables, chat and history to the image.
|
||||
const captureHeight = Math.ceil(width < 700 ? hand.y + hand.height + 12 : main.height);
|
||||
|
|
@ -950,11 +1175,15 @@ try {
|
|||
await page.getByRole("button", { name: "Buy one more Tower", exact: true }).click();
|
||||
} else {
|
||||
await page.locator(".choices button").filter({ hasText: "Festival" }).click();
|
||||
await page.locator("main .panel button.primary").click();
|
||||
await page.getByRole("alert").waitFor();
|
||||
await page.locator(".choices button").filter({ hasText: "Worldwide" }).click();
|
||||
await page.locator("main .panel button.primary").click();
|
||||
await page.waitForSelector('.acquire-tutorial[data-step="5"]');
|
||||
assert.match(await page.locator(".guide").innerText(), /\$4,500/);
|
||||
// Default 0/0 keeps the Festival share after both bonuses are paid.
|
||||
// Keeping the Festival share is an explicit choice; Confirm waits for it.
|
||||
assert.equal(await page.locator("main .panel button.primary").isDisabled(), true);
|
||||
await page.locator(".keep-all").click();
|
||||
await page.locator("main .panel button.primary").click();
|
||||
await page.waitForSelector('.acquire-tutorial[data-step="6"]');
|
||||
}
|
||||
|
|
@ -1066,6 +1295,7 @@ try {
|
|||
);
|
||||
if (chapter === "mergers") {
|
||||
await page.locator(".choices button").filter({ hasText: "Worldwide" }).click();
|
||||
await page.locator("main .panel .primary").click();
|
||||
await page.waitForSelector('.acquire-tutorial[data-step="5"]');
|
||||
}
|
||||
assert.ok(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue