Skip to content

Track exposed opponent racks#458

Merged
domino14 merged 7 commits intomasterfrom
track-exposed-opponent-racks
Mar 11, 2026
Merged

Track exposed opponent racks#458
domino14 merged 7 commits intomasterfrom
track-exposed-opponent-racks

Conversation

@domino14
Copy link
Owner

fix #456
fix #452 (duplicate)

domino14 and others added 7 commits March 10, 2026 00:11
When a phony is challenged off, the analyzer now tracks and uses the revealed
tiles when analyzing the opponent's next turn. This improves analysis accuracy
by passing known rack information to the Monte Carlo simmer and pre-endgame solver.

- Add KnownOppRack field to TurnAnalysis to record exposed tiles
- Add UseExposedOppRacks config flag (enabled by default)
- Extract and track exposed tiles from PHONY_TILES_RETURNED events
- Pass known opponent rack to simmer and PEG solver via SetKnownOppRack()
- Update protobuf definitions and generated code
- Add go:generate directive for protobuf compilation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Log when analyzing with known opponent rack from challenged phony
to make it easier to verify the feature is working.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When a phony containing blanks is challenged off, the blanks return to the
rack as undesignated (shown as '?' rather than the letter they were played as).
Use IntrinsicTileIdx() to convert blank-A to undesignated blank (0) so:
- Solvers receive undesignated blanks in the known opponent rack
- Display shows blanks as '?' (e.g., "?MERICA" not "aMERICA" or "AMERICA")

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Create AnalyzeSingleTurn method that can analyze a single turn without
running full game analysis. This function:
- Takes history, rules, and turn number
- Handles all turn analysis logic (phony detection, known opp rack, etc.)
- Can be called standalone or in a loop by AnalyzeGame

Refactored AnalyzeGame to use AnalyzeSingleTurn in its loop, eliminating
code duplication and making it easier to analyze individual turns.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add analyze-turn command to analyze a single turn in a loaded game without
running full game analysis. This is much faster for debugging or examining
specific positions.

Changes:
- Add AnalyzeSingleTurnFromHistory convenience wrapper in gameanalysis
- Add analyzeTurn shell command with -turn flag
- Add analyze-turn.txt help text
- Update usage-standard.txt to list all analysis commands

Usage: analyze-turn -turn <n>
where n is the 0-indexed event number from game history

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed analyze-turn to analyze the current turn (from sc.game.Turn())
instead of requiring a -turn parameter. This is much more intuitive:
- Navigate to a turn with 'n' and 'p'
- Run 'analyze-turn' to analyze that position

Updated help text to reflect this simpler usage.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
PrepareSim() was clearing knownOppRack to nil, so we need to call
SetKnownOppRack AFTER PrepareSim, not before. This fixes the bug where
the analyzer was not actually using the known opponent rack even though
it logged that it was.

Verified that the PEG solver does not have this issue - it does not
clear knownOppRack in its Init or Solve methods.

Also cleaned up excessive debug logging.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@domino14 domino14 merged commit 16336b4 into master Mar 11, 2026
2 checks passed
@domino14 domino14 deleted the track-exposed-opponent-racks branch March 11, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analyzer should take into account any played phonies analyzer should consider known tiles

1 participant