Strategy Registry & Key Files

# Strategy Registry & Key Files

|---|---|
| `g1_short_stack_preflop` | Gen 1 | Push/fold preflop (≤25 BB) — removed from cash config, folds defer to G47 |
| `g1_big_stack_preflop` | Gen 1 | Hand-grouping preflop (≥25 BB) |
| `g1_short_stack_preflop_sng` | Gen 1 | SNG-specific push/fold |
| `g1_fold_micro_stack` | Gen 1 | Fold when micro-stacked in SNG |
| `g1_steal_from_inactive` | Gen 1 | Steal blinds from sitting-out players |
| `g1_sage_endgame` | Gen 1 | Nash HU push/fold (13×13 tables) |
| `g1_postflop_rules` | Gen 1 | Static rules postflop |
| `ng_preflop` | Gen 2/3 | 169-hand ranking table preflop (ported from Java PreFlopStrategyV1) |
| `g2_postflop_rollout` | Gen 2 | Original EHS postflop baseline |
| `g2_postflop_rollout_v4` | Gen 2 | Nut-aware MC multi-way postflop (previous production) |
| `g2_nash_icm` | Gen 2 | Nash/ICM push/fold for SNG |
| `g2_ke_hu_nash` | Gen 2 | KEHU20BB Nash HU equilibrium (ported from Java, 19 tables) |
| `g3_postflop_rollout` | Gen 3 | Range-aware equity postflop |
| `g4_adaptive_preflop` | Gen 4 | VPIP-adaptive NG preflop looseness |
| `g4_adaptive_postflop` | Gen 4 | Range-narrowing + observer-driven postflop — used by G45/G47 |
| `g45_playability_preflop` | Gen 4.5 | Playability-enhanced NG preflop |
| `g47_equity_preflop` | Gen 4.7 | PEM2 matrix equity preflop — **current production preflop** |
| `g48_formula_postflop` | Gen 4.8 | Formula-based postflop with observer ranges — **current production postflop** |
| `gen5_collect` | Gen 5 | RL data collector (Gen3 teacher + transition recorder) |
| `gen5_collect_g48` | Gen 5 | RL collector with **G48 formula teacher** (teacher_postflop="formula") |
| `gen5_rl` | Gen 5 | RL model inference (candle MLP with Gen 4 teacher fallback) |
| `chump_bot` | Baseline | Calling station test opponent |
| `flock_bot` | Baseline | Tight-aggressive test opponent |
| `sng` | Legacy | Legacy SNG composite bot |

## Production Config Chain

**G48 Live** (`configs/bots/cash_nl_g48_live.toml`):
```
voting_mode = "first_applicable"

1. g47_equity_preflop     → preflop: PEM2 matrix equity + unified score
2. g48_formula_postflop   → postflop: formula score + observer ranges + MC 40K
```

**G47 Live** (`configs/bots/cash_nl_g47_live.toml`) — fallback:
```
voting_mode = "first_applicable"

1. g47_equity_preflop     → preflop: PEM2 matrix equity
2. g4_adaptive_postflop   → postflop: observer-driven range narrowing → Gen 3 equity
```

## G48 Scoring Formula

```
combined = value_score + ppot_weight × ppot
value_score = hs × (1 - npot_weight × npot) + nutredraw_weight × nutpot × (1 - hs) − behind_penalty_w × (1 − hs) × (1 − ppot)

call_threshold = (call_base + call_bs_weight × board_strength) / looseness × position_factor

Multiway cap: required_equity × (1 + margin)
  margin = 0.28/√opp (non-river), 0.15/√opp (river)
```

Live params: `sizing_base=0.33, bet_base=0.08, ppot_weight=0.75, npot_weight=0.10, behind_penalty_weight=0.15, call_base=0.42, call_bs_weight=0.12, narrow_board_hit_boost=3.0`

## Key Files

### Strategy Implementation
- `holdem_bots/src/gen4/equity_preflop.rs` — **G47 strategy** (PEM2 equity decisions, unified preflop score)
- `holdem_bots/src/gen4/formula_postflop.rs` — **G48 strategy** (formula-based postflop + observer ranges)
- `holdem_bots/src/gen4/adaptive.rs` — G45's adaptive postflop (reference for observer-based ranges)
- `holdem_bots/src/gen4/range_builder.rs` — `build_opponent_range_v2()`, `NarrowContext`, range construction
- `holdem_bots/src/gen4/observer.rs` — `Observer` — EMA-based opponent tracker
- `holdem_bots/src/gen4/profile.rs` — `PlayerStats`, `PlayerProfile`, three-tier blend, `call_raise_freq`
- `holdem_bots/src/gen4/storage.rs` — Profile persistence
- `holdem_bots/src/gen4/mod.rs` — Shared range-building helpers (`build_ranges_and_equity()`, `opponent_street_actions()`)
- `holdem_bots/src/gen4/preflop_equity_matrix.rs` — PEM2 matrix (load, generate, equity lookups)
- `holdem_bots/src/gen4/preflop_opening_range.rs` — Opening range visualization
- `holdem_bots/src/cash/rollout_postflop_base.rs` — shared postflop base (27 methods), `push_when_calling()`, `remaining_stack_share()`
- `holdem_bots/src/cash/rollout_postflop_gen3.rs` — `Gen3Equity`, `compute_gen3_equity`, `compute_equity_with_ranges`
- `holdem_bots/src/common/hand_potential.rs` — PotentialResult (hs, ppot, npot, nutpot, rpot, EHS)
- `holdem_bots/src/common/guardrails.rs` — Equity-based safety override system
- `holdem_bots/src/assembly/registrations.rs` — strategy registry
- `holdem_bots/src/cash/thresholds.rs` — PostflopThresholds struct (80+ fields)

### Gen 5
- `holdem_bots/src/gen5/features.rs` — 290-dim feature extraction
- `holdem_bots/src/gen5/actions.rs` — 11-discrete-action space + legality masking
- `holdem_bots/src/gen5/recorder.rs` — JSONL transition recorder
- `holdem_bots/src/gen5/rl_strategy.rs` — RL strategy (teacher fallback + model inference)
- `holdem_bots/src/gen5/network.rs` — Candle MLP policy (behind `gen5_nn` feature)

### SNG
- `holdem_bots/src/sng/ke_hu_nash.rs` — KEHU20BB Nash HU equilibrium
- `holdem_bots/src/sng/ke_hu_tables.rs` — 19 embedded Nash tables

### Configs
- `configs/bots/cash_nl_g48.toml` — G48 sim config
- `configs/bots/cash_nl_g48_live.toml` — G48 live config (MC 40K budget)
- `configs/bots/cash_nl_g47_live.toml` — G47 live config (fallback)
- `configs/bots/cash_nl_g47.toml` — G47 config (G47 preflop + G4 adaptive postflop)
- `configs/bots/cash_nl_g45.toml` — G45 config
- `configs/live_bots.toml` — bot auto-detection profiles
- `configs/live_server.toml` — live_server gateway config

### Live Integration
- `poker_protocol/src/lib.rs` — canonical wire types
- `poker_protocol/src/events.rs` — `TableEvent` event-stream protocol
- `live_server/src/main.rs` — Axum gateway bootstrap
- `live_server/src/bot_selection.rs` — profile → bot resolution
- `live_server/src/handlers.rs` — REST endpoints
- `live_server/src/session.rs` — per-table session registry
- `live_server/src/table_state.rs` — event → GameInfo state machine
- `live_server/src/adapter.rs` — engine Action → BotAction mapping

### Other
- `hand_replay/` — hand replay engine for regression testing
- `data/preflop_equity_matrix.bin` — PEM2 binary (~8.7 MB, gitignored)
- `models/gen5_v4.safetensors` — trained Gen 5 model
- `scripts/sanity_check.sh` — mandatory pre-live validation
- `scripts/sweep_g48*.sh` — G48 sweep scripts
- `scripts/sweep_unified_g47.sh`, `scripts/sweep_unified_g48.sh` — unified sweeps

### Userscript (separate project)
- `/home/jan/WebstormProjects/super-marvin-userscripts/` — TamperMonkey script
- `torn/dist/torn.user.js` — built output (v0.1.10)
- `torn/src/config.ts` — exports `DOM_DEBUG`, `DEFAULT_CONFIG`
- `torn/src/table_dom.ts` — DOM parsing
- `torn/src/index.ts`, `parser.ts`, `executor.ts`, `safety.ts`
- `shared/src/client.ts` — HTTP transport to `live_server`

id: 3073fa7641ab4c2f9cb9120a98eaa6e0
parent_id: 659da65d964344fc89e6b4eafac0098c
created_time: 2026-07-07T11:45:12.429Z
updated_time: 2026-07-17T04:43:24.330Z
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: 1783424712429
user_created_time: 2026-07-07T11:45:12.429Z
user_updated_time: 2026-07-17T04:43:24.330Z
encryption_cipher_text: 
encryption_applied: 0
markup_language: 1
is_shared: 0
share_id: 
conflict_original_id: 
master_key_id: 
user_data: 
deleted_time: 0
type_: 1