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.
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.
- 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
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.
- 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)