Konflikte: BEKANNTE_SCHALTER vereinigt; range_filter Kept mit Accept + Klassen-Kipp; RAISE_FOLD_DECKEL in sized_fold_on. Specs gruen (169 Test-Binaries). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
3.1 KiB
Rust
84 lines
3.1 KiB
Rust
//! Spec: shown hands tilt the river range per preflop class (plan D3, `ZEIGT_KIPP`).
|
|
//!
|
|
//! A `RangeSpec::class_target` thins the range so its preflop-class shares (`chen_class`) move to the
|
|
//! target: the I-projection onto that class marginal. Without a target the range is unchanged.
|
|
|
|
mod spot_fixture;
|
|
|
|
use rechner::card::{deck, Card};
|
|
use rechner::engine::range_filter::range_filter;
|
|
use rechner::exploit::range_spec::{chen_class, ClassTilt, Continuation, RangeSpec, CLASSES};
|
|
use rechner::read::made::Made;
|
|
use rechner::variant::{rules, Variant};
|
|
use spot_fixture::cards;
|
|
|
|
fn spec(target: Option<[f64; CLASSES]>, dir: i8) -> RangeSpec {
|
|
RangeSpec {
|
|
lo: 0.0,
|
|
hi: 0.7,
|
|
continues: vec![Continuation {
|
|
board_len: 5,
|
|
min_made: Made::BottomPair,
|
|
draws_continue: false,
|
|
min_draw: rechner::read::draw::Draw::Gutshot,
|
|
bluff_share: 0.2,
|
|
continue_share: None,
|
|
top_share: None,
|
|
min_strength: None,
|
|
likelihood: None,
|
|
}],
|
|
class_target: target.map(|target| ClassTilt { target, dir }),
|
|
}
|
|
}
|
|
|
|
fn shares_dir(target: Option<[f64; CLASSES]>, dir: i8) -> ([f64; CLASSES], usize) {
|
|
let board = cards("Kd 8s 4c 2h Jc");
|
|
let f = range_filter(&spec(target, dir), rules(Variant::Nlhe), Variant::Nlhe, &board);
|
|
let pool = deck::without(&board);
|
|
let mut n = [0.0; CLASSES];
|
|
let mut all = 0;
|
|
for i in 0..pool.len() {
|
|
for j in i + 1..pool.len() {
|
|
let h: [Card; 2] = [pool[i], pool[j]];
|
|
if f(&h) {
|
|
n[chen_class(&h)] += 1.0;
|
|
all += 1;
|
|
}
|
|
}
|
|
}
|
|
(n.map(|x| x / all as f64), all)
|
|
}
|
|
|
|
fn shares(target: Option<[f64; CLASSES]>) -> ([f64; CLASSES], usize) {
|
|
shares_dir(target, 0)
|
|
}
|
|
|
|
#[test]
|
|
fn the_kept_range_takes_the_target_class_shares() {
|
|
let (plain, n_plain) = shares(None);
|
|
let target = [0.05, 0.10, 0.35, 0.35, 0.15];
|
|
let (tilted, n_tilted) = shares(Some(target));
|
|
assert!(n_tilted < n_plain && n_tilted > 0, "thinned, not emptied: {n_plain} -> {n_tilted}");
|
|
for c in 0..CLASSES {
|
|
assert!((tilted[c] - target[c]).abs() < 0.04, "class {c}: {tilted:?} vs {target:?} (plain {plain:?})");
|
|
}
|
|
// the plain range's own shares as target: (almost) nothing is thinned
|
|
let (_, n_same) = shares(Some(plain));
|
|
assert!(n_same as f64 > 0.97 * n_plain as f64, "{n_same} of {n_plain}");
|
|
}
|
|
|
|
#[test]
|
|
fn a_directed_tilt_only_moves_the_range_its_way() {
|
|
let (plain, n_plain) = shares(None);
|
|
let weaker = [0.01, 0.03, 0.08, 0.28, 0.60];
|
|
let stronger = [0.15, 0.20, 0.25, 0.25, 0.15];
|
|
// -1 (passive line: only weaker): a weaker target tilts, a stronger one leaves the range as it is
|
|
let (w, n_w) = shares_dir(Some(weaker), -1);
|
|
assert!(n_w < n_plain && w[4] > plain[4] + 0.05, "{w:?} vs {plain:?}");
|
|
assert_eq!(shares_dir(Some(stronger), -1), (plain, n_plain));
|
|
// +1 (aggressive line: only stronger): the other way round
|
|
let (s, n_s) = shares_dir(Some(stronger), 1);
|
|
assert!(n_s < n_plain && s[0] > plain[0] + 0.05, "{s:?} vs {plain:?}");
|
|
assert_eq!(shares_dir(Some(weaker), 1), (plain, n_plain));
|
|
}
|