Commit graph

22 commits

Author SHA1 Message Date
34a4f47402 Add zero state, disconnected overlay, game over confetti, and debug panel
- Zero state: bouncing dice + message when no game exists
- Disconnected: greyed overlay after 3 consecutive fetch failures,
  with retry countdown
- Game over: gold banner with winner name + confetti animation,
  detected from log ('WINS!') or single remaining player
- Debug panel: Ctrl+Shift+D toggles hidden panel with buttons to
  test all four states (zero, playing, gameover, disconnected, reset)
- Also fixed player panel to use p.number for current-turn matching
  and property ownership display
2026-02-21 11:08:06 +00:00
19fc56d982 Emit players in turn order, not registration order
The C code picks a starting player via dice roll but doesn't reorder
the player array. The parser now tracks _first_player_idx and rotates
the players list in get_state() so the UI shows them in actual turn
order.
2026-02-21 11:02:22 +00:00
7a4346a53f Fix trade race condition: move trade/roll decision to -- Command: handler
The root cause: checkpoint handler queued .trade via say_delayed, but
monop sends '-- Command:' before processing the trade. The old handler
reset in_trade and queued .roll, so both commands got sent.

Fix: checkpoint handler no longer sends commands. The -- Command:
prompt is where the bot decides to trade or roll, matching how monop
actually works (-- Command: is the interactive prompt).

Also: no trades while in jail (jail has no -- Command: before roll).

Updated all tests to reflect the new flow.
2026-02-21 10:55:33 +00:00
8bbadba7d9 Fix trade-in-jail bug: jail handler must not roll during active trade
Added guard in jail turn handler to skip rolling when in_trade is True.
The roll happens later when '-- Command:' arrives after trade completes.

Added 5 regression tests for the exact failing sequence.
2026-02-21 10:45:15 +00:00
d31a09e754 Fix trade logic in player bots
- Handle 'Which player do you wish to trade with?' prompt when
  in_trade is True (was silently returning, causing bot to roll
  during an active trade prompt)
- Simplify property trade offers to always say 'done' (cash-only
  trades) to avoid getting stuck on property list prompts
2026-02-21 10:42:57 +00:00
d2bd66ba78 Add game log to parser output for web viewer
Parser now accumulates log entries for key game events:
- Turn starts (checkpoint lines)
- Rolls, movement, passing GO
- Rent payments
- Card draws (with card text)
- Auctions, trades, resignations
- Jail (triple doubles, GO TO JAIL)
- Game start and winner

Log is capped at 100 entries in GameState, last 30 emitted in
get_state() to match what index.html expects.

Also synced plugin's monop_parser.py copy.
2026-02-21 10:30:53 +00:00
cceec64a7c Add ARCHITECTURE.md developer guide
Covers system goals, component design, directory structure,
testing strategies, and key design decisions for future agents.
2026-02-21 10:20:01 +00:00
7dadd1f37f Organize directory structure
- cardinal-plugin/ → plugins/ (matches Cardinal's plugin dir convention)
- index.html + game-state.json → site/
- OUTPUT_CATALOG.md → docs/
- Core Python files and tests stay flat (no import changes needed)
2026-02-21 10:16:49 +00:00
c8e5a83010 Add unit tests for autopilot players (32 tests), fix trade force=True and duplicate handler 2026-02-21 09:53:09 +00:00
0af3184590 Add random trading (~10% chance per turn, 50/50 accept/reject) 2026-02-21 09:46:29 +00:00
cab39ec2b2 Add autopilot test logs (2162 lines, successful 2-player game) 2026-02-21 09:39:17 +00:00
775bbde030 Fix mortgage flow: send ? for property list, done when solvent 2026-02-21 09:23:33 +00:00
2ffd7c3845 Add Cardinal player plugin + fix autopilot: force setup responses, suppress out-of-turn rolls, fix tax input, fix double-roll from -- Command handler 2026-02-21 09:17:42 +00:00
5aa96d2163 Add standalone autopilot players script 2026-02-21 08:57:10 +00:00
44b9ed1ab1 Fix: property ownership now tracked on buy and auction
- Direct buy: set property_owner when buy confirmed via checkpoint
- Auction: set property_owner when 'It goes to' parsed
- Historical log replay still passes (1551/1553)
2026-02-21 04:14:49 +00:00
2b022f15c3 Add Cardinal plugin for monop state tracking
- Watches channel messages via @event('irc.privmsg')
- Feeds to MonopParser, writes game-state.json on state change
- Commands: .monop [status|players|board|owned]
- Bundled monop_parser.py in plugin dir
- Standalone test passes
2026-02-21 03:54:59 +00:00
e604a32233 Add integration test - parser matches monop state perfectly (7/7 checks pass) 2026-02-21 03:50:08 +00:00
57aae01e1b Add monop parser and test suite - 1551/1553 checkpoints pass 2026-02-21 03:10:53 +00:00
ba4463dcc8 Re-add test data and reference files after reboot 2026-02-21 02:37:37 +00:00
6fae024a7c Add complete monop output catalog from C source 2026-02-21 01:42:51 +00:00
299c8bfa64 Fix game-state schema to match monop-irc 2026-02-21 01:37:59 +00:00
653308817d Initial: monop-board site files 2026-02-21 01:35:37 +00:00