Algorithmus-Hebel, alle bit-identisch (gleicher Seed -> gleiche Decision, Hand fuer Hand): - showdown: direkter 7-Karten-Bewerter ueber Farb-Lanes (erschoepfend gegen die Aufzaehlung geprueft: alle 5/6/7-Karten-Haende), Board-Lanes einmal pro Versuch, distinct als Bitmaske - range_filter: Filter pro Spec/Regeln/Board gecacht, Urteil pro Kartenpaar gemerkt - sample: Pool mit Positionstabelle (Swaps unveraendert), deal_combo ohne Suche - monte_carlo: kein Vec pro Versuch; range_combos: erst filtern, dann allozieren - straight_draw: Fenster einmal, Hold'em-Abkuerzung (erschoepfend gegen den Scan geprueft) Compiler: target-cpu=native in .cargo/config.toml (nur dieser Rechner; -8 %, identisch), [profile.mess] mit lto fat + codegen-units 1 fuer Messbinaries (-3 %, identisch). Beweise (messung_perf/BERICHT.md): - LBR Haende 0..20 Seed 7: 1157 s -> 29.2 s, Fingerabdruck 6c0a9a7645372cec (49 212 Aufrufe) gleich - LBR 6 Haende: Fingerabdruck 9754b5c8b2a54d12 gleich ueber jeden Zwischenschritt - ab_zelle reg/maniac/wert-sizer 100/200: 54.27 -> 16.44 CPU-s, Dateien byte-gleich - River-Solver-LBR (solver-ueberall3b5cee5, Budget unendlich): 207.7 -> 9.8 s, 63a7e9b3bd5b360b gleich, 8299 Antworten 0 Abweichungen; Patch messung_perf/solver-ueberall-perf.patch - cargo test --release: 1240 gruen; 10 rot wie auf HEAD5d4f939(Preflop-Charts, nicht von hier) Werkzeug: src/bin/perf_probe (Fingerabdruck, Dump, Sampler, Latenz p50/p99), werkzeuge/perf_symbole.py Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.5 KiB
Rust
38 lines
1.5 KiB
Rust
use super::range_filter::HandFilter;
|
|
use crate::card::{deck, Card};
|
|
use crate::equity::villain_range::VillainRange;
|
|
use crate::variant::Rules;
|
|
|
|
/// Every two-card hand outside `dead` that `filter` keeps, for direct sampling.
|
|
/// `None` for other hand sizes (too many to enumerate) or an empty range (the
|
|
/// simulation then falls back to the predicate and its documented fallback).
|
|
pub fn combos(rules: &Rules, filter: &HandFilter, dead: &[Card]) -> Option<Vec<Vec<Card>>> {
|
|
// Omaha (ab 4 Lochkarten): gesampelte konkrete Holdings statt voller Enumeration.
|
|
if rules.hole_cards >= 4 {
|
|
return super::omaha_combos::sample(rules, filter, dead);
|
|
}
|
|
if rules.hole_cards != 2 {
|
|
return None;
|
|
}
|
|
let pool = deck::without_in(rules.deck, dead);
|
|
let kept: Vec<Vec<Card>> = (0..pool.len())
|
|
.flat_map(|i| (i + 1..pool.len()).map(move |j| (i, j)))
|
|
.filter(|&(i, j)| filter(&[pool[i], pool[j]]))
|
|
.map(|(i, j)| vec![pool[i], pool[j]])
|
|
.collect();
|
|
(!kept.is_empty()).then_some(kept)
|
|
}
|
|
|
|
/// The simulation's view of each villain: the enumerated list where there is one,
|
|
/// the predicate otherwise.
|
|
pub fn as_ranges<'a>(filters: &'a [HandFilter], lists: &'a [Option<Vec<Vec<Card>>>]) -> Vec<VillainRange<'a>> {
|
|
filters
|
|
.iter()
|
|
.zip(lists)
|
|
.map(|(f, list)| match list {
|
|
Some(hands) => VillainRange::Combos(hands),
|
|
None => VillainRange::Filter(f.as_ref()),
|
|
})
|
|
.collect()
|
|
}
|