Commit graph

197 commits

Author SHA1 Message Date
0566dcaab3 ci: modernize workflows (node 24, pnpm 11), single workspace lockfile
The per-directory v5.3 lockfiles were stale against the 2.0.0 package.jsons and
unreadable by the workflows' pnpm 5 anyway; the root v9 workspace lockfile is
authoritative. Reformat sources for prettier-plugin-organize-imports v3 and
ignore build artifacts.
2026-08-17 09:55:09 +00:00
1278df32e4 viewer: make the log modal readable in dark mode
The modal kept its own light backgrounds (#fefefe content, #ccc/#fff log
rows) but let the text color inherit from the page, so the platform's dark
mode rendered it white-on-gray. Pin an explicit dark text color on
.modal-content — the viewer styles everything else with fixed colors too —
so the log (and the other modals) are readable in both themes.
2026-08-17 09:50:30 +00:00
7a54e8e2dd viewer: don't re-apply matching tentative echoes
After a drag-drop the viewer paints a local preview of the move synchronously,
then the server's tentative echo of the same turn buffer arrived a few hundred
ms later and went through replaceState again. Rebuilding every piece while the
drop animation was still in flight made the piece show at its destination
instantly while also tweening there from the drop point. Matching echoes now
short-circuit like stale ones already did — they only trigger the move sound,
which used to be the echo replace's job (local previews are silent).

Also delay the self-contained harness's tentative echo by 300ms so it lands
mid-animation like on the real platform instead of masking such races.
2026-08-17 09:50:20 +00:00
1b6d749e31 viewer: apply preference toggles immediately
The preferences object handed to Game as a prop was a plain object owned by
launch(), and Vue 2 does not deep-observe prop values coming from a
non-reactive parent. Toggling sound or the drag/drop help indicators mutated
an unobserved object, so the UI only caught up on the next unrelated
re-render (in practice: after a refresh). Make the object a Vue.observable
and merge platform preference pushes into it instead of replacing it, so both
the in-game toggles and platform updates paint immediately.
2026-08-17 09:50:03 +00:00
fd23b5c996 viewer: inline icons and audio into the built bundles
Production deploys upload only dist/container-viewer.umd.min.js and
dist/container-viewer.css to S3; the lib build emitted the toolbar icons to
dist/img/*.svg and the sounds to dist/media/* and referenced them by relative
URL, so they all 404'd on the platform (v2 worked only because jsdelivr served
the whole npm package). Swap the svg rule's file-loader for url-loader and
raise the images/media inline limits so every asset becomes a data URI inside
the two uploaded files.
2026-08-17 09:49:53 +00:00
f0c6f0bba0 Add Playwright MCP to gitignore 2026-08-17 08:27:41 +00:00
3f9d7d51b8 viewer: ignore tentative-state echoes that don't match the turn buffer
A move response's tentative state replaced the local preview
unconditionally. If the user had undone down to an empty buffer (which
re-emits nothing) or already made another move, a late echo transiently
showed a phantom or regressed move (and a wrong sidebar log) until the
next response landed.

Only accept a tentative state whose visible log extends the committed log
by exactly the buffered moves, in order — validated against the engine:
every tentative echo satisfies this (all tentative moves are visible-log
moves; bids and bid-phase loans go to the hidden log but commit
immediately and never take this path). Stale echoes are dropped; the echo
for the current buffer, if one is in flight, follows anyway.
2026-08-16 21:32:04 +00:00
511ce1728a engine!: remove the dead reconstructState export
Its only consumer was the wrapper's Undo handling, deleted when the
tentative-turn model replaced destructive undo; nothing in the engine or
the viewer sources references it anymore (full replays go through
wrapper.replay). Removing a public API is fine for the 2.0.0 major.
2026-08-16 21:31:01 +00:00
c72ebf77bd engine: seed upkeep container seizures from the game seed
Upkeep seizures picked containers with a bare Math.random, breaking the
platform guarantee that the same seed yields the same game and making
wrapper.replay diverge from the original whenever a seizure occurred
(seizures are log *events*, not moves, so nothing recorded the choice).

Seed a per-upkeep seedrandom stream from the persisted game seed plus the
visible log length — which uniquely identifies the upkeep within the game,
since each upkeep immediately follows its own Pass/Accept/Decline log
entry — so both live play and full replays reproduce the same seizures.

Typing removeRandom along the way exposed that warehouse/factory-store
seizure messages read .color on a ContainerOnStore (always undefined);
they now correctly read .piece.color.
2026-08-16 21:30:32 +00:00
46534ebd30 engine: stop dropPlayer from clobbering simultaneous bidders
dropPlayer unconditionally called nextPlayer, which resets currentPlayers
to a single player. During an auction (currentPlayers = all pending
bidders) dropping one bidder handed the turn to the auctioneer — who has
no available moves yet — wedging the game and discarding the other
bidders' pending turns. It also advanced the turn even when the dropped
player was not up at all, and skipped the next player's upkeep
(actions/available moves) in the move phase.

Now the drop auto-plays only the dropped player's own pending decision
through the regular engine path — Bid bash in the bid phase (including the
additional-bid round), Accept the highest bid as auctioneer, Pass in the
move phase — and touches nothing if the player is not up. The engine's
existing isDropped filters take care of skipping them afterwards.

Also make the highest-bid computation ignore dropped players' bids: a
dropped bidder's stale high bid used to poison Math.max, leaving
highestBidders empty and crashing the accept/decline phase.
2026-08-16 21:29:01 +00:00
501a33103c engine: replay hidden-log moves in wrapper.replay
A state saved mid-bid-phase keeps its newest moves (bids, bid-phase loans)
in G.hiddenLog — they are only flushed to G.log when the accept/decline
phase starts. replay() only walked G.log, so an admin full-replay of such
a save silently lost the bids and diverged.

Whenever hiddenLog is non-empty it holds exactly the moves made after the
last visible log entry, in order (the visible log freezes during the bid
phase), so replaying [...log, ...hiddenLog] reconstructs the state
faithfully. logSlice's truncated-log replay now explicitly drops the
hidden log, since it reconstructs a historical state predating it.
2026-08-16 21:27:11 +00:00
7c94bc75b7 engine: cover a 3-player auction bid tie with an additional-bid round
Scripted 3-player game into a simultaneous-bidders auction; asserts every
bid is a single-move committed turn, the tie opens an additional-bid round
among the tied bidders, bids stay in the hidden log until the tie resolves,
and the accept settles the right amounts.
2026-08-16 21:26:39 +00:00
e36715fedc engine: reject turn buffers that continue past a turn boundary
The whole-turn buffer is replayed from the committed state; committing is
what grants the mover their per-turn time increment. In the degenerate
all-others-dropped case a buffer like [..., Pass, ...more] is a sequence of
individually legal moves spanning several turns — it would commit them all
for a single increment. Throw as soon as a committed move is followed by
more buffer elements.

Also log an error when moveAI's 500-iteration force-commit safety net
fires, so a would-be livelock is visible in server logs instead of being
silently masked.

Tests: malformed buffer rejection (nothing half-applied leaks) and
multi-turn buffer rejection.
2026-08-16 21:26:05 +00:00
edfebe1b18 tests: cover the tentative-turn model
Engine (wrapper.spec.ts), simulating the platform (persist only what toSave
returns):

- mid-turn buffers are tentative (toSave undefined, nothing persisted) and
  the full turn commits when it completes
- bare move objects are accepted as one-element buffers; empty buffers are
  never saved
- undo-by-truncation: replaying a shortened buffer from the committed base
  equals never having made the popped move (including undoing to empty with
  no server call)
- scripted 2-player auction: sail-to-island commits immediately, a bid is a
  single-move committed turn, the auctioneer's mid-turn loan stays tentative,
  accept/decline commit and cannot be undone once control passes on
- the saved log length never shrinks across committed states
- moveAI always returns saveable states across a random 25-turn game;
  dropPlayer results are committed

Viewer: replace the dead example unit test (missing HelloWorld component)
with a real Calculator test so vue-cli-service test:unit passes.
2026-08-16 21:06:28 +00:00
6dc34d919c viewer: tentative-turn buffer instead of engine Undo moves
- Game.vue keeps turnMoves (the current turn's atomic moves) alongside the
  last committed state; every action emits the FULL buffer as the move
  payload, and the local preview replays the buffer with fake engine moves
- undo pops the buffer: re-emits the shortened turn if non-empty, or just
  resets the preview to the committed state with no server call (nothing was
  ever persisted for the turn)
- the buffer is cleared whenever a committed state (newTurn !== false)
  arrives from the platform, or when a local move completes the turn
- undo button availability = non-empty buffer (the Undo engine move is gone)
- launch.ts feeds the state embedded in move responses (logSlice().state) to
  the game — that's the only channel through which tentative states arrive —
  and falls back to fetchState otherwise
- self-contained dev mode mimics the platform: replays the buffer from the
  committed state and only persists committed results
- bump to 2.0.0 (pairs with container-engine 2.x)
2026-08-16 21:03:05 +00:00
f805997466 viewer: fix pre-existing build breakage
The viewer no longer compiled (bitrot surfaced by vue 2.7 + typescript 4.9 +
pnpm 11 strict hoisting):

- delete shims-tsx.d.ts: vue 2.7 ships its own JSX typings, ours duplicated
  the IntrinsicElements index signature
- type UIData.dragged structurally (Vue & { pieceType, pieceId }) instead of
  using a .vue module import as a type, which TS 4.9 rejects
- add csstype (vue's types import it; no longer hoisted) and @types/node +
  'node' in tsconfig types (self-contained.ts uses process.env)
2026-08-16 20:58:01 +00:00
da7491450c engine: replace destructive undo with tentative-turn model
- wrapper move() now accepts the whole current turn as a Move[] buffer
  (bare move objects still accepted) and replays it from the committed state
- new toSave(): returns undefined while the turn is tentative so the platform
  neither persists mid-turn states nor grants time increments for them
- engine tracks commitment in G.newTurn: tentative iff the last visible log
  entry is a move by a player still in currentPlayers; Pass/Accept/Decline/Bid
  always commit (bids and bid-phase loans live in the hidden log and were
  never undoable)
- delete MoveName.Undo entirely (move type, engine case, available-moves
  offerings): the saved log is now append-only
- wrapper moveAI() plays atomic moves until the turn commits (bot driver and
  dropPlayer auto-play require committed states); dropPlayer marks committed
- logSlice() now includes the stripped state so the acting player's viewer
  receives tentative states via the move response
- bump to 2.0.0 (new major: move payload shape changed, Undo removed)
2026-08-16 20:55:44 +00:00
c11163e3ff chore: unbreak tooling (pnpm 11 lockfile, dep build allow-list, organize-imports plugin)
- pnpm 11 rewrites the v5 lockfile on install and refuses to run unreviewed
  dependency build scripts; declare them explicitly (all disabled — everything
  installs and builds fine without them) so installs and the pre-commit hook pass
- upgrade prettier-plugin-organize-imports 1.x -> 3.x: the old version crashes
  against typescript 4.9 (host.fileExists is not a function), breaking lint-staged
- ignore the local .pnpm-store
2026-08-16 20:55:41 +00:00
github-actions
c6c69d7940 Engine v1.0.11
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.11
2026-08-12 20:11:41 +00:00
6482fd5032 🔧 Fix repository.url for npm OIDC provenance 2026-08-12 22:10:15 +02:00
5db663ef30
Update README.md 2026-08-12 22:05:05 +02:00
018c609016 Migrate CI to OIDC trusted publishing 2026-08-12 22:00:34 +02:00
fc8be2c90d
Merge pull request #8 from boardgamers/moon/container-expose-moveai
feat: export moveAI for bot players
2026-08-12 21:47:04 +02:00
95a7522c3d ✨ (engine) Export moveAI for bot players 2026-08-12 21:40:04 +02:00
github-actions
8d5195e227 Viewer v1.1.6
Some checks are pending
All / prettier (push) Waiting to run
v1.1.6
2021-12-01 22:58:57 +00:00
coyotte508
4c2a11c70c 📱 (viewer) Set max width 2021-12-01 23:42:27 +01:00
github-actions
1aff080a90 Viewer v1.1.5
Some checks are pending
All / prettier (push) Waiting to run
v1.1.5
2021-12-01 22:09:32 +00:00
coyotte508
9d8ca1e244 ✨ (viewer) Signal preference updates 2021-12-01 23:05:52 +01:00
github-actions
9d8a2b90b2 Engine v1.0.10
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.10
2021-10-23 13:04:05 +00:00
github-actions
402445a617 Engine v1.0.9
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.9
2021-10-23 07:20:49 +00:00
coyotte508
297815defa ✨ (engine) Expose player colors to BGS 2021-10-23 09:06:50 +02:00
github-actions
3632b8189d Viewer v1.1.4
Some checks are pending
All / prettier (push) Waiting to run
v1.1.4
2021-10-14 20:35:37 +00:00
coyotte508
182dbd120c 🐛 (viewer) Fix impossibility to move for player 0 2021-10-14 22:33:33 +02:00
coyotte508
fc00a499c5 ✨ (viewer) Enable loading game directly from json file 2021-10-14 22:23:29 +02:00
coyotte508
5f512b42c0 ✅ (engine) Add full game sample 2021-10-14 22:07:27 +02:00
github-actions
28a47099fa Viewer v1.1.3
Some checks are pending
All / prettier (push) Waiting to run
v1.1.3
2021-09-19 20:09:45 +00:00
github-actions
01128cca68 Engine v1.0.8
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.8
2021-09-19 20:06:43 +00:00
Lucas Mello
16865bffff Merge branch 'master' of https://github.com/boardgamers/container 2021-09-19 17:05:21 -03:00
Lucas Mello
d5b8377bf7 🐛 (engine) Fix player not being dropped 2021-09-19 17:05:05 -03:00
github-actions
35836692cd Viewer v1.1.2
Some checks are pending
All / prettier (push) Waiting to run
v1.1.2
2021-09-19 19:37:15 +00:00
github-actions
106f826e1e Engine v1.0.7
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.7
2021-09-19 19:31:45 +00:00
Lucas Mello
787dcd5722 🐛 (engine) fix bug where player could buy a fifth factory 2021-09-19 16:25:16 -03:00
Lucas Mello
f2852d3ea0 ✨ (viewer) Show confirmation dialog when sailing to island and bidding additional money 2021-09-19 16:23:47 -03:00
Lucas Mello
560e272e49 ✨ (all) Simultaneous bids 2021-09-19 16:20:04 -03:00
Lucas Mello
e98ed2048e 🐛 (viewer) Fix error when spectating 2021-09-19 13:45:26 -03:00
github-actions
5f6b9384a8 Engine v1.0.6
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.6
2021-08-18 08:16:25 +00:00
coyotte508
074fe8c74e 🐛 (engine) Fix final rankings 2021-08-18 10:14:59 +02:00
github-actions
01b8b9bdc6 Engine v1.0.5
Some checks are pending
Engine - Test / lint_and_test (push) Waiting to run
All / prettier (push) Waiting to run
v1.0.5
2021-08-15 11:54:46 +00:00
github-actions
2510484d4d Viewer v1.1.1
Some checks are pending
All / prettier (push) Waiting to run
v1.1.1
2021-08-15 11:39:49 +00:00
coyotte508
072b7fe2c8 🐛 (viewer) Fix preferences updating 2021-08-15 13:35:27 +02:00