Gen 3 Baseline — Implementation Complete

# Gen 3 Baseline Implementation — Complete

## Date: 2026-06-12

## Summary

All 6 phases of the Gen 3 porting plan are complete. The `g3_postflop_rollout` strategy is registered, building, and playing profitably in simulations.

## Files Created/Modified

### New Files
- `holdem_bots/src/common/hand_range.rs` — Weighted 52×52 hand range matrix with `init_strong_hands`, `init_strong_draws`, `unset_low_ranking`
- `holdem_bots/src/common/player_model.rs` — Default reference player model (Early/Short/HU stages) with fold/bet probability methods
- `holdem_bots/src/cash/rollout_postflop_gen3.rs` — Gen 3 postflop strategy (~750 lines)
- `configs/bots/cash_gen3.toml` — Bot config using Gen 3 postflop
- `configs/sim_gen3_verify.toml` — 6-max simulation config

### Modified Files
- `holdem_bots/src/common/mod.rs` — Added `hand_range` and `player_model` modules
- `holdem_bots/src/common/hand_potential.rs` — Added `compute_vs_range`, `compute_hs_weighted`, `compute_hs_for_cards`, weighted accumulators
- `holdem_bots/src/cash/mod.rs` — Added `rollout_postflop_gen3` module
- `holdem_bots/src/assembly/registrations.rs` — Registered `g3_postflop_rollout` (now 15 strategies)

## Architecture

### Range-Weighted Equity (Gen 3 Core Innovation)
1. Build `strong_hands` range (top 20% by hs on board)
2. Build `strong_draws` range (flush draws + OESDs + overcards)
3. `ppot_vs_ranges` = ppot vs strong_hands
4. `npot_vs_ranges` = npot vs strong_draws
5. `hs` = uniform hand strength
6. `win_prob_vs_ranges = hs * (1 - npot_vs_ranges) + (1 - hs) * ppot_vs_ranges`

### Rust Nut-Aware Enhancements
- `nutpot_vs_ranges`, `rpot_vs_ranges` from `compute_vs_range`
- `draw_quality = nutpot / (nutpot + rpot + eps)`
- `adjusted_ppot = ppot * (0.7 + 0.3 * draw_quality)`
- Nut-aware win_prob: base EHS + nutpot bonus - rpot discount
- Raise safety gate: non-nut draws blocked when npot > 0.25

### Dynamic Thresholds (from Java)
- All thresholds use effective_m scaling
- Player model fold/bet probabilities for conti-bet and bluff decisions
- Check-raise trapping, rope-a-dope, semi-bluff logic ported

## Simulation Results (500 hands, 6-max, seed 123)

| Player | Hands | Won | Profit | BB/Hand |
|--------|-------|-----|--------|---------|
| FlockBot-1 | 500 | 35 | +20250 | +40.50 |
| Gen2V3-1 | 500 | 69 | +18395 | +36.79 |
| Gen2V3-2 | 500 | 55 | +12690 | +25.38 |
| Gen3-1 | 500 | 63 | +8895 | +17.79 |
| Gen3-2 | 500 | 56 | +3575 | +7.15 |
| ChumpBot-1 | 500 | 213 | -63805 | -127.61 |

## Key Finding

Gen 3 baseline is profitable (+7 to +18 BB/hand) but behind tuned V3 (+25 to +37 BB/hand). The gap is expected — V3 has been extensively parameter-swept, while Gen 3 uses raw Java thresholds.

## Bugs Fixed During Implementation

1. **`consider_fold_as_not_applicable = true` bug**: Initially set to true, causing modular strategy to skip Gen 3 when it wanted to fold. Fixed to false (default). This was the most impactful fix — went from -30 BB/hand to -0.75 BB/hand.

## Test Results
- All 308 existing tests pass
- 12 new hand_range tests
- 4 new hand_potential range tests
- 6 new player_model tests
- 2 registration tests updated (15 strategies)

## Next Steps
1. **Parameter sweep** Gen 3 config fields against V3 baseline
2. **Port missing tactics**: backAlleyMug, luringBet, fakeSemiBluff, scareCardHit
3. **Apply structural improvements** identified in prior analysis
4. **Add ICM support** for SNG compatibility
5. **Per-opponent tracking** (Gen 4 direction)

id: fa49458a016f4368ad4231e0f6dad416
parent_id: abc167de888d41bf9391c373e90dec8d
created_time: 2026-06-12T13:14:35.790Z
updated_time: 2026-06-22T15:54:32.735Z
is_conflict: 0
latitude: 0.00000000
longitude: 0.00000000
altitude: 0.0000
author: 
source_url: 
is_todo: 0
todo_due: 0
todo_completed: 0
source: joplin-desktop
source_application: net.cozic.joplin-desktop
application_data: 
order: 1781270075790
user_created_time: 2026-06-12T13:14:35.790Z
user_updated_time: 2026-06-12T13:15:05.046Z
encryption_cipher_text: 
encryption_applied: 0
markup_language: 1
is_shared: 0
share_id: 
conflict_original_id: 
master_key_id: 
user_data: 
deleted_time: 1782143672735
type_: 1