Skip to content

Conversation

@lox
Copy link
Owner

@lox lox commented Nov 12, 2025

Improves hand-history mode for bot testing and debugging by showing all players' hole cards from the start of each hand, and displaying bot names instead of IDs throughout the output.

Changes

Hole Cards Visibility

  • Added HoleCards field to HandPlayer struct for passing cards to monitors
  • Updated hand runner to pass hole cards in OnHandStart callback
  • Modified pretty monitor to display all players' hole cards in the "HOLE CARDS" section

Consistent Bot Naming

  • Changed OnHandStart to use bot.DisplayName() instead of bot.ID
  • Bot names now appear consistently in:
    • Table header (seat listings)
    • Action descriptions
    • Summary section

Motivation

The spawn subcommand is primarily used for testing and troubleshooting bots. In the previous implementation, hole cards were only shown at showdown (like in real poker), which made it difficult to understand why bots made certain decisions during the hand.

Additionally, bot IDs (like 5fd3de2c) appeared in the header and actions, while bot names (like aragorn-dev, complex-bot-1) only appeared in the summary, creating inconsistent and confusing output.

Example Output

Before:

Seat 1: 38beb3a5 (button) (1000 in chips)
...
*** HOLE CARDS ***
38beb3a5 (BTN): raises 20
...
*** SUMMARY ***
Seat 1: aragorn-dev (button) showed Q♣ K♠ and won

After:

Seat 1: aragorn-dev (button) (1000 in chips)
...
*** HOLE CARDS ***
Dealt to aragorn-dev Q♣ K♠
Dealt to complex-bot-1 7♣ J♥
aragorn-dev (BTN): raises 20
...
*** SUMMARY ***
Seat 1: aragorn-dev (button) showed Q♣ K♠ and won

Testing

  • ✅ All tests passing
  • ✅ No race conditions
  • ✅ Verified hole cards appear for all players
  • ✅ Verified bot names consistent throughout output

Improves hand-history mode for bot testing and debugging by showing all
players' hole cards from the start of each hand, and displaying bot names
instead of IDs throughout.

Changes:
- Add HoleCards field to HandPlayer struct for passing cards to monitors
- Update hand runner to pass hole cards and display names in OnHandStart
- Modify pretty monitor to display all players' hole cards in the
  "HOLE CARDS" section
- Use bot.DisplayName() instead of bot.ID for consistent naming

This makes it much easier to understand bot decision-making when reviewing
hands, as you can see what everyone was holding from the start rather than
only at showdown.

Example output:
  *** HOLE CARDS ***
  Dealt to aragorn-dev Q♣ K♠
  Dealt to complex-bot-1 7♣ J♥
  Dealt to complex-bot-2 9♦ K♦

All names (aragorn-dev, complex-bot-1, etc.) now appear consistently in
headers, actions, and summary.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 322 to 331
for i, bot := range hr.bots {
player := hr.handState.Players[i]
displayName := bot.DisplayName()
if displayName == "" {
displayName = bot.ID // Fallback to ID if no display name
}
players[i] = HandPlayer{
Seat: i,
Name: bot.ID, // Use bot ID for stats tracking
Chips: hr.handState.Players[i].Chips,
Name: displayName,
Chips: player.Chips,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Using display names as HandPlayer.Name breaks stats indexing

Changing HandPlayer.Name to bot.DisplayName() means the OnHandStart callback now receives display names instead of the unique bot IDs StatsMonitor expects. StatsMonitor uses player.Name as the key for seatToBotID and detailedStats, but later reads and exposes detailed stats by bot ID (stats.BotID). After this change the keys no longer match, so VPIP/PFR data is never returned and multiple bots with the same display name overwrite each other. Consider keeping HandPlayer.Name as the stable ID and passing display names separately or updating StatsMonitor accordingly.

Useful? React with 👍 / 👎.

Addresses P1 feedback: using DisplayName as HandPlayer.Name broke stats
tracking because StatsMonitor uses player.Name as the stable key for
indexing bot statistics.

Changes:
- Add DisplayName field to HandPlayer struct for human-readable display
- Keep Name field as bot.ID for stable stats tracking (prevents stats
  key mismatches and duplicate display name conflicts)
- Update pretty monitor to use DisplayName for all display purposes
  (seat listings, hole cards, actions)

This ensures stats tracking works correctly while still showing friendly
bot names (aragorn-dev, complex-bot-1, etc.) consistently in hand-history
output.

Co-authored-by: chatgpt-codex-connector[bot]
@lox
Copy link
Owner Author

lox commented Nov 12, 2025

✅ Fixed the P1 stats tracking issue!

Problem: Using bot.DisplayName() as HandPlayer.Name broke StatsMonitor, which uses player.Name as the key for indexing bot statistics.

Solution: Added a separate DisplayName field to HandPlayer:

  • Name = bot.ID (stable key for stats tracking)
  • DisplayName = bot.DisplayName() (human-readable name for display)

Changes in commit 5206515:

  • Added DisplayName field to HandPlayer struct
  • Updated hand runner to pass both bot.ID (as Name) and bot.DisplayName() (as DisplayName)
  • Updated pretty monitor to use DisplayName for all display purposes

Verification:

  • ✅ All tests passing
  • ✅ Display names still appear correctly in output
  • ✅ Stats tracking uses stable bot IDs as keys

Thanks @chatgpt-codex-connector for catching this!

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lox lox merged commit 00f03ac into main Nov 12, 2025
4 checks passed
@lox lox deleted the feat/show-hole-cards-in-hand-history branch November 12, 2025 21:21
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.

2 participants