Skip to content

feat: implement LuckCalculator service#91

Open
nodots wants to merge 2 commits intofeat/4.6.4-RCfrom
feature/246-luck-calculation
Open

feat: implement LuckCalculator service#91
nodots wants to merge 2 commits intofeat/4.6.4-RCfrom
feature/246-luck-calculation

Conversation

@nodots
Copy link
Owner

@nodots nodots commented Jan 4, 2026

Summary

  • Implement LuckCalculator class for analyzing game luck
  • Calculate luck per roll: (actual equity) - (expected equity across all 21 dice combinations)
  • Classify rolls as joker/anti-joker/normal based on thresholds
  • Provide game-level analysis with per-player summaries
  • 15 unit tests (all passing)

How luck is calculated

  1. For each roll, get the best equity from gnubg-hints
  2. Calculate expected equity by averaging best equities across all 21 possible dice combinations
  3. Luck = actual equity - expected equity
  4. Positive luck = roll was better than average (joker if >= 0.1)
  5. Negative luck = roll was worse than average (anti-joker if <= -0.1)

Test plan

  • All 15 unit tests pass
  • TypeScript compilation passes

Closes part of nodots/nodots-backgammon#246

🤖 Generated with Claude Code

nodots and others added 2 commits January 4, 2026 13:50
Add luck calculation functionality:
- LuckCalculator class for analyzing game luck
- calculateRollLuck: computes luck for a single roll
- calculateExpectedEquity: averages equity across all 21 dice combinations
- classifyLuck: categorizes luck as joker/anti-joker/normal
- analyzeGame: full game luck analysis with player summaries
- ALL_DICE_COMBINATIONS constant with correct probabilities
- 15 unit tests (all passing)

Luck = (actual roll equity) - (expected equity across all rolls)
Positive luck = roll was better than average
Negative luck = roll was worse than average

Part of #246

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nodots nodots force-pushed the feat/4.6.4-RC branch 2 times, most recently from cff4e6e to 50618ed Compare January 30, 2026 21:42
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.

1 participant