Commit graph

23 commits

Author SHA1 Message Date
a7064f9c53 Add optional Offshore Island expansion, bank UI, bots and achievements 2026-11-18 21:16:06 +00:00
24031837d9 Add Container final-state per-game achievements 2026-11-14 00:43:53 +00:00
daf3a1cc70 Let BGS replay the engine to an earlier position
BGS's undo against bots (and its admin replays) call replay(data, { to })
and expect logLength to then equal `to`, but replay ignored `to`: an undo
failed, or did nothing during an auction. With `to`, replay now rebuilds
the position after the first `to` visible log entries, from a deep copy.
Hidden-log moves all come after the visible log and are left out, so
replaying to the visible length of a running auction reopens it without
its sealed bids and bid-phase loans: the human and the bots bid again.
That position is a regular turn, not a live update (BGS then lets the bots
due play), with no announcements left. Without `to`, the full replay is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 12:00:03 +02:00
4578009179 feat: allow revising pending sealed auction bids 2026-10-05 01:36:02 +02:00
8ccc2a1396 Publish auction journal improvements and Supporter badges 2026-10-01 23:56:32 +02:00
925cacfa55 Fail closed when public cash cannot be reconstructed 2026-09-27 19:22:40 +02:00
a2c2439425 Simulate private state for ongoing analysis 2026-09-27 19:14:27 +02:00
4a8dbc0feb fix: preserve mobile scrolling and cancel reversed loan moves 2026-09-27 09:20:39 +02:00
8664228bc8 Support translated chat and platform analysis defaults 2026-09-21 20:32:09 +02:00
30cdb46757 Support saved analyses of finished Container games 2026-09-21 15:30:16 +02: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
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
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
95a7522c3d ✨ (engine) Export moveAI for bot players 2026-08-12 21:40:04 +02:00
coyotte508
297815defa ✨ (engine) Expose player colors to BGS 2021-10-23 09:06:50 +02:00
Lucas Mello
d5b8377bf7 🐛 (engine) Fix player not being dropped 2021-09-19 17:05:05 -03:00
Lucas Mello
560e272e49 ✨ (all) Simultaneous bids 2021-09-19 16:20:04 -03:00
coyotte508
074fe8c74e 🐛 (engine) Fix final rankings 2021-08-18 10:14:59 +02:00
Lucas Mello
7573169cfc Fix engine lint 2021-07-28 23:58:28 -03:00
Lucas Mello
664b470b12 Fix bug that sorted players by final score 2021-07-28 19:43:48 -03:00
coyotte508
50b57cb24d Add continuous integration 2021-07-04 00:06:50 +02:00
coyotte508
6c497e4778 Move engine code into engine subfolder 2021-07-03 21:23:00 +02:00
Renamed from wrapper.ts (Browse further)