Commit graph

8 commits

Author SHA1 Message Date
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
c8e5a83010 Add unit tests for autopilot players (32 tests), fix trade force=True and duplicate handler 2026-02-21 09:53:09 +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
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