Release analysis money editing: engine 2.0.31 and viewer 2.3.30

This commit is contained in:
coyotte508 2026-11-13 12:53:02 +00:00
commit abe1c841bd
37 changed files with 1312 additions and 59 deletions

View file

@ -5,12 +5,19 @@ The host-facing `dist/wrapper.js` export `createAnalysisScenario(data, { player,
Do not point AI callers at the wrapper's interactive export.
For hidden-money sources (`options.showMoney !== true`), interactive creation
initializes **every** seat to $999, including the requester. These are finite,
hypothetical balances: ordinary costs, affordability checks and income apply.
`analysisMoney: 'hypothetical'` identifies this state to secret stripping and the
viewer. Re-sampling an existing marked branch preserves its evolved balances;
creating a fresh branch from a live source starts a new $999 scenario. Public-money
sources retain their public balances.
preserves the authenticated requester's own known balance and initializes opponents
to $999. The host supplies the source-game seat as `player`; spectators receive
$999 for every seat. An already redacted own balance also falls back to $999.
These are finite sandbox balances: ordinary costs, affordability checks and income apply.
`analysisMoney: 'hypothetical'` identifies the sandbox to secret stripping and the
viewer. `analysisKnownMoney` identifies seats initialized from known cash, which
show the normal Money label even as play proceeds. Changing such a balance with
the editor removes that known-cash label; the manually assumed amount is hypothetical.
Re-sampling an existing marked branch preserves its balances. Old analyses that
already replaced the creator's money with $999 cannot recover it; create a fresh
analysis from the live source instead. Public-money sources retain all public balances.
Sharing an analysis also shares the creator's retained balance. This policy does
not change the host's initial displayed seat or manual control of all seats.
Interactive creation does not reconstruct cash from history. It discards private
powering revision snapshots, all source sealed bids (including the requester's),
@ -23,6 +30,27 @@ premoves or affordability/preference auto-passes. Mandatory resolution, market
updates, income and phase transitions remain in effect. No bot/drop status may
choose moves for a seat. Existing one-turn buffer boundaries remain enforced.
## Editing sandbox money
In an editable analysis, select an active seat and use a player's money editor to
set any seat's balance to an integer from $0 to $9,999. Finish or undo tentative
moves first. A balance cannot be reduced below an outstanding auction bid.
Read-only views, live games and ended analyses do not allow edits.
The viewer sends a standalone `SetAnalysisMoney` command with
`data: { player: targetSeat, money: amount }` to `analysisMove`. The server-selected
acting seat remains separate from the target seat. Ordinary live move handlers
reject this command, even inside a buffered turn. Edits are cloned, committed
immediately and saved as analysis history positions without advancing the turn;
legal actions are recalculated and normal spending/income still apply. Stale
powering revision checkpoints are cleared so reopening an old choice cannot
restore the old balance. The upper bound limits materialized legal-bid arrays.
Use the host's saved analysis positions to navigate or branch around edits.
Structured money-edit events also support log reconstruction, but a sampled
scenario's initial hypothetical cash and deck cannot generally be recovered
from its original live-game move log alone.
## Host integration
No new host API or option is required for the confirmed ongoing-analysis route:

View file

@ -0,0 +1,393 @@
{
"game": "powergrid",
"gameVersion": 13,
"publishedAt": "2026-11-13T12:52:58.610Z",
"engine": {
"version": "2.0.31",
"package": {
"name": "powergrid-engine",
"version": "2.0.31",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/engine/bc8d36d6ca61a8d7/powergrid-engine-2.0.31.tgz"
},
"entryPoint": "dist/wrapper.js",
"sha256": "bc8d36d6ca61a8d77bb2354338613623ab11a72064ed6fbdbc24c52408f60a44",
"bytes": 403465
},
"viewer": {
"version": "2.3.30",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.js",
"stylesheets": [
"https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.css"
],
"scriptBytes": 1249589,
"bundle": "split-35414e493acc9a213b39",
"sha256": "ffbc8cbe5d60b5de615b64b721ffc3eded751b89117f51d7565603c638f05207",
"files": [
{
"name": "powergrid-viewer.css",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.css",
"bytes": 12404,
"storedBytes": 3342,
"sha256": "1ff7d6b7fac6e8773c47887195b62d37a77e697af8fa60a43f1daea14301730e"
},
{
"name": "powergrid-viewer.umd.min.geography-america.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-america.js",
"bytes": 85113,
"storedBytes": 34477,
"sha256": "4ddebf42d3994d82cc6fa466752d13f0b074d84a01591f119e1f9ddea8c4538c"
},
{
"name": "powergrid-viewer.umd.min.geography-australia.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-australia.js",
"bytes": 38512,
"storedBytes": 16689,
"sha256": "747be93e1177cd8290953bef54b9268701c862f8966d757ac5cb10d613456225"
},
{
"name": "powergrid-viewer.umd.min.geography-badenwurttemberg.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-badenwurttemberg.js",
"bytes": 8577,
"storedBytes": 4136,
"sha256": "ce042333f4d39d0d7d2235c5edf4201659b40d615c8b47774a40f8627059c012"
},
{
"name": "powergrid-viewer.umd.min.geography-benelux.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-benelux.js",
"bytes": 16630,
"storedBytes": 7505,
"sha256": "c8f996deeb74e4867dc89f5a9056689355236aa6983e336925ffa7ed3b28e1fe"
},
{
"name": "powergrid-viewer.umd.min.geography-brazil.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-brazil.js",
"bytes": 86016,
"storedBytes": 33420,
"sha256": "b8caa8bdf9fefcc087b35427489786903d042be093426d53aae9d9a7b2143b6c"
},
{
"name": "powergrid-viewer.umd.min.geography-bremen.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-bremen.js",
"bytes": 2372,
"storedBytes": 1333,
"sha256": "3a6c1031e0e3843b863ee831763cde8efa289c73e677a30a19419fb70c82cc0e"
},
{
"name": "powergrid-viewer.umd.min.geography-centraleurope.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-centraleurope.js",
"bytes": 55706,
"storedBytes": 24066,
"sha256": "8d531c9be5729b2a0856b4a97988ce4d23172456dd1ed2f4ff9dea644ac60efa"
},
{
"name": "powergrid-viewer.umd.min.geography-china.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-china.js",
"bytes": 106839,
"storedBytes": 45313,
"sha256": "283746e4373666d5e6d4944366c189a8a892eeb9dec046f96995fc09a861cc52"
},
{
"name": "powergrid-viewer.umd.min.geography-europe.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-europe.js",
"bytes": 102212,
"storedBytes": 43493,
"sha256": "1d59984f7f8b9761ab50f6dfa3e8aef6073f02f9972b7946db5d962af43adea0"
},
{
"name": "powergrid-viewer.umd.min.geography-france.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-france.js",
"bytes": 45372,
"storedBytes": 19312,
"sha256": "3c3e6e707b22dbaa561d483034306d388807ab4f58d73c83b42621a36249a47a"
},
{
"name": "powergrid-viewer.umd.min.geography-germany.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-germany.js",
"bytes": 44921,
"storedBytes": 19464,
"sha256": "4642891b80a542f828856d153f55e4cb2a4ba5cfed4ad001ce1f3265fd1e380c"
},
{
"name": "powergrid-viewer.umd.min.geography-indian.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-indian.js",
"bytes": 78059,
"storedBytes": 31059,
"sha256": "243e69b7198cf82e3916b256bb9f1d738ebf287d1caaba4237c2d5cdf4e9bd90"
},
{
"name": "powergrid-viewer.umd.min.geography-italy.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-italy.js",
"bytes": 48012,
"storedBytes": 19877,
"sha256": "837ba8420705c6f0c3be3434560121e6ae991519c94ff2b24e35268629d1a319"
},
{
"name": "powergrid-viewer.umd.min.geography-japan.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-japan.js",
"bytes": 36346,
"storedBytes": 15348,
"sha256": "da76e790643b7f49efba878c1050bcf1af7c50a532e7f4f00d5627dded9837e7"
},
{
"name": "powergrid-viewer.umd.min.geography-korea.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-korea.js",
"bytes": 22329,
"storedBytes": 10151,
"sha256": "6f2036391e9148110173dcfb6e9a6ca8e2883674b76f5cdf151ac385d12cb37d"
},
{
"name": "powergrid-viewer.umd.min.geography-manhattan.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-manhattan.js",
"bytes": 22389,
"storedBytes": 9353,
"sha256": "479cd7dc11bf83ca568a5df508e66245d4c479aab12fb511e924772e980044bf"
},
{
"name": "powergrid-viewer.umd.min.geography-middleeast.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-middleeast.js",
"bytes": 69713,
"storedBytes": 28367,
"sha256": "dd7826081b63a249c3dc69eaacf3b99fae1dcde4b7f8b69abe6c89acf0183539"
},
{
"name": "powergrid-viewer.umd.min.geography-northamerica.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-northamerica.js",
"bytes": 71472,
"storedBytes": 28257,
"sha256": "103e64a35e89640109f18fb40706b9725a18499a4337efba36402b57ba3407c7"
},
{
"name": "powergrid-viewer.umd.min.geography-northerneurope.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-northerneurope.js",
"bytes": 57391,
"storedBytes": 24075,
"sha256": "8ad128444440301b24882260b9f7ea75aef3bcbdc0be5cbfedb36e1dbfd4ef84"
},
{
"name": "powergrid-viewer.umd.min.geography-quebec.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-quebec.js",
"bytes": 96526,
"storedBytes": 42220,
"sha256": "143b6a429239264130d7150b1976b885fa1e782567eb5fe6443b9cdd8f98a0d4"
},
{
"name": "powergrid-viewer.umd.min.geography-russia.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-russia.js",
"bytes": 91649,
"storedBytes": 39307,
"sha256": "8d922e14bd5418c85c38cf2859f16650e11319cdb50a7ae923f887392f928840"
},
{
"name": "powergrid-viewer.umd.min.geography-southafrica.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-southafrica.js",
"bytes": 10242,
"storedBytes": 4599,
"sha256": "4eebe1fd7936ad4b9a213f013bf29f86637d879f30a3e233c0d394bf702a99a4"
},
{
"name": "powergrid-viewer.umd.min.geography-spainportugal.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-spainportugal.js",
"bytes": 40537,
"storedBytes": 17762,
"sha256": "a7d37eba954fbd8359f7d3ceaec6ca51c99853cad138e4ccca369a98fdeb7779"
},
{
"name": "powergrid-viewer.umd.min.geography-ukireland.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.geography-ukireland.js",
"bytes": 29283,
"storedBytes": 12489,
"sha256": "6e58fc86f032014533c9ab4bedced3ff975d0c798e80944c2cda7d0d7418974e"
},
{
"name": "powergrid-viewer.umd.min.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.js",
"bytes": 1249589,
"storedBytes": 323083,
"sha256": "ffbc8cbe5d60b5de615b64b721ffc3eded751b89117f51d7565603c638f05207"
},
{
"name": "powergrid-viewer.umd.min.locale-da.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-da.js",
"bytes": 131247,
"storedBytes": 41776,
"sha256": "9e9d17fec7716d39daafd1be2b77d0727c436a9dfdfd31ac759963accfcd1aba"
},
{
"name": "powergrid-viewer.umd.min.locale-de.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-de.js",
"bytes": 137401,
"storedBytes": 44658,
"sha256": "78f5d2e67626f1edf405d8b42e7a74332dd47164468ca884cc003025e9495397"
},
{
"name": "powergrid-viewer.umd.min.locale-el.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-el.js",
"bytes": 196780,
"storedBytes": 55988,
"sha256": "2d4e3d120f3638593c274cbde6871d21df7fd38ea03833e3ad0de379d75ab0ac"
},
{
"name": "powergrid-viewer.umd.min.locale-fa.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-fa.js",
"bytes": 168771,
"storedBytes": 46626,
"sha256": "acb177ac565267b4a0ac2c885c2693cfc6331ec42ed8ef843a1e00a8f115a36a"
},
{
"name": "powergrid-viewer.umd.min.locale-fr.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-fr.js",
"bytes": 142638,
"storedBytes": 44425,
"sha256": "6d79f92e59f848d60360bfb8cfbb0b756f632f049e64868653924aabb32efd1c"
},
{
"name": "powergrid-viewer.umd.min.locale-hi.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-hi.js",
"bytes": 217247,
"storedBytes": 53416,
"sha256": "5250de52ebfb45d623dafe99a5017d791dc22024f32daed6e5816b2c14995770"
},
{
"name": "powergrid-viewer.umd.min.locale-it.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-it.js",
"bytes": 137956,
"storedBytes": 43291,
"sha256": "24f6996865c1f7d4fe15ef31011759340560df9a66ee7406ffc9bb5ca0c52451"
},
{
"name": "powergrid-viewer.umd.min.locale-ko.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-ko.js",
"bytes": 145242,
"storedBytes": 48936,
"sha256": "a566beaec25e49dcc7bd1c449eccdf7a3d088997485540e154dfcbe09dda3f81"
},
{
"name": "powergrid-viewer.umd.min.locale-nl.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-nl.js",
"bytes": 135252,
"storedBytes": 42956,
"sha256": "e60517ab400e7b27eb4bf059a3785aeb678efed129425e78af35131604d08200"
},
{
"name": "powergrid-viewer.umd.min.locale-pl.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-pl.js",
"bytes": 134760,
"storedBytes": 44943,
"sha256": "f67d10622ecc0bbd7292a1e2e0e53fd4ddace19355bb988965574c3dd402e785"
},
{
"name": "powergrid-viewer.umd.min.locale-pt-BR.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-pt-BR.js",
"bytes": 136481,
"storedBytes": 43110,
"sha256": "cbe3c22ee4f4ab6ea8f34c172f11d93bcd5c1db5d3d84e065addd5500b32ef63"
},
{
"name": "powergrid-viewer.umd.min.locale-ro.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-ro.js",
"bytes": 139672,
"storedBytes": 44035,
"sha256": "c4b09c04bc3c2fcbd7c7d9da7fd127f70a55d41999faa3996ac0a3f662639bce"
},
{
"name": "powergrid-viewer.umd.min.locale-ru.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-ru.js",
"bytes": 182569,
"storedBytes": 54205,
"sha256": "2d037e307399831478ce26555054f7e2e1a5cc2ce9b23f5f5fcf88be4a3d7aef"
},
{
"name": "powergrid-viewer.umd.min.locale-vi.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-vi.js",
"bytes": 150916,
"storedBytes": 44651,
"sha256": "fe9630f2b3e2fc5dec6e825ce6e439512f09dddf266f47abc21e7899279f4906"
},
{
"name": "powergrid-viewer.umd.min.locale-zh-CN.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-zh-CN.js",
"bytes": 124113,
"storedBytes": 43886,
"sha256": "5251c6f7a718446a741477a6e03da5ee3f58a88fe63f21f6ef82a4b6907ff7a7"
},
{
"name": "powergrid-viewer.umd.min.locale-zh-TW.js",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-35414e493acc9a213b39/powergrid-viewer.umd.min.locale-zh-TW.js",
"bytes": 128552,
"storedBytes": 48495,
"sha256": "fcf451174398d5c9b787b52d5e5094b27628f93f93f43338d172352ffec998af"
}
]
},
"previousEngine": {
"package": {
"name": "powergrid-engine",
"version": "2.0.30",
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/engine/101b512ed7f78afb/powergrid-engine-2.0.30.tgz"
},
"entryPoint": "dist/wrapper.js"
},
"previousViewer": {
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-1fcab9d51da13679c8e4/powergrid-viewer.umd.min.js",
"topLevelVariable": "powergrid",
"dependencies": {
"scripts": ["https://cdn.jsdelivr.net/npm/vue@^2/dist/vue.min.js"],
"stylesheets": [
"https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-1fcab9d51da13679c8e4/powergrid-viewer.css"
]
},
"fullScreen": true,
"replayable": true,
"trusted": false,
"alternate": {
"url": "",
"topLevelVariable": "",
"dependencies": {
"scripts": [],
"stylesheets": []
},
"fullScreen": true,
"replayable": false,
"trusted": false
},
"chat": true,
"fullScreenMobile": true,
"thumbnail": true,
"scriptBytes": 1232200
},
"changes": [
"Preserve the analysis creator own-POV balance while giving opponents hypothetical money; keep finite balances on regeneration.",
"Add analysis-only money editing with bounded validation, replayable events, refreshed affordability, and live-game rejection.",
"Add accessible money editor and safe host response/rejection/refresh handling; compact right-aligned money labels and hypothetical marker."
],
"verification": {
"engineTests": 575,
"engineBuild": true,
"engineLint": {
"errors": 0,
"warnings": 41
},
"viewerUnitTests": 102,
"localizationTests": 8,
"viewerPackage": true,
"browser": {
"widths": [390, 1400],
"analysisMoney": true,
"protocol": true,
"replay": true
},
"layout": true,
"publicEngineTarballHash": true,
"publicViewerAssetHashes": true,
"publishedCDNViewer": {
"widths": [390, 1400],
"moneyEditor": true,
"rightAlignedCompactLabels": true,
"liveAndSpectatorEditingDisabled": true
},
"unrelatedAdminMetadataPreserved": true,
"viewerPreferencesPreserved": true,
"noLiveGameWrites": true
},
"verified": true
}

View file

@ -1,6 +1,6 @@
{
"name": "powergrid-engine",
"version": "2.0.30",
"version": "2.0.31",
"description": "An engine for Power Grid",
"main": "dist/index.js",
"types": "index.ts",

View file

@ -0,0 +1,125 @@
import { expect } from 'chai';
import { cloneDeep } from 'lodash';
import 'mocha';
import * as wrapper from '../wrapper';
import { MAX_ANALYSIS_MONEY, SetAnalysisMoney } from './analysis-money';
import { availableMoves } from './available-moves';
import { rememberPowering } from './choice-revisions';
import * as engine from './engine';
import { Phase } from './gamestate';
import { Move, MoveName } from './move';
const command = (player: number, money: number): SetAnalysisMoney => ({
name: 'SetAnalysisMoney',
data: { player, money },
});
const setup = () => engine.setup(3, { fastBid: true }, 'analysis-money');
async function rejects(run: () => Promise<unknown>) {
let error: unknown;
try {
await run();
} catch (e) {
error = e;
}
expect(error).to.be.instanceOf(Error);
}
describe('analysis money commands', () => {
for (const target of [0, 1, 2])
it(`edits seat ${target} without mutating the source, and survives resampling`, async () => {
const source = wrapper.createAnalysisScenario(setup(), { seed: 'branch' });
const before = cloneDeep(source);
const result = await wrapper.analysisMove(source, command(target, 0), source.currentPlayers[0]);
expect(source).to.deep.equal(before);
expect(result.players[target].money).to.equal(0);
expect(result.phase).to.equal(source.phase);
expect(result.currentPlayers).to.deep.equal(source.currentPlayers);
expect(wrapper.toSave(result)).to.equal(result);
expect(result.newTurn).to.equal(true);
expect(result.log[result.log.length - 1].type).to.equal('event');
result.players.forEach((p) =>
expect(p.availableMoves).to.deep.equal(
result.currentPlayers.includes(p.id) ? availableMoves(result, p) : null
)
);
expect(
wrapper.createAnalysisScenario(result, { seed: 'resampled' }).players.map((p) => p.money)
).to.deep.equal(result.players.map((p) => p.money));
});
it('rejects malformed values, mixed buffers, tentative states and invalid actors without mutation', async () => {
const source = setup();
const actor = source.currentPlayers[0];
for (const value of [-1, 1.2, NaN, Infinity, Number.MAX_SAFE_INTEGER + 1, MAX_ANALYSIS_MONEY + 1, '10', null]) {
const before = cloneDeep(source);
await rejects(() => wrapper.analysisMove(source, command(0, value as number), actor));
expect(source).to.deep.equal(before);
}
for (const target of [-1, 3, 0.5, NaN])
await rejects(() => wrapper.analysisMove(source, command(target, 10), actor));
for (const invalid of [-1, 3, 0.5, source.players.find((p) => !source.currentPlayers.includes(p.id))!.id])
await rejects(() => wrapper.analysisMove(source, command(0, 10), invalid));
await rejects(() => wrapper.analysisMove(source, { name: 'SetAnalysisMoney', data: null } as any, actor));
for (const input of [
[command(0, 10), { name: MoveName.Pass, data: true }],
[command(0, 10), command(1, 20)],
])
await rejects(() => wrapper.analysisMove(source, input as any, actor));
await rejects(() => wrapper.analysisMove({ ...source, newTurn: false }, command(0, 10), actor));
await rejects(() => wrapper.analysisMove({ ...source, phase: Phase.GameEnd }, command(0, 10), actor));
});
it('rejects live wrapper and engine calls before mutation, including mixed buffers', async () => {
const source = setup();
const before = cloneDeep(source);
const actor = source.currentPlayers[0];
for (const input of [command(0, 10), [command(0, 10)], [{ name: MoveName.Pass, data: true }, command(0, 10)]]) {
await rejects(() => wrapper.move(source, input as any, actor));
expect(source).to.deep.equal(before);
}
expect(() => engine.move(source, command(0, 10) as unknown as Move, actor)).to.throw();
expect(source).to.deep.equal(before);
});
it('protects outstanding bids and clears stale powering checkpoints', async () => {
let state = setup();
state = await wrapper.analysisMove(
state,
{ name: MoveName.ChoosePowerPlant, data: state.actualMarket[0].number },
state.currentPlayers[0]
);
const bidder = state.currentPlayers[0];
state = await wrapper.analysisMove(state, { name: MoveName.Bid, data: 20 }, bidder);
await rejects(() => wrapper.analysisMove(state, command(bidder, 19), state.currentPlayers[0]));
expect(
(await wrapper.analysisMove(state, command(bidder, 20), state.currentPlayers[0])).players[bidder].money
).to.equal(20);
state.phase = Phase.Bureaucracy;
rememberPowering(state, bidder);
expect(state.poweringChoices).not.to.equal(undefined);
const result = await wrapper.analysisMove(state, command(bidder, 30), state.currentPlayers[0]);
expect(result.poweringChoices).to.equal(undefined);
expect(result.revisedPowering).to.equal(undefined);
expect(state.poweringChoices).not.to.equal(undefined);
});
it('spends edited money normally and replays edit events in both reconstruction paths', async () => {
let state = setup();
const actor = state.currentPlayers[0];
const beforeEdit = state.log.length;
state = await wrapper.analysisMove(state, [command(actor, 100)], actor);
expect(wrapper.replay(state, { to: beforeEdit }).players[actor].money).to.equal(50);
expect(engine.reconstructState(state).players[actor].money).to.equal(100);
state = await wrapper.analysisMove(
state,
{ name: MoveName.ChoosePowerPlant, data: state.actualMarket[0].number },
actor
);
state = await wrapper.analysisMove(state, { name: MoveName.Bid, data: 80 }, actor);
while (state.chosenPowerPlant)
state = await wrapper.analysisMove(state, { name: MoveName.Pass, data: true }, state.currentPlayers[0]);
expect(state.players[actor].money).to.be.lessThan(100);
expect(wrapper.replay(state).players[actor].money).to.equal(state.players[actor].money);
expect(engine.reconstructState(state).players[actor].money).to.equal(state.players[actor].money);
});
});

View file

@ -0,0 +1,37 @@
import { availableMoves } from './available-moves';
import type { GameState } from './gamestate';
/** Bid choices are materialized arrays, so sandbox balances must remain bounded. */
export const MAX_ANALYSIS_MONEY = 9999;
export interface SetAnalysisMoney {
name: 'SetAnalysisMoney';
data: { player: number; money: number };
}
export function isAnalysisMoneyCommand(input: unknown): input is SetAnalysisMoney {
return !!input && typeof input === 'object' && (input as SetAnalysisMoney).name === 'SetAnalysisMoney';
}
/** Shared by analysis commands and event replay; never a gameplay move. */
export function applyAnalysisMoney(G: GameState, data: SetAnalysisMoney['data']): void {
if (!data || !Number.isSafeInteger(data.player) || data.player < 0 || !G.players[data.player])
throw new Error('Invalid analysis money target seat');
if (!Number.isSafeInteger(data.money) || data.money < 0 || data.money > MAX_ANALYSIS_MONEY)
throw new Error(`Analysis money must be an integer between 0 and ${MAX_ANALYSIS_MONEY}`);
if (G.chosenPowerPlant && data.money < G.players[data.player].bid)
throw new Error('Analysis money cannot be less than the outstanding bid');
if (G.players[data.player].money !== data.money && G.analysisKnownMoney) {
G.analysisKnownMoney = G.analysisKnownMoney.filter((seat) => seat !== data.player);
}
G.players[data.player].money = data.money;
// Reopening a completed powering choice restores its old money. Invalidate
// private revision checkpoints at this explicit sandbox edit boundary.
delete G.poweringChoices;
delete G.revisedPowering;
delete G.automation;
if (!G.options.showMoney) G.analysisMoney = 'hypothetical';
G.players.forEach((seat) => {
seat.availableMoves = G.currentPlayers.includes(seat.id) ? availableMoves(G, seat) : null;
});
G.newTurn = true;
}

View file

@ -24,7 +24,14 @@ export function createAnalysisScenario(
if (interactive) {
delete s.poweringChoices;
delete s.revisedPowering;
if (!s.options.showMoney) s.analysisMoney = 'hypothetical';
if (!s.options.showMoney) {
s.analysisMoney = 'hypothetical';
if (data.analysisMoney !== 'hypothetical') {
s.analysisKnownMoney = data.players
.map((p, i) => (i === player && p.money >= 0 ? i : -1))
.filter((i) => i >= 0);
}
}
}
delete s.powerPlantDeckAfterStep3;
const rng = seedrandom(seed);
@ -304,8 +311,11 @@ export function createAnalysisScenario(
// The visible history permits money accounting without reading hidden balances.
const publicReplay = interactive ? undefined : reconstructState(s, s.log.length, true);
s.players.forEach((p, i) => {
if (interactive && !s.options.showMoney && data.analysisMoney !== 'hypothetical') p.money = 999;
else if (p.money < 0 && publicReplay) p.money = publicReplay.players[i].money;
if (interactive && !s.options.showMoney && data.analysisMoney !== 'hypothetical') {
// The host supplies the creator's source-game seat. Retain only that
// known balance; spectators and opponents still use hypothetical cash.
p.money = i === player && data.players[i].money >= 0 ? data.players[i].money : 999;
} else if (p.money < 0 && publicReplay) p.money = publicReplay.players[i].money;
p.isAI = false;
p.isDropped = false;
p.lastMove = null;

View file

@ -1,6 +1,7 @@
import assert from 'assert';
import { cloneDeep, isEqual, range } from 'lodash';
import seedrandom from 'seedrandom';
import { applyAnalysisMoney, isAnalysisMoneyCommand } from './analysis-money';
import {
availableMoves,
buildOptions,
@ -850,6 +851,7 @@ export function move(
playerNumber: number,
{ updateBuildingMarket = true }: { updateBuildingMarket?: boolean } = {}
): GameState {
if (isAnalysisMoneyCommand(move)) throw new Error('SetAnalysisMoney is only available in an analysis');
const player = G.players[playerNumber];
const initialPhase = G.phase;
const initialRound = G.round;
@ -2357,6 +2359,10 @@ export function reconstructState(gameState: GameState, to?: number, _forcePublic
for (const item of log) {
switch (item.type) {
case 'event': {
if (item.analysisMoney) {
applyAnalysisMoney(G, item.analysisMoney);
G.log.push(cloneDeep(item));
}
if (item.event.endsWith('was dropped')) {
const playerNum = +item.event.split(' ')[1];
G.players[playerNum].isDropped = true;

View file

@ -199,6 +199,8 @@ export enum Phase {
export interface GameState {
/** Interactive sandbox cash, initialized once; never attached to live games. */
analysisMoney?: 'hypothetical';
/** Seats whose sandbox cash starts from known money rather than an assumption. */
analysisKnownMoney?: number[];
poweringChoices?: Record<number, import('./choice-revisions').PoweringChoice>;
revisedPowering?: Record<number, number>;
pendingMessages?: string[];

View file

@ -8,7 +8,7 @@ import { MoveName } from './move';
const clone = (s: GameState): GameState => JSON.parse(JSON.stringify(s));
describe('manual interactive analysis policy', () => {
it('uses only hypothetical cash and reopens sealed commitments for every seat', async () => {
it('retains only the creator cash and reopens sealed commitments for every seat', async () => {
const live = setup(3, { fastBid: true }, 'private');
const actor = live.currentPlayers[0];
let source = await wrapper.analysisMove(
@ -23,21 +23,58 @@ describe('manual interactive analysis policy', () => {
other.powerPlantsDeck.reverse();
other.powerPlantDeckAfterStep3 = [];
other.hiddenLog = [];
other.players.forEach((p) => {
p.money += 123;
other.players.forEach((p, i) => {
if (i !== actor) p.money += 123;
p.bid += 37;
});
const branch = wrapper.createAnalysisScenario(source, { player: actor, seed: 'sandbox' });
expect(branch).to.deep.equal(wrapper.createAnalysisScenario(other, { player: actor, seed: 'sandbox' }));
expect(branch.players.map((p) => p.money)).to.deep.equal([999, 999, 999]);
const balances = source.players.map((p, i) => (i === actor ? p.money : 999));
expect(branch.players.map((p) => p.money)).to.deep.equal(balances);
expect(branch.players.map((p) => p.bid)).to.deep.equal([0, 0, 0]);
expect(branch.currentPlayers).to.have.length(3);
expect(branch.analysisMoney).to.equal('hypothetical');
expect(stripSecret(branch).players.map((p) => p.money)).to.deep.equal([999, 999, 999]);
expect(branch.analysisKnownMoney).to.deep.equal([actor]);
expect(wrapper.createAnalysisScenario(branch, { seed: 'resample' }).analysisKnownMoney).to.deep.equal([actor]);
const edited = await wrapper.analysisMove(
branch,
{ name: 'SetAnalysisMoney', data: { player: actor, money: 123 } },
branch.currentPlayers[0]
);
expect(edited.analysisKnownMoney).to.deep.equal([]);
expect(branch.analysisKnownMoney).to.deep.equal([actor]);
expect(stripSecret(branch).players.map((p) => p.money)).to.deep.equal(balances);
expect(stripSecret(source).players.map((p) => p.money)).to.deep.equal([-1, -1, -1]);
expect(clone(source)).to.deep.equal(before);
});
for (const player of [0, 1, 2]) {
it(`preserves seat ${player}'s own zero balance and affordability on regeneration`, () => {
const source = setup(3, {}, 'source');
source.players[player].money = 0;
const branch = wrapper.createAnalysisScenario(source, { player, seed: 'sandbox' });
const balances = source.players.map((p, i) => (i === player ? 0 : 999));
expect(branch.players.map((p) => p.money)).to.deep.equal(balances);
expect(availableMoves(branch, branch.players[player]).ChoosePowerPlant || []).to.have.length(0);
branch.players[player].money = 10;
const regenerated = wrapper.createAnalysisScenario(branch, { player, seed: 'new-scenario' });
expect(regenerated.players.map((p) => p.money)).to.deep.equal(branch.players.map((p) => p.money));
});
}
for (const player of [undefined, -1, 3]) {
it(`uses hypothetical cash without a valid source seat (${player})`, () => {
const branch = wrapper.createAnalysisScenario(setup(3, {}, 'source'), { player, seed: 'sandbox' });
expect(branch.players.map((p) => p.money)).to.deep.equal([999, 999, 999]);
});
}
it('does not treat an already redacted own balance as known cash', () => {
const source = stripSecret(setup(3, {}, 'source'));
const branch = wrapper.createAnalysisScenario(source, { player: 0, seed: 'sandbox' });
expect(branch.players.map((p) => p.money)).to.deep.equal([999, 999, 999]);
});
it('hands off opponents manually and spends finite cash without resetting on move or resample', async () => {
let branch = wrapper.createAnalysisScenario(setup(3, { fastBid: true }, 'source'), { seed: 'sandbox' });
const actor = branch.currentPlayers[0];

View file

@ -2,6 +2,8 @@ import { Move } from './move';
export type LogEvent = {
type: 'event';
/** Analysis-only state edit; intentionally not a gameplay move. */
analysisMoney?: import('./analysis-money').SetAnalysisMoney['data'];
event: string;
pretty?: string;
};

View file

@ -1,5 +1,7 @@
import { cloneDeep } from 'lodash';
import type { GameState } from './index';
import { createAnalysisScenario as sampleAnalysisScenario } from './src/analysis';
import { applyAnalysisMoney, isAnalysisMoneyCommand, SetAnalysisMoney } from './src/analysis-money';
import { autoPassAuctions } from './src/auction-auto-pass';
import { alreadyCreditedPowering, canReviseChoice } from './src/choice-revisions';
import * as engine from './src/engine';
@ -17,6 +19,9 @@ import {
setPremoves,
} from './src/premoves';
import { asserts } from './src/utils';
export { MAX_ANALYSIS_MONEY } from './src/analysis-money';
export type { SetAnalysisMoney } from './src/analysis-money';
export { ended, scores, stripSecret } from './src/engine';
export async function init(
nbPlayers: number,
@ -76,6 +81,8 @@ export async function move(
move: Move | Move[] | PremoveCommand | null | undefined,
player: number
): Promise<GameState> {
if ((Array.isArray(move) ? move : [move]).some(isAnalysisMoneyCommand))
throw new Error('SetAnalysisMoney is only available in an analysis');
automation(G).liveUpdate = false;
if (isPremoveCommand(move)) {
setPremoves(G, move, player);
@ -157,7 +164,6 @@ export function toSave(G: GameState): GameState | undefined {
export function createAnalysisScenario(data: GameState, options: { player?: number; seed: string }): GameState {
return sampleAnalysisScenario(data, { ...options, interactive: true });
}
export { ended, scores, stripSecret } from './src/engine';
/**
* Play a full turn for `player`. The engine's own `moveAI` plays one atomic move at a
@ -245,7 +251,14 @@ export function replay(G: GameState, { to = Infinity }: { to?: number } = {}): G
// a historical state and must NOT append the hidden log.
const items = to >= oldG.log.length ? [...oldG.log, ...(oldG.hiddenLog ?? [])] : oldG.log.slice(0, to);
for (const move of items.filter((event) => event.type === 'move')) {
for (const move of items) {
if (move.type === 'event') {
if (move.analysisMoney) {
applyAnalysisMoney(G, move.analysisMoney);
G.log.push(cloneDeep(move));
}
continue;
}
asserts<LogMove>(move);
G = engine.move(G, move.move, move.player);
@ -385,7 +398,35 @@ export function createAnalysis(data: GameState, { to }: { to: number; sourceEnde
return copy;
}
export async function analysisMove(data: GameState, input: Move | Move[], player: number): Promise<GameState> {
export async function analysisMove(
data: GameState,
input: Move | SetAnalysisMoney | (Move | SetAnalysisMoney)[],
player: number
): Promise<GameState> {
const buffer = Array.isArray(input) ? input : [input];
if (buffer.some(isAnalysisMoneyCommand)) {
if (buffer.length !== 1) throw new Error('Analysis money edits must be sent alone');
if (data.newTurn === false) throw new Error('Analysis money edits require a committed state');
if (engine.ended(data)) throw new Error('Cannot edit money in an ended analysis');
if (
!Number.isSafeInteger(player) ||
!data.players[player] ||
!data.currentPlayers.includes(player) ||
data.players[player].isDropped
)
throw new Error('Only an active player can edit analysis money');
const command = buffer[0] as SetAnalysisMoney;
const copy = cloneDeep(data);
const previous = copy.players[command.data?.player]?.money;
applyAnalysisMoney(copy, command.data);
copy.log.push({
type: 'event',
event: `Analysis: player ${command.data.player} money changed from ${previous} to ${command.data.money}`,
analysisMoney: { ...command.data },
});
return copy;
}
data = cloneDeep(data);
if (isPremoveCommand(input)) throw new Error('Premoves are not available in an analysis');
delete data.automation;
// Deliberately bypass the live wrapper: clearing premoves alone does not
@ -395,7 +436,7 @@ export async function analysisMove(data: GameState, input: Move | Move[], player
seat.isAI = false;
seat.isDropped = false;
});
const moves = Array.isArray(input) ? input : [input];
const moves = buffer as Move[];
if (!moves.length) return { ...data, newTurn: false };
const now = Date.now();
for (let i = 0; i < moves.length; i++) {

View file

@ -1,6 +1,6 @@
{
"name": "powergrid-viewer",
"version": "2.3.29",
"version": "2.3.30",
"repository": {
"type": "git",
"url": "git+https://github.com/boardgamers/powergrid.git",

View file

@ -0,0 +1,109 @@
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const engine = require('../../engine/dist/index.js');
export async function checkAnalysisMoney(page) {
const state = JSON.parse(
JSON.stringify(engine.setup(3, { map: 'Germany', variant: 'recharged', showMoney: true }, 'money'))
);
state.players.forEach((p, i) => (p.name = ['You', 'Ada', 'Bob'][i]));
const actor = state.currentPlayers[0];
const emit = (event, payload) => page.evaluate(([e, p]) => host.emit(e, p), [event, payload]);
await page.evaluate(
({ state, actor }) => {
window.host = window.powergrid.launch('#app');
window.moneyMoves = [];
host.on('move', (move) => window.moneyMoves.push(move));
host.emit('preferences', { sound: false, locale: 'en' });
host.emit('player', { index: actor });
host.emit('state', state);
},
{ state, actor }
);
await page.locator('.player-board').first().waitFor();
assert.equal(await page.locator('[data-money-player]').count(), 0, 'live game has no editing');
await emit('preferences', { analysis: true, sound: false, locale: 'en' });
await page.locator('[data-money-player]').first().waitFor();
assert.equal(await page.locator('[data-money-player]').count(), 3);
for (const target of [actor, (actor + 1) % 3]) {
const edit = page.locator(`[data-money-player="${target}"]`);
await edit.focus();
await page.keyboard.press('Enter');
const input = page.locator('#analysis-money-input');
await input.waitFor();
assert.equal(await input.inputValue(), String(state.players[target].money));
const save = page.locator('.analysis-money-form button[type="submit"]');
for (const value of ['-1', '0.5', '10000', '']) {
await input.fill(value);
assert.equal(await save.isDisabled(), true);
}
await page.locator('.analysis-money-form button[type="button"]').click();
assert.equal(await page.evaluate(() => moneyMoves.length), target === actor ? 0 : 1);
await edit.click();
await input.fill('123');
await save.click();
assert.equal(await save.isDisabled(), true);
assert.deepEqual(await page.evaluate(() => moneyMoves[moneyMoves.length - 1]), [
{ name: 'SetAnalysisMoney', data: { player: target, money: 123 } },
]);
assert.ok(
(await page.locator('.player-board').allTextContents()).some((text) =>
text.includes(`$${state.players[target].money}`)
),
'no optimistic change'
);
state.players[target].money = 123;
await emit('state', state);
await input.waitFor({ state: 'detached' });
}
// Matching host rejection re-enables submission without mutating money.
await page.locator(`[data-money-player="${actor}"]`).click();
await page.locator('#analysis-money-input').fill('456');
await page.locator('.analysis-money-form button[type="submit"]').click();
await page.evaluate(() =>
host.emit('move:result', { ok: false, move: moneyMoves[moneyMoves.length - 1], error: 'rejected' })
);
await page.locator('.analysis-money-form [role="alert"]').waitFor();
assert.equal(await page.locator('.analysis-money-form button[type="submit"]').isDisabled(), false);
await page.keyboard.press('Escape');
await page.locator('#analysis-money-input').waitFor({ state: 'detached' });
// BGS can reject a change silently (host error only, no move:result/state).
// Explicit Close/Escape asks for the host's cached view, never retries the edit.
await page.evaluate((state) => {
window.moneyFetches = 0;
window.moneyCachedState = state;
host.on('fetchState', () => {
moneyFetches++;
host.emit('state', JSON.parse(JSON.stringify(moneyCachedState)));
});
}, state);
for (const escape of [false, true]) {
const before = await page.evaluate(() => moneyMoves.length);
await page.locator(`[data-money-player="${actor}"]`).click();
await page.locator('#analysis-money-input').fill('789');
await page.locator('.analysis-money-form button[type="submit"]').click();
const close = page.locator('.analysis-money-form button[type="button"]');
assert.equal(await close.textContent(), 'Close and refresh');
assert.equal(await page.evaluate(() => moneyFetches), escape ? 1 : 0, 'no automatic refresh');
if (escape) await page.keyboard.press('Escape');
else await close.click();
await page.locator('#analysis-money-input').waitFor({ state: 'detached' });
await page.locator(`[data-money-player="${actor}"]`).waitFor();
assert.equal(await page.evaluate(() => moneyMoves.length), before + 1, 'no automatic retry');
assert.equal(await page.evaluate(() => moneyFetches), escape ? 2 : 1);
await page.locator(`[data-money-player="${actor}"]`).click();
assert.equal(await page.locator('#analysis-money-input').inputValue(), String(state.players[actor].money));
await page.keyboard.press('Escape');
}
// Closing never cancels the request: a delayed successful response still applies.
state.players[actor].money = 789;
await emit('state', state);
await page.locator(`[data-money-player="${actor}"]`).click();
assert.equal(await page.locator('#analysis-money-input').inputValue(), '789');
await page.keyboard.press('Escape');
assert.equal(await page.evaluate(() => moneyFetches), 2, 'unsent edits do not fetch');
await emit('player', { index: (actor + 1) % 3 });
assert.equal(await page.locator('[data-money-player]').count(), 0, 'inactive controlled seat cannot edit');
await emit('player', {});
assert.equal(await page.locator('[data-money-player]').count(), 0, 'spectator cannot edit');
}

View file

@ -92,7 +92,7 @@ try {
assert.equal(await button('Start over').count(), 0, 'use the board Undo control');
await city('Osnabrück').click();
await city('Münster').click();
assert.match(await ownBoard().textContent(), /Money: \$43/);
assert.match(await ownBoard().textContent(), /\$43/);
assert.equal(await deckLabel(), initialDeck, 'public deck display survives local city builds');
await done().click();
await phase('Powering');
@ -100,7 +100,7 @@ try {
await card('players', 13).click();
await done().click();
await phase('Simulation complete');
assert.match(await ownBoard().textContent(), /Money: \$76/);
assert.match(await ownBoard().textContent(), /\$76/);
assert.equal(sent, 0, 'planning never submits real moves');
assert.deepEqual(await state(), initial, 'live state unchanged by simulation');
await screenshot('planning');
@ -125,7 +125,7 @@ try {
);
await phase('Simulation complete');
assert.equal((await state()).automation.plans[0].phases.length, 0);
assert.match(await ownBoard().textContent(), /Money: \$76/, 'cancelling keeps local simulation');
assert.match(await ownBoard().textContent(), /\$76/, 'cancelling keeps local simulation');
await button('Validate').click();
await queuedPlan(4).waitFor();
for (let i = 0; i < 2; i++) {
@ -160,7 +160,7 @@ try {
for (let i = 0; i < 12; i++) await page.locator('.calculator > g').nth(0).click();
await page.locator('.calculator g').filter({ hasText: 'OK' }).click();
await phase('Resources');
assert.match(await ownBoard().textContent(), /Money: \$55/);
assert.match(await ownBoard().textContent(), /\$55/);
const oil = () =>
page
.locator('[data-tutorial="resources"] g.canClick')
@ -171,7 +171,7 @@ try {
await done().click();
await phase('Building');
await city('Osnabrück').click();
assert.match(await ownBoard().textContent(), /Money: \$39/);
assert.match(await ownBoard().textContent(), /\$39/);
assert.equal(await button('Validate').count(), 0, 'assumed purchases cannot be queued');
await screenshot('auction');
for (let i = 0; i < 6; i++) await undo().click();
@ -180,7 +180,7 @@ try {
await done().click();
await page.locator('.modal.visible').getByRole('button', { name: 'OK', exact: true }).click();
await phase('Resources');
assert.match(await ownBoard().textContent(), /Money: \$70/);
assert.match(await ownBoard().textContent(), /\$70/);
assert.equal(sent, sentBeforeAuction);
assert.equal((await state('auction')).players[0].money, 70);
console.log('Assumed plant price, fuel purchases, no purchase, and simulation-only restriction passed.');
@ -193,7 +193,7 @@ try {
await card('players', 13).click();
await done().click();
await phase('Simulation complete');
assert.match(await ownBoard().textContent(), /Money: \$75/);
assert.match(await ownBoard().textContent(), /\$75/);
assert.ok(
await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1),
'no mobile horizontal overflow'

View file

@ -1,3 +1,4 @@
import { checkAnalysisMoney } from './analysis-money-smoke.mjs';
import { checkHostPresentation } from './host-presentation-smoke.mjs';
import { checkMiddleEastReplay, checkReplayDeckCount } from './replay-smoke.mjs';
import { checkUndoMove } from './undo-smoke.mjs';
@ -434,6 +435,7 @@ try {
await checkReplayDeckCount(page);
if (width === 1400) await checkMiddleEastReplay(page);
await checkUndoMove(page);
await checkAnalysisMoney(page);
assert.deepEqual(errors, []);
await page.close();
console.log(`${game} ${width}px: protocol/chat smoke passed`);

View file

@ -609,7 +609,11 @@
:isPlayer="player == playerIndex"
:ranking="sortedPlayers.findIndex((x) => x.id == G.players[playerIndex].id) + 1"
:showMoney="player == playerIndex || moneyIsPublic || G.analysisMoney === 'hypothetical'"
:hypotheticalMoney="G.analysisMoney === 'hypothetical'"
:moneyEditable="canEditAnalysisMoney()"
@editMoney="openAnalysisMoney(playerIndex)"
:hypotheticalMoney="
G.analysisMoney === 'hypothetical' && !(G.analysisKnownMoney || []).includes(playerIndex)
"
:showBid="!G.options.fastBid"
:phase="G.phase"
:isAustralia="G.map.name === 'Australia'"
@ -631,6 +635,41 @@
<div class="chat-host"></div>
</div>
<div v-if="analysisMoneyTarget !== null" class="modal visible" @keydown.esc.prevent="closeAnalysisMoney">
<form
ref="analysisMoneyForm"
class="modal-content analysis-money-form"
role="dialog"
aria-modal="true"
aria-labelledby="analysis-money-title"
@submit.prevent="saveAnalysisMoney"
@keydown.tab="trapAnalysisMoneyFocus"
>
<h2 id="analysis-money-title">Edit analysis money</h2>
<p translate="no">{{ G && G.players[analysisMoneyTarget].name }}</p>
<label for="analysis-money-input">Money</label>
<input
id="analysis-money-input"
ref="analysisMoneyInput"
v-model="analysisMoneyValue"
type="number"
min="0"
max="9999"
step="1"
required
:disabled="analysisMoneyPending"
aria-describedby="analysis-money-help"
/>
<p id="analysis-money-help">Enter a whole number from 0 to 9999, not below the outstanding bid.</p>
<p v-if="analysisMoneyError" role="alert">{{ analysisMoneyError }}</p>
<p v-if="analysisMoneyPending" role="status">Waiting for analysis update…</p>
<button type="submit" :disabled="!canEditAnalysisMoney() || !validAnalysisMoney">Save</button>
<p v-if="analysisMoneyPending">Closing refreshes the board but does not cancel the submitted edit.</p>
<button v-if="analysisMoneyPending" type="button" @click="closeAnalysisMoney">Close and refresh</button>
<button v-else type="button" @click="closeAnalysisMoney">Cancel</button>
</form>
</div>
<div v-if="G" :class="['modal', { visible: confirmVisible }]">
<div class="modal-content">
<span class="close" @click="confirmVisible = false">&times;</span>
@ -972,6 +1011,7 @@ import { isEqual } from 'lodash';
import './buttons/board-control.css';
import { resolvePlayerColors, colorText } from '../player-colors';
import InlineLog from './InlineLog.vue';
import { MAX_ANALYSIS_MONEY } from 'powergrid-engine/src/analysis-money';
import { Vue, Component, Prop, Watch, Provide, ProvideReactive, Ref } from 'vue-property-decorator';
import { MoveName, ended, playersSortedByScore, reconstructState } from 'powergrid-engine';
import type { GameState, LogItem, Move, Player } from 'powergrid-engine';
@ -1097,7 +1137,9 @@ let nextGeographyClipId = 0;
@Component({
created(this: Game) {
this.emitter.on('analysisMoneyResult', this.onAnalysisMoneyResult);
this.emitter.on('replayStart', () => {
this.cancelAnalysisMoney();
this.paused = true;
this.emitter.emit('replay:info', {
start: 1,
@ -1186,6 +1228,110 @@ export default class Game extends Vue {
@Prop({ default: null })
settings!: Record<string, unknown> | null;
analysisMoneyTarget: number | null = null;
analysisMoneyValue = '';
analysisMoneyPending = false;
analysisMoneyError = '';
private analysisMoneyReturnFocus: Element | null = null;
// Deliberately a method: host preferences can be plain, force-updated objects.
canEditAnalysisMoney(): boolean {
return !!(
this.preferences.analysis &&
this.G &&
this.committedState &&
this.G.newTurn !== false &&
this.player != null &&
this.G.players[this.player] &&
this.G.currentPlayers.includes(this.player) &&
!ended(this.G) &&
!this.paused &&
!this.interactionDisabled &&
!this.tutorialMove &&
!this.roundPlan &&
!this.turnMoves.length &&
!this.pendingPlanId &&
!this.changingBid &&
!this.poweringSubmitting &&
!this.undoRequested &&
!this.recentLocalUndo &&
!this.analysisMoneyPending
);
}
get validAnalysisMoney(): boolean {
const target = this.analysisMoneyTarget;
if (target === null || !this.G?.players[target] || !this.analysisMoneyValue.trim()) return false;
const money = Number(this.analysisMoneyValue);
const bid = this.G.chosenPowerPlant ? this.G.players[target].bid : 0;
return Number.isSafeInteger(money) && money >= Math.max(0, bid || 0) && money <= MAX_ANALYSIS_MONEY;
}
openAnalysisMoney(target: number) {
if (!this.canEditAnalysisMoney() || !this.G?.players[target]) return;
this.analysisMoneyReturnFocus = document.activeElement;
this.analysisMoneyTarget = target;
this.analysisMoneyValue = String(this.G.players[target].money);
this.analysisMoneyError = '';
this.$nextTick(() => (this.$refs.analysisMoneyInput as HTMLInputElement)?.focus());
}
closeAnalysisMoney() {
this.cancelAnalysisMoney();
// BGS may report a failed change only in its own UI, without a move result.
// Explicit recovery requests its cached authoritative view; do not retry or
// unlock locally. A later successful edit still arrives through normal state updates.
if (this.analysisMoneyPending) this.emitter.emit('fetchState');
}
cancelAnalysisMoney() {
this.analysisMoneyTarget = null;
this.analysisMoneyError = '';
this.$nextTick(() => (this.analysisMoneyReturnFocus as HTMLElement)?.focus?.());
}
trapAnalysisMoneyFocus(event: KeyboardEvent) {
const form = this.$refs.analysisMoneyForm as HTMLElement;
const controls = Array.from(form.querySelectorAll<HTMLElement>('input:not(:disabled), button:not(:disabled)'));
const first = controls[0],
last = controls[controls.length - 1];
if (event.shiftKey && document.activeElement === first) {
event.preventDefault();
last.focus();
} else if (!event.shiftKey && document.activeElement === last) {
event.preventDefault();
first.focus();
}
}
saveAnalysisMoney() {
if (!this.canEditAnalysisMoney() || !this.validAnalysisMoney) return;
this.analysisMoneyPending = true;
this.$nextTick(() =>
(this.$refs.analysisMoneyForm as HTMLElement)
?.querySelector<HTMLButtonElement>('button[type="button"]')
?.focus()
);
// Wrapper-only command: never simulate it or mix it into the tentative turn.
this.emitter.emit('move', [
{
name: 'SetAnalysisMoney',
data: {
player: this.analysisMoneyTarget,
money: Number(this.analysisMoneyValue),
},
},
]);
}
onAnalysisMoneyResult(result: { ok: boolean; move?: unknown }) {
if (!this.analysisMoneyPending || result.ok) return;
const moves = result.move;
if (!Array.isArray(moves) || !moves.some((move) => move.name === 'SetAnalysisMoney')) return;
this.analysisMoneyPending = false;
this.analysisMoneyError = 'Analysis money update failed. Please try again.';
}
get showAutoPass(): boolean {
return (
!this.tutorialMove &&
@ -1357,7 +1503,13 @@ export default class Game extends Vue {
editingBid: string | null = null;
replacementBid = 0;
get revisableBid(): string | undefined {
return !this.paused && !this.interactionDisabled && !this.roundPlan && this.G && this.player !== undefined
return !this.analysisMoneyPending &&
this.analysisMoneyTarget === null &&
!this.paused &&
!this.interactionDisabled &&
!this.roundPlan &&
this.G &&
this.player !== undefined
? bidRevision(this.G, this.player)
: undefined;
}
@ -1369,6 +1521,8 @@ export default class Game extends Vue {
}
get canChangePowering(): boolean {
return !!(
!this.analysisMoneyPending &&
this.analysisMoneyTarget === null &&
!this.paused &&
!this.interactionDisabled &&
!this.roundPlan &&
@ -1480,6 +1634,8 @@ export default class Game extends Vue {
!this.tutorialMove &&
!this.paused &&
!this.interactionDisabled &&
!this.analysisMoneyPending &&
this.analysisMoneyTarget === null &&
this.player != undefined &&
!!this.committedState &&
!!nextPlanningPhase(this.committedState, this.player)
@ -1627,6 +1783,10 @@ export default class Game extends Vue {
@Watch('state', { immediate: true })
onStateChanged(state: GameState) {
if (state && state.newTurn !== false) {
this.analysisMoneyPending = false;
if (this.analysisMoneyTarget !== null) this.cancelAnalysisMoney();
}
if (this.tutorialMove) {
// Tutorial moves are individual engine checkpoints, not server turn buffers.
// Rewinds must also clear temporary UI selections from a later step.
@ -2411,7 +2571,7 @@ export default class Game extends Vue {
}
sendMove(move, submit = true) {
if (this.paused || this.interactionDisabled) {
if (this.paused || this.interactionDisabled || this.analysisMoneyPending || this.analysisMoneyTarget !== null) {
return;
}
@ -2534,6 +2694,8 @@ export default class Game extends Vue {
canMove() {
return (
!this.interactionDisabled &&
!this.analysisMoneyPending &&
this.analysisMoneyTarget === null &&
this.player != undefined &&
this.G &&
this.G.currentPlayers.includes(this.player!) &&
@ -3022,11 +3184,7 @@ export default class Game extends Vue {
// Games created since the engine followed this rule; Middle East and China have their own.
get earlyStep3StartsStep2(): boolean {
return (
!!this.G?.options.step2BeforeStep3 &&
this.G.map.name !== 'Middle East' &&
this.G.map.name !== 'China'
);
return !!this.G?.options.step2BeforeStep3 && this.G.map.name !== 'Middle East' && this.G.map.name !== 'China';
}
// The deck build for the deck and variant in play: the standard build, then this
@ -3338,6 +3496,7 @@ export default class Game extends Vue {
}
beforeDestroy() {
this.emitter.removeListener('analysisMoneyResult', this.onAnalysisMoneyResult);
if (this.pendingPlanTimer) clearTimeout(this.pendingPlanTimer);
if (this.undoRequestTimer) clearTimeout(this.undoRequestTimer);
if (this.recentLocalUndoTimer) clearTimeout(this.recentLocalUndoTimer);
@ -3860,3 +4019,18 @@ text {
}
}
</style>
<style scoped>
.analysis-money-form {
max-width: 420px;
}
.analysis-money-form input {
font-size: 1.2em;
margin: 8px;
width: 8em;
}
.analysis-money-form button {
margin: 8px;
padding: 8px 16px;
}
</style>

View file

@ -41,13 +41,34 @@
</text>
<text
v-if="showMoney"
x="250"
:x="moneyEditable ? 320 : 345"
text-anchor="end"
y="13"
font-weight="600"
:font-size="hypotheticalMoney ? 10 : undefined"
:fill="colorText(color)"
>{{ hypotheticalMoney ? 'Hypothetical' : 'Money' }}: ${{ player.money }}</text
:tabindex="hypotheticalMoney ? 0 : undefined"
:style="hypotheticalMoney ? { pointerEvents: 'all', cursor: 'help' } : undefined"
data-player-money
>
<title v-if="hypotheticalMoney">Hypothetical</title>
${{ player.money }}<tspan v-if="hypotheticalMoney" font-size="10" baseline-shift="super">*</tspan>
</text>
<g
v-if="moneyEditable"
role="button"
tabindex="0"
aria-label="Edit analysis money"
class="analysis-money-edit"
:data-money-player="owner"
@click="$emit('editMoney')"
@keydown.enter.prevent="$emit('editMoney')"
@keydown.space.prevent="$emit('editMoney')"
>
<rect x="326" y="0" width="24" height="25" fill="transparent" />
<text x="338" y="13" text-anchor="middle" :fill="colorText(color)">✎</text>
<title>Edit analysis money</title>
</g>
<!-- Keep the full preference inside the viewer's own player card. -->
<template v-if="showAutoPass">
@ -241,6 +262,7 @@ export default class PlayerBoard extends Vue {
@Prop() ranking?: number;
@Prop() showMoney?: boolean;
@Prop() hypotheticalMoney?: boolean;
@Prop({ default: false }) moneyEditable!: boolean;
@Prop() showBid?: boolean;
@Prop() phase?: Phase;
// Australia: uranium plants are "mines" — flag so the hand marks them distinctly.
@ -445,3 +467,14 @@ export default class PlayerBoard extends Vue {
stroke-width: 2;
}
</style>
<style scoped>
.analysis-money-edit {
cursor: pointer;
pointer-events: all;
}
.analysis-money-edit:focus rect {
stroke: currentColor;
stroke-width: 2px;
}
</style>

View file

@ -1,6 +1,7 @@
import { createViewer } from '@boardgamers/protocol/viewer';
import { EventEmitter } from 'events';
import type { GameState, Move } from 'powergrid-engine';
import type { SetAnalysisMoney } from 'powergrid-engine/src/analysis-money';
import type { PremoveCommand } from 'powergrid-engine/src/premoves';
import Vue from 'vue';
import Game from './components/Game.vue';
@ -63,7 +64,10 @@ function launch(selector: string) {
const thumbnail = createBoardThumbnail(app.$el);
const localization = mountLocalization(target.ownerDocument.body);
let replaying = false;
const viewer = createViewer<GameState, Move[] | PremoveCommand>({
const viewer = createViewer<GameState, Move[] | SetAnalysisMoney[] | PremoveCommand>({
onMoveResult(result) {
params.emitter.emit('analysisMoneyResult', result);
},
async onThumbnail(size) {
await app.$nextTick();
return thumbnail.render(app.$el.querySelector('[data-tutorial="map"]'), size, '#e7e6df');
@ -131,7 +135,7 @@ function launch(selector: string) {
},
});
const item = viewer.emitter;
params.emitter.on('move', (moves: Move[]) => viewer.move(moves));
params.emitter.on('move', (moves: Move[] | SetAnalysisMoney[]) => viewer.move(moves));
params.emitter.on('premoves', (command: PremoveCommand) => viewer.move(command));
params.emitter.on('fetchState', () => viewer.fetchState());
params.emitter.on('addLog', (data: string[]) => viewer.addLog(data));

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Atomkraftværker kan kun købes af spillere med mindst én by i Tjekkiet, Slovakiet eller Ungarn. Spillere med byer kun i Polen eller Østrig må ikke byde på eller købe atomkraftværker. En spiller med en by i Wien betaler $1 mindre for hvert affald, men aldrig mindre end $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Når det starter, forlader kraftværket med lavest nummer markedet, og et nyt trækkes",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Når det starter, forlader trin 3-kortet og kraftværket med lavest nummer markedet, og trækbunken blandes",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Hvis trin 3-kortet trækkes, før trin 2 er begyndt, begynder trin 2 først med sin egen opsætning, og trin 3 følger lige efter"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Hvis trin 3-kortet trækkes, før trin 2 er begyndt, begynder trin 2 først med sin egen opsætning, og trin 3 følger lige efter",
"Edit analysis money": "Rediger penge i analysen",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Indtast et heltal fra 0 til 9999, ikke under det udestående bud.",
"Waiting for analysis update…": "Venter på opdatering af analysen…",
"Analysis money update failed. Please try again.": "Opdatering af analysepenge mislykkedes. Prøv igen.",
"Save": "Gem",
"Close and refresh": "Luk og opdater",
"Closing refreshes the board but does not cancel the submitted edit.": "Når du lukker, opdateres brættet, men den indsendte ændring annulleres ikke."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Atomkraftwerke dürfen nur von Spielern gekauft werden, die mindestens eine Stadt in Tschechien, der Slowakei oder Ungarn haben. Spieler mit Städten nur in Polen oder Österreich dürfen nicht auf Atomkraftwerke bieten oder sie kaufen. Ein Spieler mit einer Stadt in Wien zahlt für jeden Müll $1 weniger, aber nie weniger als $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Zu Beginn verlässt das Kraftwerk mit der niedrigsten Nummer den Markt und ein neues wird gezogen",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Zu Beginn verlassen die Stufe-3-Karte und das Kraftwerk mit der niedrigsten Nummer den Markt und der Nachziehstapel wird gemischt",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Wird die Stufe-3-Karte gezogen, bevor Stufe 2 begonnen hat, beginnt zuerst Stufe 2 mit ihrem eigenen Aufbau und Stufe 3 folgt direkt danach"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Wird die Stufe-3-Karte gezogen, bevor Stufe 2 begonnen hat, beginnt zuerst Stufe 2 mit ihrem eigenen Aufbau und Stufe 3 folgt direkt danach",
"Edit analysis money": "Geld in der Analyse bearbeiten",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Gib eine ganze Zahl von 0 bis 9999 ein, nicht unter dem offenen Gebot.",
"Waiting for analysis update…": "Analyse wird aktualisiert…",
"Analysis money update failed. Please try again.": "Geldaktualisierung fehlgeschlagen. Bitte erneut versuchen.",
"Save": "Speichern",
"Close and refresh": "Schließen und aktualisieren",
"Closing refreshes the board but does not cancel the submitted edit.": "Beim Schließen wird das Spielbrett aktualisiert, die gesendete Änderung aber nicht abgebrochen."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Τα πυρηνικά εργοστάσια μπορούν να αγοραστούν μόνο από παίκτες με τουλάχιστον μία πόλη στην Τσεχία, τη Σλοβακία ή την Ουγγαρία. Παίκτες με πόλεις μόνο στην Πολωνία ή την Αυστρία δεν μπορούν να πλειοδοτήσουν ή να αγοράσουν πυρηνικά εργοστάσια. Ένας παίκτης με πόλη στη Βιέννη πληρώνει $1 λιγότερο για κάθε μονάδα σκουπιδιών, αλλά ποτέ λιγότερο από $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Όταν ξεκινά, ο σταθμός με τον μικρότερο αριθμό φεύγει από την αγορά και τραβιέται ένας νέος",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Όταν ξεκινά, η κάρτα Βήματος 3 και ο σταθμός με τον μικρότερο αριθμό φεύγουν από την αγορά και η στοίβα ανακατεύεται",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Αν η κάρτα Βήματος 3 τραβηχτεί πριν ξεκινήσει το Βήμα 2, ξεκινά πρώτα το Βήμα 2 με τη δική του προετοιμασία και το Βήμα 3 ακολουθεί αμέσως μετά"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Αν η κάρτα Βήματος 3 τραβηχτεί πριν ξεκινήσει το Βήμα 2, ξεκινά πρώτα το Βήμα 2 με τη δική του προετοιμασία και το Βήμα 3 ακολουθεί αμέσως μετά",
"Edit analysis money": "Επεξεργασία χρημάτων ανάλυσης",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Εισαγάγετε ακέραιο από 0 έως 9999, όχι μικρότερο από την εκκρεμή προσφορά.",
"Waiting for analysis update…": "Αναμονή ενημέρωσης ανάλυσης…",
"Analysis money update failed. Please try again.": "Η ενημέρωση χρημάτων απέτυχε. Δοκιμάστε ξανά.",
"Save": "Αποθήκευση",
"Close and refresh": "Κλείσιμο και ανανέωση",
"Closing refreshes the board but does not cancel the submitted edit.": "Το κλείσιμο ανανεώνει το ταμπλό αλλά δεν ακυρώνει την υποβληθείσα αλλαγή."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "When it starts, the smallest power plant leaves the market and a new one is drawn",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after",
"Edit analysis money": "Edit analysis money",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Enter a whole number from 0 to 9999, not below the outstanding bid.",
"Waiting for analysis update…": "Waiting for analysis update…",
"Analysis money update failed. Please try again.": "Analysis money update failed. Please try again.",
"Save": "Save",
"Close and refresh": "Close and refresh",
"Closing refreshes the board but does not cancel the submitted edit.": "Closing refreshes the board but does not cancel the submitted edit."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "فقط بازیکنانی که دست‌کم یک شهر در چک، اسلواکی یا مجارستان دارند می‌توانند نیروگاه هسته‌ای بخرند. بازیکنانی که فقط در لهستان یا اتریش شهر دارند نمی‌توانند برای نیروگاه هسته‌ای پیشنهاد بدهند یا آن را بخرند. بازیکنی که در Wien شهر دارد برای هر واحد زباله $1 کمتر می‌پردازد، اما هرگز کمتر از $1 نمی‌پردازد.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "با آغاز آن، نیروگاه با پایین‌ترین شماره از بازار خارج می‌شود و نیروگاه تازه‌ای کشیده می‌شود",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "با آغاز آن، کارت گام 3 و نیروگاه با پایین‌ترین شماره از بازار خارج می‌شوند و دستهٔ کارت‌ها بُر زده می‌شود",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "اگر کارت گام 3 پیش از آغاز گام 2 کشیده شود، نخست گام 2 با آماده‌سازی ویژهٔ خودش آغاز می‌شود و گام 3 بی‌درنگ پس از آن می‌آید"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "اگر کارت گام 3 پیش از آغاز گام 2 کشیده شود، نخست گام 2 با آماده‌سازی ویژهٔ خودش آغاز می‌شود و گام 3 بی‌درنگ پس از آن می‌آید",
"Edit analysis money": "ویرایش پول در تحلیل",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "عددی صحیح از ۰ تا ۹۹۹۹ وارد کنید که از پیشنهاد جاری کمتر نباشد.",
"Waiting for analysis update…": "در انتظار به‌روزرسانی تحلیل…",
"Analysis money update failed. Please try again.": "به‌روزرسانی پول تحلیل ناموفق بود. دوباره تلاش کنید.",
"Save": "ذخیره",
"Close and refresh": "بستن و تازه‌سازی",
"Closing refreshes the board but does not cancel the submitted edit.": "بستن، صفحهٔ بازی را تازه‌سازی می‌کند اما ویرایش ارسال‌شده را لغو نمی‌کند."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Les centrales nucléaires ne peuvent être achetées que par les joueurs ayant au moins une ville en Tchéquie, en Slovaquie ou en Hongrie. Les joueurs n'ayant des villes qu'en Pologne ou en Autriche ne peuvent pas enchérir ni acheter de centrales nucléaires. Un joueur ayant une ville à Wien paie $1 de moins pour chaque déchet, mais jamais moins de $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Au début de l'étape, la centrale au numéro le plus bas quitte le marché et une nouvelle est piochée",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Au début de l'étape, la carte Étape 3 et la centrale au numéro le plus bas quittent le marché, et la pioche est mélangée",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Si la carte Étape 3 est piochée avant le début de l'étape 2, l'étape 2 commence d'abord, avec sa propre mise en place, et l'étape 3 suit immédiatement"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Si la carte Étape 3 est piochée avant le début de l'étape 2, l'étape 2 commence d'abord, avec sa propre mise en place, et l'étape 3 suit immédiatement",
"Edit analysis money": "Modifier l’argent de l’analyse",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Saisissez un entier de 0 à 9999, au moins égal à l’enchère en cours.",
"Waiting for analysis update…": "Mise à jour de l’analyse en attente…",
"Analysis money update failed. Please try again.": "La mise à jour de l’argent a échoué. Réessayez.",
"Save": "Enregistrer",
"Close and refresh": "Fermer et actualiser",
"Closing refreshes the board but does not cancel the submitted edit.": "Fermer actualise le plateau mais n’annule pas la modification envoyée."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "परमाणु संयंत्र केवल उन्हीं खिलाड़ियों द्वारा खरीदे जा सकते हैं जिनके पास चेकिया, स्लोवाकिया या हंगरी में कम से कम एक शहर हो। केवल पोलैंड या ऑस्ट्रिया में शहर रखने वाले खिलाड़ी परमाणु संयंत्रों पर बोली नहीं लगा सकते या उन्हें खरीद नहीं सकते। Wien में शहर रखने वाला खिलाड़ी हर कचरे के लिए $1 कम चुकाता है, लेकिन कभी भी $1 से कम नहीं।",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "शुरू होने पर, सबसे छोटे नंबर वाला बिजलीघर बाज़ार से हट जाता है और एक नया निकाला जाता है",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "शुरू होने पर, चरण 3 कार्ड और सबसे छोटे नंबर वाला बिजलीघर बाज़ार से हट जाते हैं, और गड्डी फेंटी जाती है",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "यदि चरण 2 शुरू होने से पहले चरण 3 कार्ड निकल आता है, तो पहले चरण 2 अपनी तैयारी के साथ शुरू होता है, और उसके तुरंत बाद चरण 3 आता है"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "यदि चरण 2 शुरू होने से पहले चरण 3 कार्ड निकल आता है, तो पहले चरण 2 अपनी तैयारी के साथ शुरू होता है, और उसके तुरंत बाद चरण 3 आता है",
"Edit analysis money": "विश्लेषण में पैसे बदलें",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "0 से 9999 तक पूर्णांक दर्ज करें, जो वर्तमान बोली से कम न हो।",
"Waiting for analysis update…": "विश्लेषण अपडेट की प्रतीक्षा है…",
"Analysis money update failed. Please try again.": "विश्लेषण के पैसे अपडेट नहीं हो सके। फिर कोशिश करें।",
"Save": "सहेजें",
"Close and refresh": "बंद करें और रीफ़्रेश करें",
"Closing refreshes the board but does not cancel the submitted edit.": "बंद करने से बोर्ड रीफ़्रेश होता है, लेकिन भेजा गया बदलाव रद्द नहीं होता।"
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Le centrali nucleari possono essere acquistate solo da giocatori con almeno una città in Cechia, Slovacchia o Ungheria. I giocatori con città solo in Polonia o Austria non possono fare offerte né acquistare centrali nucleari. Un giocatore con una città a Wien paga $1 in meno per ogni rifiuto, ma mai meno di $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "All'inizio, la centrale con il numero più basso lascia il mercato e ne viene pescata una nuova",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "All'inizio, la carta Stadio 3 e la centrale con il numero più basso lasciano il mercato e il mazzo viene mescolato",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Se la carta Stadio 3 viene pescata prima che sia iniziato lo Stadio 2, inizia prima lo Stadio 2, con la propria preparazione, e subito dopo segue lo Stadio 3"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Se la carta Stadio 3 viene pescata prima che sia iniziato lo Stadio 2, inizia prima lo Stadio 2, con la propria preparazione, e subito dopo segue lo Stadio 3",
"Edit analysis money": "Modifica il denaro nell’analisi",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Inserisci un intero da 0 a 9999, non inferiore all’offerta in corso.",
"Waiting for analysis update…": "In attesa dell’aggiornamento dell’analisi…",
"Analysis money update failed. Please try again.": "Aggiornamento del denaro non riuscito. Riprova.",
"Save": "Salva",
"Close and refresh": "Chiudi e aggiorna",
"Closing refreshes the board but does not cancel the submitted edit.": "La chiusura aggiorna il tabellone ma non annulla la modifica inviata."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "원자력 발전소는 체코, 슬로바키아 또는 헝가리에 도시가 하나 이상 있는 플레이어만 구매할 수 있습니다. 폴란드나 오스트리아에만 도시가 있는 플레이어는 원자력 발전소에 입찰하거나 구매할 수 없습니다. 빈에 도시가 있는 플레이어는 쓰레기 1개마다 $1 적게 지불하지만, 개당 $1 미만으로 내려가지는 않습니다.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "시작되면 번호가 가장 낮은 발전소가 시장에서 빠지고 새 발전소를 뽑습니다",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "시작되면 3단계 카드와 번호가 가장 낮은 발전소가 시장에서 빠지고 카드 더미를 섞습니다",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "2단계가 시작되기 전에 3단계 카드가 뽑히면 먼저 2단계가 자체 준비와 함께 시작되고, 곧바로 3단계가 이어집니다"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "2단계가 시작되기 전에 3단계 카드가 뽑히면 먼저 2단계가 자체 준비와 함께 시작되고, 곧바로 3단계가 이어집니다",
"Edit analysis money": "분석 자금 수정",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "현재 입찰액 이상인 0~9999 사이의 정수를 입력하세요.",
"Waiting for analysis update…": "분석 업데이트 대기 중…",
"Analysis money update failed. Please try again.": "분석 자금 업데이트에 실패했습니다. 다시 시도하세요.",
"Save": "저장",
"Close and refresh": "닫고 새로고침",
"Closing refreshes the board but does not cancel the submitted edit.": "닫으면 보드가 새로고침되지만 제출한 수정은 취소되지 않습니다."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Kerncentrales mogen alleen worden gekocht door spelers met minstens één stad in Tsjechië, Slowakije of Hongarije. Spelers met steden alleen in Polen of Oostenrijk mogen niet bieden op of kerncentrales kopen. Een speler met een stad in Wien betaalt $1 minder voor elk afval, maar nooit minder dan $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Bij de start verlaat de centrale met het laagste nummer de markt en wordt er een nieuwe getrokken",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Bij de start verlaten de stap 3-kaart en de centrale met het laagste nummer de markt en wordt de trekstapel geschud",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Als de stap 3-kaart wordt getrokken voordat stap 2 is begonnen, begint eerst stap 2, met zijn eigen voorbereiding, en volgt stap 3 direct daarna"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Als de stap 3-kaart wordt getrokken voordat stap 2 is begonnen, begint eerst stap 2, met zijn eigen voorbereiding, en volgt stap 3 direct daarna",
"Edit analysis money": "Analysegeld bewerken",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Voer een geheel getal van 0 tot 9999 in, niet lager dan het openstaande bod.",
"Waiting for analysis update…": "Wachten op analyse-update…",
"Analysis money update failed. Please try again.": "Bijwerken van analysegeld mislukt. Probeer opnieuw.",
"Save": "Opslaan",
"Close and refresh": "Sluiten en vernieuwen",
"Closing refreshes the board but does not cancel the submitted edit.": "Sluiten vernieuwt het bord maar annuleert de ingediende wijziging niet."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Elektrownie jądrowe mogą kupować tylko gracze z co najmniej jednym miastem w Czechach, Słowacji lub na Węgrzech. Gracze z miastami tylko w Polsce lub Austrii nie mogą licytować ani kupować elektrowni jądrowych. Gracz z miastem w Wiedeń płaci $1 mniej za każdą jednostkę śmieci, ale nigdy mniej niż $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Na jego początku elektrownia o najniższym numerze opuszcza rynek i dobierana jest nowa",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Na jego początku karta etapu 3 i elektrownia o najniższym numerze opuszczają rynek, a talia zostaje przetasowana",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Jeśli karta etapu 3 zostanie dobrana przed rozpoczęciem etapu 2, najpierw rozpoczyna się etap 2, z własnym przygotowaniem, a zaraz po nim następuje etap 3"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Jeśli karta etapu 3 zostanie dobrana przed rozpoczęciem etapu 2, najpierw rozpoczyna się etap 2, z własnym przygotowaniem, a zaraz po nim następuje etap 3",
"Edit analysis money": "Edytuj pieniądze w analizie",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Wpisz liczbę całkowitą od 0 do 9999, nie mniejszą niż bieżąca oferta.",
"Waiting for analysis update…": "Oczekiwanie na aktualizację analizy…",
"Analysis money update failed. Please try again.": "Aktualizacja pieniędzy nie powiodła się. Spróbuj ponownie.",
"Save": "Zapisz",
"Close and refresh": "Zamknij i odśwież",
"Closing refreshes the board but does not cancel the submitted edit.": "Zamknięcie odświeża planszę, ale nie anuluje wysłanej zmiany."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Usinas nucleares só podem ser compradas por jogadores com pelo menos uma cidade na Tchéquia, Eslováquia ou Hungria. Jogadores com cidades apenas na Polônia ou Áustria não podem dar lances nem comprar usinas nucleares. Um jogador com uma cidade em Viena paga $1 a menos por cada lixo, mas nunca menos de $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Quando começa, a usina de menor número sai do mercado e uma nova é comprada",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Quando começa, a carta da Etapa 3 e a usina de menor número saem do mercado, e o baralho é embaralhado",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Se a carta da Etapa 3 for comprada antes do início da Etapa 2, a Etapa 2 começa primeiro, com sua própria preparação, e a Etapa 3 vem logo em seguida"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Se a carta da Etapa 3 for comprada antes do início da Etapa 2, a Etapa 2 começa primeiro, com sua própria preparação, e a Etapa 3 vem logo em seguida",
"Edit analysis money": "Editar dinheiro da análise",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Digite um inteiro de 0 a 9999, não inferior ao lance em aberto.",
"Waiting for analysis update…": "Aguardando atualização da análise…",
"Analysis money update failed. Please try again.": "Falha ao atualizar o dinheiro da análise. Tente novamente.",
"Save": "Salvar",
"Close and refresh": "Fechar e atualizar",
"Closing refreshes the board but does not cancel the submitted edit.": "Fechar atualiza o tabuleiro, mas não cancela a alteração enviada."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Centralele nucleare pot fi achiziționate doar de jucătorii cu cel puțin un oraș în Cehia, Slovacia sau Ungaria. Jucătorii cu orașe doar în Polonia sau Austria nu pot licita sau cumpăra centrale nucleare. Un jucător cu un oraș în Wien plătește cu $1 mai puțin pentru fiecare gunoi, dar niciodată mai puțin de $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "La începutul ei, centrala cu numărul cel mai mic părăsește piața și se trage una nouă",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "La începutul ei, cartea de Etapa 3 și centrala cu numărul cel mai mic părăsesc piața, iar teancul se amestecă",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Dacă cartea de Etapa 3 este trasă înainte de începerea Etapei 2, Etapa 2 începe prima, cu propria pregătire, iar Etapa 3 urmează imediat după"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Dacă cartea de Etapa 3 este trasă înainte de începerea Etapei 2, Etapa 2 începe prima, cu propria pregătire, iar Etapa 3 urmează imediat după",
"Edit analysis money": "Editează banii din analiză",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Introdu un număr întreg de la 0 la 9999, cel puțin egal cu oferta curentă.",
"Waiting for analysis update…": "Se așteaptă actualizarea analizei…",
"Analysis money update failed. Please try again.": "Actualizarea banilor a eșuat. Încearcă din nou.",
"Save": "Salvează",
"Close and refresh": "Închide și reîmprospătează",
"Closing refreshes the board but does not cancel the submitted edit.": "Închiderea reîmprospătează tabla, dar nu anulează modificarea trimisă."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Атомные станции могут покупать только игроки, у которых есть хотя бы один город в Чехии, Словакии или Венгрии. Игроки, у которых города только в Польше или Австрии, не могут торговаться за атомные станции или покупать их. Игрок с городом в Вена платит за каждую единицу мусора на $1 меньше, но никогда не меньше $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "В начале этапа станция с наименьшим номером покидает рынок и вытягивается новая",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "В начале этапа карта этапа 3 и станция с наименьшим номером покидают рынок, а колода перемешивается",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Если карта этапа 3 вытянута до начала этапа 2, сначала начинается этап 2 со своей подготовкой, а сразу за ним следует этап 3"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Если карта этапа 3 вытянута до начала этапа 2, сначала начинается этап 2 со своей подготовкой, а сразу за ним следует этап 3",
"Edit analysis money": "Изменить деньги в анализе",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Введите целое число от 0 до 9999, не меньше текущей ставки.",
"Waiting for analysis update…": "Ожидание обновления анализа…",
"Analysis money update failed. Please try again.": "Не удалось обновить деньги в анализе. Попробуйте снова.",
"Save": "Сохранить",
"Close and refresh": "Закрыть и обновить",
"Closing refreshes the board but does not cancel the submitted edit.": "Закрытие обновляет поле, но не отменяет отправленное изменение."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "Nhà máy hạt nhân chỉ được mua bởi người chơi có ít nhất một thành phố ở Séc, Slovakia hoặc Hungary. Người chơi chỉ có thành phố ở Ba Lan hoặc Áo không được trả giá hoặc mua nhà máy hạt nhân. Người chơi có thành phố ở Wien trả ít hơn $1 cho mỗi đơn vị rác, nhưng không bao giờ dưới $1.",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "Khi bắt đầu, nhà máy có số nhỏ nhất rời khỏi thị trường và một nhà máy mới được rút",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "Khi bắt đầu, lá Giai đoạn 3 và nhà máy có số nhỏ nhất rời khỏi thị trường, và chồng bài được xáo trộn",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Nếu lá Giai đoạn 3 được rút trước khi Giai đoạn 2 bắt đầu, Giai đoạn 2 bắt đầu trước, với phần chuẩn bị riêng, và Giai đoạn 3 tiếp nối ngay sau đó"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "Nếu lá Giai đoạn 3 được rút trước khi Giai đoạn 2 bắt đầu, Giai đoạn 2 bắt đầu trước, với phần chuẩn bị riêng, và Giai đoạn 3 tiếp nối ngay sau đó",
"Edit analysis money": "Chỉnh tiền trong phân tích",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "Nhập số nguyên từ 0 đến 9999, không thấp hơn giá đang đấu.",
"Waiting for analysis update…": "Đang chờ cập nhật phân tích…",
"Analysis money update failed. Please try again.": "Cập nhật tiền phân tích thất bại. Hãy thử lại.",
"Save": "Lưu",
"Close and refresh": "Đóng và làm mới",
"Closing refreshes the board but does not cancel the submitted edit.": "Đóng sẽ làm mới bàn chơi nhưng không hủy chỉnh sửa đã gửi."
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "只有在捷克、斯洛伐克或匈牙利拥有至少一座城市的玩家才能购买核电厂。城市全在波兰或奥地利的玩家不得竞拍或购买核电厂。在Wien拥有城市的玩家购买每个垃圾少付$1,但每个最低仍为$1。",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "开始时,编号最小的电厂离开市场,并抽取一座新电厂",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "开始时,步骤3卡和编号最小的电厂离开市场,并将抽牌堆洗混",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "如果在步骤2开始前抽到步骤3卡,则先开始步骤2并进行其自身的准备,随后立即进入步骤3"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "如果在步骤2开始前抽到步骤3卡,则先开始步骤2并进行其自身的准备,随后立即进入步骤3",
"Edit analysis money": "编辑分析资金",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "请输入0至9999的整数,且不低于当前出价。",
"Waiting for analysis update…": "正在等待分析更新…",
"Analysis money update failed. Please try again.": "分析资金更新失败。请重试。",
"Save": "保存",
"Close and refresh": "关闭并刷新",
"Closing refreshes the board but does not cancel the submitted edit.": "关闭会刷新棋盘,但不会取消已提交的修改。"
}

View file

@ -2050,5 +2050,12 @@
"Nuclear plants may only be purchased by players with at least one city in Czechia, Slovakia or Hungary. Players with cities only in Poland or Austria may not bid on or buy nuclear plants. A player with a city in Wien pays $1 less for each garbage, but never less than $1.": "核電廠只能由在捷克、斯洛伐克或匈牙利至少擁有一座城市的玩家購買。只在波蘭或奧地利擁有城市的玩家不得競標或購買核電廠。在 維也納 擁有城市的玩家購買每個垃圾少付 $1,但每個最低仍為 $1。",
"When it starts, the smallest power plant leaves the market and a new one is drawn": "開始時,編號最低的電廠離開市場,並抽取一座新電廠",
"When it starts, the Step 3 card and the smallest power plant leave the market, and the draw pile is shuffled": "開始時,第三階段卡與編號最低的電廠離開市場,並將牌庫洗牌",
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "若在第二階段開始前抽到第三階段卡,則先進入第二階段並進行其本身的準備,隨後立即進入第三階段"
"If the Step 3 card is drawn before Step 2 has begun, Step 2 begins first, with its own setup, and Step 3 follows straight after": "若在第二階段開始前抽到第三階段卡,則先進入第二階段並進行其本身的準備,隨後立即進入第三階段",
"Edit analysis money": "編輯分析資金",
"Enter a whole number from 0 to 9999, not below the outstanding bid.": "請輸入0至9999的整數,且不低於目前出價。",
"Waiting for analysis update…": "正在等待分析更新…",
"Analysis money update failed. Please try again.": "分析資金更新失敗。請重試。",
"Save": "儲存",
"Close and refresh": "關閉並重新整理",
"Closing refreshes the board but does not cancel the submitted edit.": "關閉會重新整理棋盤,但不會取消已提交的修改。"
}

View file

@ -1,5 +1,6 @@
import { cloneDeep } from 'lodash';
import { Move, Phase, setup, stripSecret } from 'powergrid-engine';
import { isAnalysisMoneyCommand } from 'powergrid-engine/src/analysis-money';
import type { GameState, MapName, PowerPlantDeck, Variant } from 'powergrid-engine/src/gamestate';
import type { PremoveCommand } from 'powergrid-engine/src/premoves';
import { move as wrapperMove, moveAI as wrapperAI } from 'powergrid-engine/wrapper';
@ -77,13 +78,16 @@ function launchSelfContained(selector = '#app') {
offerUndo();
});
emitter.on('move', async (moves: Move[] | PremoveCommand) => {
emitter.on('move', async (moves) => {
// This standalone demo is a live game, never an analysis host.
if (Array.isArray(moves) && moves.some(isAnalysisMoneyCommand)) return;
const liveMoves = moves as Move[] | PremoveCommand;
setTimeout(async () => {
console.log('moves received', moves);
// Mimic the platform: replay the whole turn buffer from the last committed
// state; only keep (persist) the result once the turn is committed.
const newState = await wrapperMove(cloneDeep(gameState), moves, playerIndex);
const newState = await wrapperMove(cloneDeep(gameState), liveMoves, playerIndex);
console.log('new game state', newState);
if (newState.newTurn === false) {

View file

@ -0,0 +1,127 @@
import Game from '@/components/Game.vue';
import { expect } from 'chai';
import { setup } from 'powergrid-engine';
const options = (Game as any).options;
const valid = (ctx: any) => options.computed.validAnalysisMoney.get.call(ctx);
function context() {
const G = setup(3, { map: 'Germany', variant: 'recharged', showMoney: true }, 'money');
const sent: any[] = [];
const ctx: any = {
$nextTick: () => {},
G,
committedState: G,
preferences: { analysis: true },
player: G.currentPlayers[0],
turnMoves: [],
analysisMoneyTarget: 1,
analysisMoneyValue: '123',
analysisMoneyPending: false,
emitter: { emit: (...args: any[]) => sent.push(args) },
sent,
};
ctx.canEditAnalysisMoney = () => options.methods.canEditAnalysisMoney.call(ctx);
Object.defineProperty(ctx, 'validAnalysisMoney', { get: () => valid(ctx) });
return ctx;
}
describe('analysis money editor', () => {
it('requires an active controlled seat and a clean analysis position', () => {
expect(context().canEditAnalysisMoney()).to.equal(true);
for (const patch of [
{ preferences: {} },
{ player: undefined },
{ player: 99 },
{ paused: true },
{ interactionDisabled: true },
{ roundPlan: {} },
{ turnMoves: [{}] },
{ pendingPlanId: 'x' },
{ changingBid: true },
{ poweringSubmitting: true },
{ undoRequested: true },
{ recentLocalUndo: true },
{ analysisMoneyPending: true },
{ tutorialMove: () => {} },
{ committedState: null },
]) {
expect(Object.assign(context(), patch).canEditAnalysisMoney()).to.equal(false);
}
const ctx = context();
ctx.G.currentPlayers = [];
expect(ctx.canEditAnalysisMoney()).to.equal(false);
ctx.G.currentPlayers = [ctx.player];
ctx.G.newTurn = false;
expect(ctx.canEditAnalysisMoney()).to.equal(false);
});
it('validates bounds and outstanding, but not stale, bids', () => {
const ctx = context();
for (const value of ['', ' ', '-1', '0.5', '10000', '9007199254740992', 'NaN', 'Infinity']) {
ctx.analysisMoneyValue = value;
expect(valid(ctx), value).to.equal(false);
}
for (const value of ['0', '9999', '50']) {
ctx.analysisMoneyValue = value;
expect(valid(ctx)).to.equal(true);
}
ctx.G.players[1].bid = 60;
ctx.analysisMoneyValue = '50';
expect(valid(ctx)).to.equal(true);
ctx.G.chosenPowerPlant = ctx.G.actualMarket[0];
expect(valid(ctx)).to.equal(false);
ctx.analysisMoneyValue = '60';
expect(valid(ctx)).to.equal(true);
});
it('emits one standalone command for any seat without changing state or buffer', () => {
for (const target of [0, 1, 2]) {
const ctx = context();
ctx.analysisMoneyTarget = target;
const before = JSON.stringify(ctx.G);
options.methods.saveAnalysisMoney.call(ctx);
options.methods.saveAnalysisMoney.call(ctx);
expect(ctx.sent).to.deep.equal([
['move', [{ name: 'SetAnalysisMoney', data: { player: target, money: 123 } }]],
]);
expect(JSON.stringify(ctx.G)).to.equal(before);
expect(ctx.turnMoves).to.deep.equal([]);
}
});
it('explicitly refreshes after silent host failure without retrying or unlocking locally', () => {
const ctx = context();
ctx.cancelAnalysisMoney = () => options.methods.cancelAnalysisMoney.call(ctx);
const before = JSON.stringify(ctx.G);
options.methods.saveAnalysisMoney.call(ctx);
// Actual BGS rejection sends neither move:result nor state.
options.methods.closeAnalysisMoney.call(ctx);
expect(ctx.analysisMoneyTarget).to.equal(null);
expect(ctx.analysisMoneyPending).to.equal(true);
expect(ctx.canEditAnalysisMoney()).to.equal(false);
expect(ctx.sent).to.deep.equal([
['move', [{ name: 'SetAnalysisMoney', data: { player: 1, money: 123 } }]],
['fetchState'],
]);
expect(JSON.stringify(ctx.G)).to.equal(before);
expect(ctx.turnMoves).to.deep.equal([]);
});
it('cancels an unsent edit without refreshing', () => {
const ctx = context();
ctx.cancelAnalysisMoney = () => options.methods.cancelAnalysisMoney.call(ctx);
options.methods.closeAnalysisMoney.call(ctx);
expect(ctx.analysisMoneyTarget).to.equal(null);
expect(ctx.sent).to.deep.equal([]);
});
it('does not submit invalid or stale dialogs and unlocks only matching rejected commands', () => {
const ctx = context();
ctx.analysisMoneyValue = '-1';
options.methods.saveAnalysisMoney.call(ctx);
expect(ctx.sent).to.have.length(0);
ctx.analysisMoneyValue = '50';
ctx.preferences.analysis = false;
options.methods.saveAnalysisMoney.call(ctx);
expect(ctx.sent).to.have.length(0);
ctx.analysisMoneyPending = true;
options.methods.onAnalysisMoneyResult.call(ctx, { ok: false, move: [{ name: 'Pass' }] });
expect(ctx.analysisMoneyPending).to.equal(true);
options.methods.onAnalysisMoneyResult.call(ctx, { ok: false, move: [{ name: 'SetAnalysisMoney' }] });
expect(ctx.analysisMoneyPending).to.equal(false);
expect(ctx.analysisMoneyError).to.be.a('string');
});
});