Files
pokerfreak/src/cfr/equity_run.rs
T
mmintelandClaude Opus 5.5 a7b32cf425 Add CFR preflop chart generator, frozen charts and lookup
Pure CFR+ core over a 169-class abstraction, push/fold and open/call/3-bet games,
Nash/Kuhn/plausibility/lookup tests, chartgen binary, frozen equity and charts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 13:05:07 +01:00

35 lines
1.2 KiB
Rust

//! A slice of the equity triangle, computed from scratch. The generator binary splits the
//! triangle over threads; each entry depends only on the seed and its own `(i, j)`, so the
//! concatenated result is identical however it is split.
use super::equity_matrix::{triangle_pairs, TRIANGLE_LEN};
use super::equity_pair::pair_equity;
use super::hand_class::class_exists;
use crate::fault::Fault;
use crate::variant::Rules;
use std::ops::Range;
/// Entries `range` of the triangle. Diagonal entries are exactly 5000; classes missing from the
/// deck are 0.
pub fn triangle_slice(
rules: &Rules,
seed: u64,
samples: u32,
range: Range<usize>,
) -> Result<Vec<u16>, Fault> {
let pairs = triangle_pairs();
let end = range.end.min(TRIANGLE_LEN);
let start = range.start.min(end);
pairs[start..end]
.iter()
.map(|(i, j)| {
let present = class_exists(rules.deck, *i) && class_exists(rules.deck, *j);
match (present, i == j) {
(false, _) => Ok(0),
(true, true) => Ok(5_000),
(true, false) => pair_equity(rules, seed, samples, *i, *j),
}
})
.collect()
}