Files
pokerfreak/src/cfr/push_fold_game.rs
T
mmintelandClaude Opus 5.5 09d2014c9e Merge rake-live (c8257b4): Mikro-Rake; chartgen --mikro = ohne Antes + Mikro-Rake, Fold-Rake
Ein Tabellenlauf fuer den Live-Mikro-Tisch (Absprache rake-live, Orchestrator):
- chartgen --mikro: Antes 0 UND ChartRake::Micro, fuer charts, multi, multi-deep
  und teilspiel. --ohne-ante und --rake mikro bleiben einzeln nutzbar.
- ChartRake::fold: ein durch Fold gewonnener Pot zahlt beim Mikro-Rake den
  Rake des gematchten Pots (live: 3-bet/fold 5,5 bb -> 0,5 bb). Gilt in allen
  sechs Spielen (open, open3, push/fold, push/fold3, multi, teilspiel).
  Measured/None: 0, also bit-identisch (eingefrorene Tabellen reproduzieren).
- generated_charts_short.rs: Renderer-Ausgabe zurueck (Leerzeichen).
- tests/chart_fold_rake.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:18:12 +01:00

58 lines
2.7 KiB
Rust

//! Game (a): push / fold, one caller.
//!
//! The first actor at `seat` jams `depth_bb` (effective stack, blinds 0.5 / 1) or folds. If the
//! players behind fold -- probability `field_folds(players_behind)` -- the big blind calls or
//! folds. Otherwise somebody behind wakes up with a hand of the top `WAKE_FRACTION` range and
//! calls: the jam then runs into that range at raw equity (blinds are dead money, pot
//! `2 * depth + 1.5`) and nobody decides anything.
//!
//! Decisions: `push` (player 0: fold / push) and `call` (player 1, the big blind: fold / call).
//! The same tree is the complete all-in-or-fold game (variant AOF): there every action is a jam.
use super::environment::Environment;
use super::hand_class::CLASS_COUNT;
use super::payoffs::all_in;
use super::seat::Seat;
use super::spot_params::{field_folds, BIG_BLIND, SMALL_BLIND};
use super::tree::{fold_leaf, Node, Payoff, Tree};
use super::wake_range::{equity_against, top_membership};
use super::spot_params::WAKE_FRACTION;
use crate::fault::Fault;
/// Smallest stack for which a jam is a raise at all.
const MIN_DEPTH: f64 = 1.5;
pub fn push_fold_tree(env: &Environment, seat: Seat, depth_bb: f64) -> Result<Tree, Fault> {
if !depth_bb.is_finite() || depth_bb < MIN_DEPTH {
return Err(Fault::Invalid { field: "depth_bb".into(), detail: "stack must be at least 1.5 bb".into() });
}
let s = depth_bb;
let dead = seat.dead_money() + env.antes;
let wake = equity_against(env, &top_membership(env, WAKE_FRACTION));
let wake_pot = 2.0 * s + SMALL_BLIND + BIG_BLIND + env.antes;
let wake_pot = wake_pot - env.rake.all_in(wake_pot);
let wake_payoff = Payoff::Own(wake.iter().map(|e| e * wake_pot - s).collect());
let r = field_folds(seat.players_behind());
// Built bottom-up; indices are fixed by push order.
let mut nodes: Vec<Node> = Vec::new();
let mut add = |node: Node| -> usize {
nodes.push(node);
nodes.len() - 1
};
let t_fold = add(Node::Terminal(Payoff::Flat(-seat.posted_blind())));
// The matched pot of a fold pays `ChartRake::fold` (only the micro rake has one).
let t_big_blind_folds =
add(Node::Terminal(fold_leaf(CLASS_COUNT, BIG_BLIND + dead, env.rake.fold(2.0 * BIG_BLIND + dead))));
let t_called = add(Node::Terminal(all_in(env, 2.0 * s + dead, s)));
let call = add(Node::Decision { player: 1, name: "call", children: vec![t_big_blind_folds, t_called] });
let pushed = if r < 1.0 {
let t_woken = add(Node::Terminal(wake_payoff));
add(Node::Chance(vec![(r, call), (1.0 - r, t_woken)]))
} else {
call
};
let root = add(Node::Decision { player: 0, name: "push", children: vec![t_fold, pushed] });
Ok(Tree { classes: CLASS_COUNT, chance: env.chance.joint(), nodes, root })
}