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>
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
//! Chart generator: the only place of the CFR work that touches the outside world.
|
||||
//!
|
||||
//! ```text
|
||||
//! cargo run --release --bin chartgen -- equity > src/cfr/generated_equity.rs
|
||||
//! cargo run --release --bin chartgen -- charts > src/preflop/generated_charts.rs
|
||||
//! ```
|
||||
//!
|
||||
//! Options: `--threads N` (default: all cores; the result never depends on it),
|
||||
//! `equity --samples N --seed S --deck full|short`, `charts --push-iterations N --open-iterations N`.
|
||||
//! Source text goes to stdout, progress to stderr. `equity --deck short` prints the table for the
|
||||
//! 36-card deck (81 classes; the rest of the 13 x 13 grid stays 0) once the evaluator is
|
||||
//! deck-aware; pipe it into a new `generated_equity_short.rs` and solve with
|
||||
//! `Environment::new(&rules(Variant::ShortDeck), ...)`.
|
||||
|
||||
use pokerfreak::cfr::environment::Environment;
|
||||
use pokerfreak::cfr::equity_matrix::TRIANGLE_LEN;
|
||||
use pokerfreak::cfr::equity_run::triangle_slice;
|
||||
use pokerfreak::cfr::frozen_spot::{OpenSpot, PushFoldSpot};
|
||||
use pokerfreak::cfr::render_charts::render_charts;
|
||||
use pokerfreak::cfr::render_equity::render_equity;
|
||||
use pokerfreak::cfr::run_plan::{
|
||||
open_plan, push_fold_plan, EQUITY_SAMPLES, EQUITY_SEED, OPEN_ITERATIONS, PUSH_FOLD_ITERATIONS,
|
||||
};
|
||||
use pokerfreak::cfr::spot_solver::{solve_open_spot_for, solve_push_fold_spot_for};
|
||||
use pokerfreak::fault::Fault;
|
||||
use pokerfreak::variant::{rules, Variant};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Mutex;
|
||||
use std::time::Instant;
|
||||
|
||||
/// `f(0..count)` on `threads` workers; the result order is the index order.
|
||||
fn parallel_map<T: Send>(count: usize, threads: usize, f: impl Fn(usize) -> T + Sync) -> Vec<T> {
|
||||
let next = AtomicUsize::new(0);
|
||||
let slots: Mutex<Vec<Option<T>>> = Mutex::new((0..count).map(|_| None).collect());
|
||||
std::thread::scope(|scope| {
|
||||
for _ in 0..threads.max(1) {
|
||||
scope.spawn(|| loop {
|
||||
let index = next.fetch_add(1, Ordering::SeqCst);
|
||||
if index >= count {
|
||||
break;
|
||||
}
|
||||
let value = f(index);
|
||||
if let Ok(mut guard) = slots.lock() {
|
||||
guard[index] = Some(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
slots.into_inner().unwrap_or_default().into_iter().flatten().collect()
|
||||
}
|
||||
|
||||
fn option<T: std::str::FromStr>(args: &[String], name: &str) -> Option<T> {
|
||||
args.iter().position(|a| a == name).and_then(|i| args.get(i + 1)).and_then(|v| v.parse().ok())
|
||||
}
|
||||
|
||||
fn threads(args: &[String]) -> usize {
|
||||
option(args, "--threads")
|
||||
.unwrap_or_else(|| std::thread::available_parallelism().map_or(1, |n| n.get()))
|
||||
}
|
||||
|
||||
fn equity(args: &[String]) -> Result<String, Fault> {
|
||||
let variant = match option::<String>(args, "--deck").as_deref() {
|
||||
Some("short") => Variant::ShortDeck,
|
||||
_ => Variant::Nlhe,
|
||||
};
|
||||
let rules = rules(variant);
|
||||
let seed: u64 = option(args, "--seed").unwrap_or(EQUITY_SEED);
|
||||
let samples: u32 = option(args, "--samples").unwrap_or(EQUITY_SAMPLES);
|
||||
let chunk = 64;
|
||||
let chunks = TRIANGLE_LEN.div_ceil(chunk);
|
||||
let started = Instant::now();
|
||||
eprintln!("equity: {TRIANGLE_LEN} class pairs x {samples} samples on {} threads", threads(args));
|
||||
let parts = parallel_map(chunks, threads(args), |k| {
|
||||
triangle_slice(&rules, seed, samples, k * chunk..(k + 1) * chunk)
|
||||
});
|
||||
let triangle: Vec<u16> = parts.into_iter().collect::<Result<Vec<_>, _>>()?.concat();
|
||||
eprintln!("equity: done in {:.1} s", started.elapsed().as_secs_f64());
|
||||
Ok(render_equity(seed, samples, &triangle))
|
||||
}
|
||||
|
||||
fn charts(args: &[String]) -> Result<String, Fault> {
|
||||
let env = Environment::frozen();
|
||||
let push_iterations: u32 = option(args, "--push-iterations").unwrap_or(PUSH_FOLD_ITERATIONS);
|
||||
let open_iterations: u32 = option(args, "--open-iterations").unwrap_or(OPEN_ITERATIONS);
|
||||
let (push_plan, open_plan) = (push_fold_plan(), open_plan());
|
||||
let started = Instant::now();
|
||||
eprintln!(
|
||||
"charts: {} push/fold + {} open spots on {} threads",
|
||||
push_plan.len(),
|
||||
open_plan.len(),
|
||||
threads(args)
|
||||
);
|
||||
let push: Vec<Result<PushFoldSpot, Fault>> = parallel_map(push_plan.len(), threads(args), |k| {
|
||||
let (seat, depth) = push_plan[k];
|
||||
solve_push_fold_spot_for(&env, seat, depth, push_iterations)
|
||||
});
|
||||
eprintln!("charts: push/fold done at {:.1} s", started.elapsed().as_secs_f64());
|
||||
let open: Vec<Result<OpenSpot, Fault>> = parallel_map(open_plan.len(), threads(args), |k| {
|
||||
let (seat, depth) = open_plan[k];
|
||||
solve_open_spot_for(&env, seat, depth, open_iterations)
|
||||
});
|
||||
eprintln!("charts: all done in {:.1} s", started.elapsed().as_secs_f64());
|
||||
let push = push.into_iter().collect::<Result<Vec<_>, _>>()?;
|
||||
let open = open.into_iter().collect::<Result<Vec<_>, _>>()?;
|
||||
Ok(render_charts(&push, &open))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let result = match args.first().map(String::as_str) {
|
||||
Some("equity") => equity(&args[1..]),
|
||||
Some("charts") => charts(&args[1..]),
|
||||
_ => {
|
||||
eprintln!("usage: chartgen equity|charts [--threads N] [options] (source goes to stdout)");
|
||||
std::process::exit(2);
|
||||
}
|
||||
};
|
||||
match result {
|
||||
Ok(source) => print!("{source}"),
|
||||
Err(fault) => {
|
||||
eprintln!("chartgen: {fault}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//! Exact chance weights between two hand classes, with card removal.
|
||||
//!
|
||||
//! The deal is "player 0 gets a combo, player 1 gets a combo disjoint from it", all ordered
|
||||
//! pairs equally likely. The weight of the class pair `(i, j)` is the number of such disjoint
|
||||
//! combo pairs, so a hand that blocks the opponent's cards (AA vs AKs) is counted exactly,
|
||||
//! not approximated. Probabilities are those counts over the grand total.
|
||||
|
||||
use super::hand_class::{class_combos, class_exists, CLASS_COUNT};
|
||||
use crate::card::Card;
|
||||
use crate::variant::DeckRule;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ChanceTable {
|
||||
deck: DeckRule,
|
||||
counts: Vec<u32>,
|
||||
total: u64,
|
||||
}
|
||||
|
||||
fn combos_in(deck: DeckRule, class: usize) -> Vec<[Card; 2]> {
|
||||
class_combos(class)
|
||||
.into_iter()
|
||||
.filter(|h| h.iter().all(|c| deck.contains(c.rank)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn chance_table(deck: DeckRule) -> ChanceTable {
|
||||
let combos: Vec<Vec<[Card; 2]>> = (0..CLASS_COUNT)
|
||||
.map(|c| if class_exists(deck, c) { combos_in(deck, c) } else { Vec::new() })
|
||||
.collect();
|
||||
let counts: Vec<u32> = (0..CLASS_COUNT * CLASS_COUNT)
|
||||
.map(|k| {
|
||||
let (a, b) = (&combos[k / CLASS_COUNT], &combos[k % CLASS_COUNT]);
|
||||
a.iter()
|
||||
.map(|x| b.iter().filter(|y| !x.iter().any(|c| y.contains(c))).count() as u32)
|
||||
.sum()
|
||||
})
|
||||
.collect();
|
||||
let total = counts.iter().map(|c| *c as u64).sum();
|
||||
ChanceTable { deck, counts, total }
|
||||
}
|
||||
|
||||
impl ChanceTable {
|
||||
pub fn deck(&self) -> DeckRule {
|
||||
self.deck
|
||||
}
|
||||
|
||||
/// Number of ordered disjoint combo pairs over all class pairs.
|
||||
pub fn total(&self) -> u64 {
|
||||
self.total
|
||||
}
|
||||
|
||||
/// Disjoint ordered combo pairs `(a in i, b in j)`; 0 outside the grid.
|
||||
pub fn disjoint_combos(&self, i: usize, j: usize) -> u32 {
|
||||
if i < CLASS_COUNT && j < CLASS_COUNT {
|
||||
self.counts[i * CLASS_COUNT + j]
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn probability(&self, i: usize, j: usize) -> f64 {
|
||||
if self.total == 0 {
|
||||
0.0
|
||||
} else {
|
||||
self.disjoint_combos(i, j) as f64 / self.total as f64
|
||||
}
|
||||
}
|
||||
|
||||
/// Number of combos of the class that exist in the deck.
|
||||
pub fn combos(&self, class: usize) -> u32 {
|
||||
if class_exists(self.deck, class) {
|
||||
combos_in(self.deck, class).len() as u32
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
/// All joint probabilities, row-major `[i * CLASS_COUNT + j]`.
|
||||
pub fn joint(&self) -> Vec<f64> {
|
||||
(0..CLASS_COUNT * CLASS_COUNT)
|
||||
.map(|k| self.probability(k / CLASS_COUNT, k % CLASS_COUNT))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//! The "argmax chart" of a strategy: for every decision node and class the most frequent action
|
||||
//! after rounding to permille (ties go to the lower action index). Two strategies with the same
|
||||
//! signature produce the same hard-decision chart.
|
||||
|
||||
use super::permille::to_permille;
|
||||
use super::strategy::Strategy;
|
||||
|
||||
pub fn signature(strategy: &Strategy) -> Vec<u8> {
|
||||
(0..strategy.node_count())
|
||||
.flat_map(|node| {
|
||||
(0..strategy.classes()).map(move |class| (node, class))
|
||||
})
|
||||
.filter(|(node, _)| strategy.action_count(*node) > 0)
|
||||
.map(|(node, class)| {
|
||||
let rounded = to_permille(strategy.row(node, class));
|
||||
rounded
|
||||
.iter()
|
||||
.enumerate()
|
||||
.fold((0usize, 0u16), |best, (a, p)| if *p > best.1 { (a, *p) } else { best })
|
||||
.0 as u8
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//! The Nash test's raw material: for every information set that can be reached, the value of
|
||||
//! each action while every other decision stays frozen.
|
||||
//!
|
||||
//! `value[a]` is conditional on arriving at the node with that hand class: the counterfactual
|
||||
//! value divided by the opponent-reach mass `sum_j chance(i, j) * opp_reach(j)`. `weight` is the
|
||||
//! probability of getting there at all, `own_reach(i) * mass(i)`; rows with tiny weight are
|
||||
//! allowed to be loose because their value is multiplied by that weight everywhere else.
|
||||
|
||||
use super::strategy::Strategy;
|
||||
use super::tree::Tree;
|
||||
use super::value_walk::{root_values, Responder};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Deviation {
|
||||
pub node: &'static str,
|
||||
pub player: usize,
|
||||
pub class: usize,
|
||||
pub weight: f64,
|
||||
pub frequency: Vec<f64>,
|
||||
pub value: Vec<f64>,
|
||||
}
|
||||
|
||||
impl Deviation {
|
||||
/// Expected value of the frozen mix at this information set.
|
||||
pub fn mix_value(&self) -> f64 {
|
||||
self.frequency.iter().zip(&self.value).map(|(f, v)| f * v).sum()
|
||||
}
|
||||
|
||||
/// How much better the best zero-frequency action is than the mix (0 if none is better).
|
||||
pub fn zero_frequency_gain(&self) -> f64 {
|
||||
let mix = self.mix_value();
|
||||
self.frequency
|
||||
.iter()
|
||||
.zip(&self.value)
|
||||
.filter(|(f, _)| **f == 0.0)
|
||||
.map(|(_, v)| v - mix)
|
||||
.fold(0.0, f64::max)
|
||||
}
|
||||
|
||||
/// How much worse than the mix the worst action played with >= 5 % is (0 if none is worse).
|
||||
pub fn support_shortfall(&self) -> f64 {
|
||||
let mix = self.mix_value();
|
||||
self.frequency
|
||||
.iter()
|
||||
.zip(&self.value)
|
||||
.filter(|(f, _)| **f >= 0.05)
|
||||
.map(|(_, v)| mix - v)
|
||||
.fold(0.0, f64::max)
|
||||
}
|
||||
}
|
||||
|
||||
/// One entry per decision node, hand class and acting player that has a defined conditional value.
|
||||
pub fn deviations(tree: &Tree, strategy: &Strategy) -> Vec<Deviation> {
|
||||
let n = tree.classes;
|
||||
let mut found = Vec::new();
|
||||
for player in 0..2 {
|
||||
let mut visit = |v: &super::value_walk::Visit| {
|
||||
for class in 0..n {
|
||||
let mass: f64 = (0..n)
|
||||
.map(|k| {
|
||||
let chance = if player == 0 { tree.chance[class * n + k] } else { tree.chance[k * n + class] };
|
||||
chance * v.opp[k]
|
||||
})
|
||||
.sum();
|
||||
if mass <= 0.0 {
|
||||
continue;
|
||||
}
|
||||
found.push(Deviation {
|
||||
node: v.name,
|
||||
player,
|
||||
class,
|
||||
weight: v.own[class] * mass,
|
||||
frequency: strategy.row(v.node, class).to_vec(),
|
||||
value: v.action_values.iter().map(|a| a[class] / mass).collect(),
|
||||
});
|
||||
}
|
||||
};
|
||||
root_values(tree, strategy, Responder::Follow, player, &mut visit);
|
||||
}
|
||||
found
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
//! Everything a game builder needs to know about the deck: rules, exact deal weights, the
|
||||
//! equity matrix and the strength order of the classes.
|
||||
|
||||
use super::chance_table::{chance_table, ChanceTable};
|
||||
use super::equity_matrix::EquityMatrix;
|
||||
use super::frozen_equity::frozen_equity;
|
||||
use super::hand_class::{classes_in, CLASS_COUNT};
|
||||
use crate::fault::Fault;
|
||||
use crate::variant::{rules, Rules, Variant};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Environment {
|
||||
pub rules: Rules,
|
||||
pub equity: EquityMatrix,
|
||||
pub chance: ChanceTable,
|
||||
/// Classes of the deck, strongest first: by all-in equity against a uniformly random hand.
|
||||
pub order: Vec<usize>,
|
||||
}
|
||||
|
||||
impl Environment {
|
||||
/// Two-card games only (the classes are two-card hands).
|
||||
pub fn new(rules: &Rules, equity: EquityMatrix) -> Result<Environment, Fault> {
|
||||
if rules.hole_cards != 2 {
|
||||
return Err(Fault::Invalid {
|
||||
field: "rules".into(),
|
||||
detail: "hand classes need exactly two hole cards".into(),
|
||||
});
|
||||
}
|
||||
let chance = chance_table(rules.deck);
|
||||
let vs_random = |c: usize| -> f64 {
|
||||
let (num, den) = (0..CLASS_COUNT).fold((0.0, 0.0), |(n, d), j| {
|
||||
let p = chance.probability(c, j);
|
||||
(n + p * equity.get(c, j), d + p)
|
||||
});
|
||||
if den > 0.0 {
|
||||
num / den
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
};
|
||||
let mut order = classes_in(rules.deck);
|
||||
order.sort_by(|a, b| {
|
||||
vs_random(*b).partial_cmp(&vs_random(*a)).unwrap_or(std::cmp::Ordering::Equal).then(a.cmp(b))
|
||||
});
|
||||
Ok(Environment { rules: *rules, equity, chance, order })
|
||||
}
|
||||
|
||||
/// Full deck, hold'em rules, the frozen equity table.
|
||||
pub fn frozen() -> Environment {
|
||||
Environment::new(&rules(Variant::Nlhe), frozen_equity()).unwrap_or_else(|_| {
|
||||
// Unreachable: the hold'em rule set has two hole cards. Kept total instead of panicking.
|
||||
let r = rules(Variant::Nlhe);
|
||||
Environment {
|
||||
rules: r,
|
||||
equity: EquityMatrix::neutral(),
|
||||
chance: chance_table(r.deck),
|
||||
order: classes_in(r.deck),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn classes(&self) -> usize {
|
||||
CLASS_COUNT
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
//! The class-vs-class equity matrix, stored as the upper triangle of integers (1/10 000).
|
||||
//!
|
||||
//! Only `i <= j` is stored: the all-in equity of `j` against `i` is exactly one minus the
|
||||
//! equity of `i` against `j` (ties count half), and a class against itself is 1/2 by symmetry
|
||||
//! of the deal. `from_triangle` rebuilds the full antisymmetric matrix.
|
||||
|
||||
use super::hand_class::CLASS_COUNT;
|
||||
use crate::fault::Fault;
|
||||
|
||||
pub const TRIANGLE_LEN: usize = CLASS_COUNT * (CLASS_COUNT + 1) / 2;
|
||||
const SCALE: f64 = 10_000.0;
|
||||
|
||||
/// Row-major pairs `(i, j)` with `i <= j`, in storage order.
|
||||
pub fn triangle_pairs() -> Vec<(usize, usize)> {
|
||||
(0..CLASS_COUNT).flat_map(|i| (i..CLASS_COUNT).map(move |j| (i, j))).collect()
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct EquityMatrix {
|
||||
values: Vec<f64>,
|
||||
}
|
||||
|
||||
impl EquityMatrix {
|
||||
/// Every matchup a coin flip. Used as the fallback when a table cannot be read.
|
||||
pub fn neutral() -> EquityMatrix {
|
||||
EquityMatrix { values: vec![0.5; CLASS_COUNT * CLASS_COUNT] }
|
||||
}
|
||||
|
||||
pub fn from_triangle(triangle: &[u16]) -> Result<EquityMatrix, Fault> {
|
||||
let invalid = |detail: &str| Fault::Invalid { field: "equity table".into(), detail: detail.into() };
|
||||
if triangle.len() != TRIANGLE_LEN {
|
||||
return Err(invalid("wrong length"));
|
||||
}
|
||||
if triangle.iter().any(|v| *v as f64 > SCALE) {
|
||||
return Err(invalid("equity above 100 %"));
|
||||
}
|
||||
let mut values = vec![0.5; CLASS_COUNT * CLASS_COUNT];
|
||||
for (k, (i, j)) in triangle_pairs().into_iter().enumerate() {
|
||||
if i != j {
|
||||
let v = triangle[k] as f64 / SCALE;
|
||||
values[i * CLASS_COUNT + j] = v;
|
||||
values[j * CLASS_COUNT + i] = 1.0 - v;
|
||||
}
|
||||
}
|
||||
Ok(EquityMatrix { values })
|
||||
}
|
||||
|
||||
/// Equity of class `i` against class `j`; 0.5 outside the grid.
|
||||
pub fn get(&self, i: usize, j: usize) -> f64 {
|
||||
if i < CLASS_COUNT && j < CLASS_COUNT {
|
||||
self.values[i * CLASS_COUNT + j]
|
||||
} else {
|
||||
0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
//! All-in equity of one hand class against another, by seeded Monte Carlo.
|
||||
//!
|
||||
//! Each sample draws one of the exactly-disjoint combo pairs `(a in i, b in j)` uniformly (so
|
||||
//! card removal is exact), then a uniformly random five-card board from the rest of the deck,
|
||||
//! and compares the two hands with `hand::showdown::judge` (the variant rules decide the deck
|
||||
//! and the hand order). Win = 1, tie = 1/2. The result is an integer in 1/10 000, so it can
|
||||
//! be frozen as a compact table. The generator for the pair `(i, j)` is derived from the seed
|
||||
//! and the pair alone, so the value never depends on evaluation order or on threads.
|
||||
|
||||
use super::hand_class::{class_combos, class_exists, ClassId, CLASS_COUNT};
|
||||
use crate::card::Card;
|
||||
use crate::fault::Fault;
|
||||
use crate::hand::showdown::judge;
|
||||
use crate::rng::Rng;
|
||||
use crate::variant::Rules;
|
||||
|
||||
const BOARD: usize = 5;
|
||||
|
||||
fn invalid(detail: &str) -> Fault {
|
||||
Fault::Invalid { field: "equity".into(), detail: detail.into() }
|
||||
}
|
||||
|
||||
/// Independent generator per pair: SplitMix scrambles the offset seed.
|
||||
fn pair_rng(seed: u64, i: ClassId, j: ClassId) -> Rng {
|
||||
let key = (i * CLASS_COUNT + j) as u64 + 1;
|
||||
Rng::seeded(seed.wrapping_add(key.wrapping_mul(0x9E37_79B9_7F4A_7C15)))
|
||||
}
|
||||
|
||||
struct Matchup {
|
||||
hands: [[Card; 2]; 2],
|
||||
rest: Vec<Card>,
|
||||
}
|
||||
|
||||
fn matchups(rules: &Rules, i: ClassId, j: ClassId) -> Vec<Matchup> {
|
||||
let deck: Vec<Card> =
|
||||
(0..52).filter_map(Card::from_index).filter(|c| rules.deck.contains(c.rank)).collect();
|
||||
let in_deck = |h: &[Card; 2]| h.iter().all(|c| rules.deck.contains(c.rank));
|
||||
let (first, second) = (class_combos(i), class_combos(j));
|
||||
first
|
||||
.iter()
|
||||
.filter(|a| in_deck(a))
|
||||
.flat_map(|a| second.iter().filter(|b| in_deck(b)).map(move |b| (*a, *b)))
|
||||
.filter(|(a, b)| !a.iter().any(|c| b.contains(c)))
|
||||
.map(|(a, b)| Matchup {
|
||||
hands: [a, b],
|
||||
rest: deck.iter().filter(|c| !a.contains(c) && !b.contains(c)).copied().collect(),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Equity of class `i` against class `j` in 1/10 000, from `samples` seeded deals.
|
||||
pub fn pair_equity(
|
||||
rules: &Rules,
|
||||
seed: u64,
|
||||
samples: u32,
|
||||
i: ClassId,
|
||||
j: ClassId,
|
||||
) -> Result<u16, Fault> {
|
||||
if rules.hole_cards != 2 {
|
||||
return Err(invalid("class equity needs two hole cards"));
|
||||
}
|
||||
if samples == 0 {
|
||||
return Err(invalid("at least one sample"));
|
||||
}
|
||||
if !class_exists(rules.deck, i) || !class_exists(rules.deck, j) {
|
||||
return Err(invalid("hand class is not in the deck"));
|
||||
}
|
||||
let table = matchups(rules, i, j);
|
||||
if table.is_empty() {
|
||||
return Err(Fault::Exhausted("no disjoint combos for this class pair".into()));
|
||||
}
|
||||
let mut rng = pair_rng(seed, i, j);
|
||||
let mut score: u64 = 0;
|
||||
for _ in 0..samples {
|
||||
let (pick, next) = rng.below(table.len() as u64);
|
||||
let matchup = &table[pick as usize];
|
||||
// Partial Fisher-Yates on a private copy of the remaining cards.
|
||||
let mut cards = [matchup.rest[0]; 52];
|
||||
cards[..matchup.rest.len()].copy_from_slice(&matchup.rest);
|
||||
let size = matchup.rest.len();
|
||||
rng = next;
|
||||
for k in 0..BOARD {
|
||||
let (offset, next) = rng.below((size - k) as u64);
|
||||
rng = next;
|
||||
cards.swap(k, k + offset as usize);
|
||||
}
|
||||
let board = &cards[..BOARD];
|
||||
let ours = judge(rules, &matchup.hands[0], board)?;
|
||||
let theirs = judge(rules, &matchup.hands[1], board)?;
|
||||
score += match ours.cmp(&theirs) {
|
||||
std::cmp::Ordering::Greater => 2,
|
||||
std::cmp::Ordering::Equal => 1,
|
||||
std::cmp::Ordering::Less => 0,
|
||||
};
|
||||
}
|
||||
let n = samples as u64;
|
||||
Ok(((score * 10_000 + n) / (2 * n)) as u16)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//! 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()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//! Game value, best-response gains and exploitability of a fixed strategy.
|
||||
//!
|
||||
//! Units are those of the payoffs (big blinds per deal for the poker spots). For a zero-sum game
|
||||
//! `exploitability = gain(player 0) + gain(player 1) >= 0`, and it is 0 exactly at a Nash
|
||||
//! equilibrium. `gain(p)` is what player `p` wins by best-responding to the other's fixed
|
||||
//! strategy, over what `p` gets from the strategy itself.
|
||||
|
||||
use super::strategy::Strategy;
|
||||
use super::tree::Tree;
|
||||
use super::value_walk::{root_values, Responder};
|
||||
|
||||
/// Expected result for player 0.
|
||||
pub fn game_value(tree: &Tree, strategy: &Strategy) -> f64 {
|
||||
root_values(tree, strategy, Responder::Follow, 0, &mut |_| {}).iter().sum()
|
||||
}
|
||||
|
||||
/// Best-response value minus strategy value for `player` (0 or 1), against the other's strategy.
|
||||
pub fn best_response_gain(tree: &Tree, strategy: &Strategy, player: usize) -> f64 {
|
||||
let player = player.min(1);
|
||||
let best: f64 = root_values(tree, strategy, Responder::Best, player, &mut |_| {}).iter().sum();
|
||||
let own: f64 = root_values(tree, strategy, Responder::Follow, player, &mut |_| {}).iter().sum();
|
||||
best - own
|
||||
}
|
||||
|
||||
pub fn exploitability(tree: &Tree, strategy: &Strategy) -> f64 {
|
||||
best_response_gain(tree, strategy, 0) + best_response_gain(tree, strategy, 1)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//! The frozen full-deck equity matrix (`generated_equity.rs`) as a value.
|
||||
|
||||
use super::equity_matrix::EquityMatrix;
|
||||
use super::generated_equity::TRIANGLE;
|
||||
|
||||
/// Never fails: an unreadable table degrades to coin flips instead of a panic.
|
||||
pub fn frozen_equity() -> EquityMatrix {
|
||||
EquityMatrix::from_triangle(&TRIANGLE).unwrap_or_else(|_| EquityMatrix::neutral())
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//! The shapes of the frozen chart tables (`preflop/generated_charts.rs` is data in these types).
|
||||
//!
|
||||
//! All frequencies are permille (0..=1000) per hand class, indexed by `ClassId`
|
||||
//! (the 13 x 13 grid of `hand_class`). Two-action nodes store the frequency of the second
|
||||
//! action (push / call / raise); three-action nodes store `[call, raise]` and the fold
|
||||
//! frequency is `1000 - call - raise`.
|
||||
|
||||
use super::hand_class::CLASS_COUNT;
|
||||
use super::seat::Seat;
|
||||
|
||||
/// How the run that produced a spot converged.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct SpotMeta {
|
||||
/// CFR+ iterations run.
|
||||
pub iterations: u32,
|
||||
/// The argmax chart did not change after this iteration (sampled every `iterations / 200`).
|
||||
pub stable_since: u32,
|
||||
/// `(iteration, exploitability in micro-bb)` at N/100, N/20, N/5, N/2 and N, on the
|
||||
/// unrounded average strategy; the last entry is of the frozen permille strategy.
|
||||
pub checkpoints: [(u32, u32); 5],
|
||||
/// Exploitability of the frozen permille strategy, micro-bb (1e-6 bb) per deal.
|
||||
pub exploitability_micro_bb: u32,
|
||||
}
|
||||
|
||||
/// Push / fold: the first actor's push frequency and the big blind's call frequency.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PushFoldSpot {
|
||||
pub seat: Seat,
|
||||
pub depth_bb: u8,
|
||||
pub push: [u16; CLASS_COUNT],
|
||||
pub call: [u16; CLASS_COUNT],
|
||||
pub meta: SpotMeta,
|
||||
}
|
||||
|
||||
/// Open / call / 3-bet.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct OpenSpot {
|
||||
pub seat: Seat,
|
||||
pub depth_bb: u8,
|
||||
/// Opener: raise frequency (else fold).
|
||||
pub open: [u16; CLASS_COUNT],
|
||||
/// Big blind versus the open: `[call, 3-bet]`.
|
||||
pub defend: [[u16; 2]; CLASS_COUNT],
|
||||
/// Opener versus the 3-bet: `[call, jam]`.
|
||||
pub vs_three_bet: [[u16; 2]; CLASS_COUNT],
|
||||
/// Big blind versus the jam: call frequency (else fold).
|
||||
pub vs_jam: [u16; CLASS_COUNT],
|
||||
pub meta: SpotMeta,
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//! Frozen permille tables <-> `Strategy` values over the matching game tree.
|
||||
|
||||
use super::frozen_spot::{OpenSpot, PushFoldSpot};
|
||||
use super::hand_class::CLASS_COUNT;
|
||||
use super::permille::{from_permille, to_permille};
|
||||
use super::strategy::Strategy;
|
||||
use super::tree::Tree;
|
||||
use crate::fault::Fault;
|
||||
|
||||
fn binary(p: u16) -> Vec<f64> {
|
||||
let p = p.min(1000) as f64 / 1000.0;
|
||||
vec![1.0 - p, p]
|
||||
}
|
||||
|
||||
fn ternary(row: [u16; 2]) -> Vec<f64> {
|
||||
let call = row[0].min(1000);
|
||||
let raise = row[1].min(1000 - call);
|
||||
from_permille(&[1000 - call - raise, call, raise])
|
||||
}
|
||||
|
||||
pub fn push_fold_strategy(tree: &Tree, spot: &PushFoldSpot) -> Result<Strategy, Fault> {
|
||||
Strategy::uniform(tree)
|
||||
.with_rows(tree, "push", |c| binary(spot.push[c]))?
|
||||
.with_rows(tree, "call", |c| binary(spot.call[c]))
|
||||
}
|
||||
|
||||
pub fn open_strategy(tree: &Tree, spot: &OpenSpot) -> Result<Strategy, Fault> {
|
||||
Strategy::uniform(tree)
|
||||
.with_rows(tree, "open", |c| binary(spot.open[c]))?
|
||||
.with_rows(tree, "defend", |c| ternary(spot.defend[c]))?
|
||||
.with_rows(tree, "vs_three_bet", |c| ternary(spot.vs_three_bet[c]))?
|
||||
.with_rows(tree, "vs_jam", |c| binary(spot.vs_jam[c]))
|
||||
}
|
||||
|
||||
fn node_of(tree: &Tree, name: &str) -> Result<usize, Fault> {
|
||||
tree.find(name).ok_or_else(|| Fault::Missing(format!("decision node {name}")))
|
||||
}
|
||||
|
||||
/// Permille of the last action of a two-action node.
|
||||
pub fn binary_row(tree: &Tree, strategy: &Strategy, name: &str) -> Result<[u16; CLASS_COUNT], Fault> {
|
||||
let node = node_of(tree, name)?;
|
||||
let mut out = [0u16; CLASS_COUNT];
|
||||
for (class, slot) in out.iter_mut().enumerate() {
|
||||
*slot = to_permille(strategy.row(node, class)).get(1).copied().unwrap_or(0);
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Permille of `[call, raise]` of a three-action node.
|
||||
pub fn ternary_row(tree: &Tree, strategy: &Strategy, name: &str) -> Result<[[u16; 2]; CLASS_COUNT], Fault> {
|
||||
let node = node_of(tree, name)?;
|
||||
let mut out = [[0u16; 2]; CLASS_COUNT];
|
||||
for (class, slot) in out.iter_mut().enumerate() {
|
||||
let rounded = to_permille(strategy.row(node, class));
|
||||
*slot = [rounded.get(1).copied().unwrap_or(0), rounded.get(2).copied().unwrap_or(0)];
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
@@ -0,0 +1,613 @@
|
||||
//! GENERATED by `cargo run --release --bin chartgen -- equity > src/cfr/generated_equity.rs`.
|
||||
//! Do not edit.
|
||||
//!
|
||||
//! All-in preflop equity of hand class `i` against class `j` (`i <= j`, row-major over the
|
||||
//! 13 x 13 class grid of `hand_class`) in 1/10 000, from 60000 seeded Monte-Carlo
|
||||
//! board runouts per class pair with exact card removal, evaluated by `hand::showdown::judge`.
|
||||
//! The diagonal is 5000 by symmetry; the lower triangle is `10000 - upper`.
|
||||
//! Standard error per entry: at most 0.20 % (sqrt(0.25 / samples)).
|
||||
|
||||
pub const SEED: u64 = 5786926807299543621;
|
||||
pub const SAMPLES: u32 = 60000;
|
||||
|
||||
pub static TRIANGLE: [u16; 14365] = [
|
||||
5000, 6634, 6597, 6536, 6657, 6711, 6680, 6673, 6684, 6675, 6691, 6737, 6606, 6258, 1974, 5287, 5180, 5278, 5284, 5391, 5354, 5353, 5308, 5328,
|
||||
5361, 5331, 6219, 5031, 1884, 5079, 5157, 5152, 5264, 5355, 5286, 5307, 5327, 5350, 5292, 6161, 4929, 4837, 1848, 5038, 5018, 5139, 5161, 5270,
|
||||
5244, 5298, 5324, 5259, 6262, 5019, 4899, 4796, 1856, 4902, 4998, 5087, 5171, 5224, 5254, 5259, 5333, 6324, 5022, 4904, 4801, 4675, 1809, 4868,
|
||||
4939, 5013, 5134, 5216, 5217, 5259, 6300, 5106, 5019, 4911, 4770, 4633, 1820, 4880, 4968, 5048, 5140, 5283, 5254, 6281, 5103, 5107, 4917, 4845,
|
||||
4708, 4663, 1831, 4879, 4954, 5089, 5179, 5289, 6289, 5108, 5025, 5005, 4920, 4776, 4730, 4664, 1799, 4835, 4974, 5079, 5202, 6304, 5050, 5030,
|
||||
4999, 4974, 4891, 4816, 4720, 4612, 1812, 4970, 5101, 5221, 6301, 5085, 5077, 5044, 5011, 4971, 4904, 4848, 4733, 4722, 1840, 5125, 5267, 6361,
|
||||
5097, 5091, 5072, 5008, 4968, 5020, 4940, 4835, 4863, 4874, 1818, 5323, 6225, 5067, 5041, 5007, 5072, 5004, 5022, 5027, 4965, 4962, 5020, 5058,
|
||||
1790, 5000, 4666, 4015, 3742, 3493, 3206, 3092, 2929, 2877, 2826, 2784, 2551, 4756, 1088, 4503, 3911, 3600, 3247, 3171, 2993, 2850, 2744, 2699,
|
||||
2621, 2448, 4418, 4289, 1283, 3938, 3747, 3555, 3557, 3502, 3468, 3418, 3411, 3427, 3285, 3823, 3751, 3757, 1217, 3647, 3517, 3493, 3472, 3465,
|
||||
3371, 3423, 3408, 3264, 3581, 3466, 3563, 3464, 1348, 3450, 3460, 3438, 3408, 3413, 3409, 3426, 3433, 3336, 3117, 3388, 3362, 3294, 1424, 3237,
|
||||
3338, 3359, 3363, 3392, 3407, 3397, 3053, 3046, 3410, 3342, 3287, 3087, 1407, 3366, 3322, 3336, 3395, 3438, 3408, 2950, 2870, 3341, 3305, 3278,
|
||||
3178, 3199, 1438, 3336, 3360, 3395, 3423, 3441, 2802, 2747, 3302, 3320, 3248, 3208, 3173, 3160, 1460, 3307, 3336, 3376, 3403, 2739, 2642, 3264,
|
||||
3208, 3263, 3203, 3170, 3209, 3147, 1422, 3337, 3403, 3387, 2695, 2590, 3252, 3270, 3245, 3230, 3235, 3232, 3163, 3178, 1421, 3388, 3428, 2667,
|
||||
2540, 3273, 3250, 3274, 3239, 3265, 3251, 3205, 3234, 3225, 1468, 3423, 2447, 2358, 3145, 3119, 3271, 3243, 3245, 3269, 3246, 3227, 3278, 3259,
|
||||
1280, 5000, 4006, 3709, 3541, 3287, 3083, 3008, 2884, 2861, 2801, 2601, 5073, 2970, 4622, 4434, 4175, 4027, 3995, 3816, 3809, 3810, 3815, 3828,
|
||||
3710, 4749, 4382, 1081, 3849, 3561, 3221, 3141, 2972, 2897, 2740, 2724, 2681, 2438, 3820, 4206, 3688, 1225, 3616, 3502, 3470, 3505, 3440, 3449,
|
||||
3429, 3403, 3248, 3528, 3959, 3418, 3446, 1357, 3477, 3477, 3414, 3436, 3482, 3411, 3448, 3461, 3370, 3823, 3097, 3352, 3308, 1471, 3370, 3375,
|
||||
3413, 3415, 3443, 3464, 3424, 3139, 3803, 3020, 3320, 3325, 3214, 1469, 3355, 3384, 3405, 3433, 3478, 3467, 2958, 3643, 2868, 3351, 3249, 3209,
|
||||
3205, 1435, 3328, 3379, 3397, 3433, 3462, 2873, 3620, 2782, 3289, 3281, 3248, 3221, 3179, 1492, 3318, 3378, 3444, 3446, 2748, 3628, 2645, 3285,
|
||||
3310, 3252, 3251, 3219, 3161, 1475, 3394, 3389, 3415, 2737, 3631, 2622, 3265, 3252, 3276, 3280, 3238, 3208, 3228, 1458, 3419, 3458, 2670, 3632,
|
||||
2575, 3247, 3280, 3305, 3310, 3266, 3277, 3235, 3259, 1488, 3474, 2488, 3533, 2352, 3095, 3307, 3275, 3304, 3297, 3289, 3254, 3289, 3297, 1332,
|
||||
5000, 3735, 3556, 3290, 3178, 3034, 2938, 2876, 2853, 2641, 5672, 3091, 4955, 4632, 4185, 4068, 4009, 3929, 3861, 3814, 3847, 3847, 3741, 5700,
|
||||
4711, 2939, 4530, 4071, 3921, 3893, 3928, 3793, 3815, 3816, 3845, 3698, 4751, 4395, 4302, 1051, 3514, 3188, 3147, 2941, 2874, 2804, 2725, 2666,
|
||||
2491, 3564, 3970, 3872, 3382, 1379, 3440, 3381, 3426, 3486, 3474, 3468, 3469, 3422, 3397, 3874, 3741, 3065, 3285, 1476, 3370, 3406, 3424, 3447,
|
||||
3484, 3451, 3455, 3154, 3809, 3704, 3022, 3229, 3202, 1512, 3370, 3403, 3440, 3446, 3497, 3471, 3027, 3737, 3741, 2835, 3260, 3241, 3215, 1501,
|
||||
3351, 3380, 3458, 3496, 3531, 2897, 3685, 3612, 2769, 3313, 3264, 3243, 3197, 1478, 3349, 3402, 3434, 3450, 2800, 3632, 3629, 2689, 3311, 3300,
|
||||
3287, 3221, 3189, 1545, 3434, 3439, 3483, 2742, 3648, 3620, 2617, 3308, 3320, 3294, 3295, 3230, 3274, 1515, 3477, 3454, 2719, 3651, 3656, 2563,
|
||||
3302, 3295, 3325, 3322, 3277, 3277, 3311, 1510, 3529, 2523, 3558, 3522, 2409, 3281, 3292, 3324, 3368, 3286, 3318, 3299, 3353, 1399, 5000, 3359,
|
||||
3111, 2974, 2880, 2778, 2764, 2693, 2665, 5903, 3052, 5192, 5191, 4634, 3867, 3824, 3788, 3745, 3705, 3719, 3687, 3618, 5952, 4904, 2954, 5022,
|
||||
4503, 3752, 3767, 3767, 3707, 3660, 3660, 3685, 3625, 5921, 4893, 4744, 2796, 4212, 3679, 3567, 3643, 3666, 3595, 3644, 3724, 3547, 4749, 4401,
|
||||
4274, 3996, 832, 2977, 2930, 2778, 2641, 2620, 2578, 2508, 2476, 3208, 3678, 3561, 3498, 2869, 1258, 3142, 3154, 3242, 3305, 3297, 3301, 3292,
|
||||
2982, 3642, 3590, 3393, 2826, 3006, 1275, 3168, 3244, 3240, 3300, 3322, 3330, 2845, 3608, 3576, 3458, 2685, 3029, 3023, 1326, 3175, 3237, 3270,
|
||||
3316, 3371, 2748, 3562, 3530, 3486, 2552, 3095, 3095, 3019, 1307, 3164, 3247, 3320, 3372, 2649, 3524, 3472, 3421, 2533, 3152, 3087, 3085, 3015,
|
||||
1286, 3257, 3321, 3329, 2640, 3523, 3478, 3478, 2488, 3154, 3132, 3114, 3092, 3104, 1365, 3322, 3382, 2560, 3509, 3497, 3539, 2426, 3135, 3172,
|
||||
3155, 3162, 3158, 3165, 1342, 3388, 2539, 3437, 3458, 3380, 2382, 3138, 3179, 3216, 3201, 3164, 3207, 3224, 1333, 5000, 2967, 2815, 2738, 2664,
|
||||
2628, 2582, 2503, 6142, 3027, 5363, 5335, 5474, 4579, 3743, 3640, 3665, 3666, 3590, 3615, 3553, 6111, 5067, 2954, 5195, 5327, 4495, 3603, 3663,
|
||||
3621, 3606, 3539, 3631, 3495, 6080, 5033, 4918, 2836, 5182, 4218, 3501, 3505, 3563, 3552, 3555, 3580, 3498, 6275, 5168, 5020, 4897, 2764, 3836,
|
||||
3420, 3429, 3479, 3582, 3539, 3578, 3572, 4761, 4328, 4257, 4004, 3639, 646, 2740, 2612, 2541, 2446, 2431, 2392, 2283, 2849, 3564, 3426, 3314,
|
||||
3258, 2658, 1111, 2965, 3060, 3125, 3180, 3221, 3166, 2691, 3458, 3477, 3333, 3270, 2525, 2831, 1161, 3037, 3093, 3170, 3202, 3234, 2622, 3480,
|
||||
3439, 3385, 3311, 2447, 2919, 2898, 1171, 3054, 3148, 3213, 3216, 2547, 3474, 3420, 3382, 3403, 2366, 2984, 2959, 2907, 1186, 3138, 3240, 3258,
|
||||
2502, 3412, 3361, 3383, 3366, 2338, 3039, 3011, 2995, 2985, 1190, 3247, 3230, 2471, 3430, 3454, 3402, 3391, 2312, 3075, 3059, 3054, 3086, 3078,
|
||||
1228, 3248, 2385, 3376, 3331, 3322, 3411, 2201, 3020, 3079, 3069, 3094, 3074, 3078, 1194, 5000, 2808, 2716, 2673, 2626, 2574, 2565, 6412, 3129,
|
||||
5607, 5490, 5646, 5724, 4692, 3697, 3717, 3668, 3661, 3711, 3609, 6338, 5282, 3035, 5338, 5495, 5558, 4610, 3708, 3632, 3626, 3677, 3663, 3599,
|
||||
6324, 5191, 5047, 2944, 5355, 5402, 4223, 3554, 3641, 3613, 3621, 3617, 3516, 6506, 5324, 5193, 5053, 2869, 5237, 3868, 3477, 3551, 3621, 3609,
|
||||
3605, 3642, 6630, 5413, 5247, 5093, 4931, 2753, 3474, 3345, 3376, 3496, 3604, 3552, 3554, 4746, 4446, 4361, 4005, 3677, 3302, 679, 2596, 2522,
|
||||
2480, 2435, 2419, 2348, 2702, 3517, 3522, 3387, 3313, 3176, 2513, 1155, 2984, 3056, 3156, 3236, 3232, 2601, 3531, 3447, 3461, 3372, 3214, 2443,
|
||||
2861, 1173, 3027, 3129, 3189, 3207, 2560, 3477, 3447, 3440, 3438, 3329, 2388, 2916, 2898, 1226, 3128, 3212, 3228, 2507, 3475, 3504, 3438, 3429,
|
||||
3426, 2343, 3021, 2986, 2984, 1233, 3223, 3261, 2459, 3533, 3472, 3434, 3426, 3373, 2324, 3095, 3038, 3052, 3058, 1219, 3268, 2454, 3436, 3422,
|
||||
3356, 3453, 3386, 2272, 3081, 3055, 3072, 3100, 3117, 1243, 5000, 2706, 2599, 2566, 2566, 2498, 6523, 3137, 5621, 5543, 5708, 5771, 5939, 4698,
|
||||
3620, 3602, 3651, 3681, 3571, 6507, 5298, 3075, 5496, 5552, 5613, 5778, 4676, 3600, 3630, 3669, 3679, 3583, 6435, 5243, 5191, 2992, 5392, 5442,
|
||||
5625, 4300, 3629, 3568, 3621, 3623, 3520, 6637, 5382, 5228, 5089, 2905, 5342, 5487, 3922, 3529, 3613, 3610, 3610, 3603, 6756, 5444, 5305, 5135,
|
||||
5051, 2799, 5322, 3469, 3391, 3491, 3592, 3591, 3561, 6790, 5599, 5462, 5311, 5160, 5012, 2796, 3197, 3334, 3383, 3503, 3624, 3566, 4743, 4449,
|
||||
4419, 4076, 3725, 3305, 3055, 645, 2468, 2428, 2395, 2389, 2343, 2586, 3428, 3427, 3448, 3356, 3233, 3177, 2390, 1136, 2960, 3037, 3128, 3176,
|
||||
2497, 3435, 3464, 3395, 3423, 3325, 3217, 2356, 2835, 1152, 3060, 3154, 3199, 2449, 3481, 3481, 3440, 3423, 3415, 3328, 2322, 2903, 2912, 1205,
|
||||
3184, 3232, 2453, 3495, 3493, 3446, 3432, 3411, 3446, 2310, 2979, 3005, 3035, 1221, 3228, 2389, 3396, 3395, 3345, 3423, 3382, 3400, 2259, 3041,
|
||||
3056, 3081, 3076, 1170, 5000, 2566, 2541, 2540, 2490, 6662, 3144, 5639, 5670, 5757, 5808, 5933, 5944, 4652, 3597, 3625, 3667, 3583, 6595, 5311,
|
||||
3125, 5525, 5602, 5630, 5803, 5946, 4650, 3599, 3627, 3642, 3563, 6573, 5337, 5197, 3056, 5515, 5475, 5670, 5845, 4401, 3595, 3607, 3618, 3549,
|
||||
6712, 5417, 5298, 5206, 2960, 5378, 5528, 5702, 3992, 3627, 3608, 3635, 3662, 6854, 5470, 5304, 5165, 5078, 2875, 5353, 5489, 3504, 3466, 3597,
|
||||
3594, 3567, 6876, 5596, 5467, 5357, 5217, 5049, 2812, 5402, 3164, 3391, 3500, 3640, 3613, 6883, 5596, 5602, 5507, 5382, 5185, 5094, 2751, 2914,
|
||||
3280, 3406, 3558, 3596, 4757, 4408, 4410, 4164, 3793, 3329, 3011, 2781, 642, 2378, 2375, 2367, 2287, 2454, 3416, 3419, 3419, 3447, 3297, 3237,
|
||||
3135, 2303, 1144, 2968, 3071, 3101, 2425, 3439, 3449, 3437, 3432, 3423, 3330, 3235, 2300, 2841, 1166, 3111, 3184, 2431, 3494, 3462, 3443, 3460,
|
||||
3421, 3465, 3388, 2290, 2941, 2966, 1222, 3201, 2390, 3403, 3386, 3377, 3483, 3390, 3438, 3425, 2212, 2976, 3033, 3058, 1212, 5000, 2540, 2507,
|
||||
2475, 6722, 3146, 5685, 5672, 5788, 5793, 5938, 5940, 6016, 4675, 3602, 3625, 3551, 6715, 5361, 3107, 5485, 5650, 5661, 5820, 5974, 5937, 4660,
|
||||
3589, 3632, 3537, 6680, 5341, 5182, 3023, 5507, 5533, 5707, 5843, 5926, 4351, 3566, 3609, 3562, 6826, 5462, 5311, 5198, 3002, 5476, 5590, 5690,
|
||||
5820, 4021, 3597, 3674, 3683, 6926, 5451, 5329, 5224, 5154, 2897, 5400, 5521, 5621, 3568, 3588, 3614, 3626, 6914, 5591, 5480, 5380, 5274, 5096,
|
||||
2854, 5416, 5527, 3229, 3528, 3664, 3597, 6990, 5602, 5628, 5511, 5371, 5217, 5121, 2784, 5462, 2943, 3442, 3498, 3609, 7006, 5670, 5594, 5594,
|
||||
5494, 5284, 5205, 5155, 2718, 2701, 3257, 3374, 3485, 4745, 4428, 4420, 4114, 3810, 3399, 3076, 2809, 2599, 600, 2349, 2346, 2278, 2428, 3430,
|
||||
3410, 3401, 3421, 3413, 3364, 3279, 3119, 2279, 1146, 3070, 3157, 2407, 3436, 3461, 3434, 3494, 3441, 3478, 3326, 3215, 2263, 2934, 1178, 3207,
|
||||
2370, 3384, 3353, 3380, 3504, 3446, 3420, 3438, 3321, 2207, 3006, 3058, 1155, 5000, 2460, 2433, 6775, 3123, 5704, 5659, 5775, 5820, 5922, 5948,
|
||||
5940, 5991, 4701, 3554, 3499, 6742, 5377, 3023, 5506, 5642, 5714, 5814, 5913, 5912, 5954, 4658, 3581, 3506, 6728, 5329, 5192, 2948, 5496, 5582,
|
||||
5674, 5799, 5904, 5888, 4351, 3608, 3488, 6844, 5432, 5308, 5183, 2952, 5432, 5546, 5674, 5800, 5875, 4031, 3584, 3615, 6950, 5497, 5387, 5258,
|
||||
5118, 2893, 5445, 5507, 5630, 5769, 3617, 3599, 3589, 6964, 5576, 5478, 5357, 5232, 5141, 2841, 5427, 5572, 5650, 3280, 3638, 3557, 7016, 5607,
|
||||
5573, 5476, 5356, 5194, 5124, 2806, 5422, 5585, 2953, 3493, 3611, 7048, 5620, 5578, 5573, 5458, 5311, 5254, 5110, 2713, 5407, 2707, 3380, 3461,
|
||||
7060, 5642, 5618, 5535, 5534, 5447, 5330, 5261, 5099, 2687, 2579, 3379, 3454, 4753, 4436, 4414, 4119, 3831, 3437, 3129, 2823, 2590, 2477, 581,
|
||||
2317, 2281, 2366, 3378, 3403, 3431, 3396, 3412, 3441, 3318, 3219, 3211, 2235, 1116, 3149, 2319, 3325, 3334, 3312, 3423, 3404, 3382, 3427, 3290,
|
||||
3286, 2209, 3013, 1112, 5000, 2354, 6824, 3085, 5703, 5646, 5744, 5787, 5951, 5891, 5951, 5967, 5960, 4649, 3474, 6790, 5380, 3017, 5507, 5638,
|
||||
5662, 5802, 5914, 5894, 5936, 5937, 4644, 3472, 6753, 5314, 5199, 2920, 5515, 5544, 5698, 5758, 5855, 5843, 5962, 4379, 3474, 6878, 5425, 5310,
|
||||
5197, 2905, 5374, 5544, 5644, 5738, 5867, 5883, 4039, 3573, 6997, 5454, 5332, 5236, 5078, 2864, 5415, 5496, 5636, 5708, 5870, 3612, 3511, 7021,
|
||||
5609, 5468, 5374, 5230, 5114, 2844, 5441, 5512, 5677, 5808, 3289, 3563, 7030, 5558, 5575, 5429, 5320, 5183, 5144, 2771, 5435, 5578, 5677, 2970,
|
||||
3577, 7051, 5590, 5546, 5519, 5403, 5321, 5210, 5140, 2707, 5368, 5539, 2731, 3421, 7073, 5618, 5593, 5499, 5529, 5378, 5357, 5253, 5053, 2679,
|
||||
5571, 2587, 3456, 7095, 5631, 5601, 5615, 5551, 5530, 5474, 5347, 5214, 5254, 2688, 2530, 3448, 4758, 4402, 4408, 4143, 3827, 3432, 3136, 2837,
|
||||
2605, 2472, 2425, 538, 2227, 2251, 3295, 3299, 3285, 3394, 3331, 3393, 3399, 3259, 3280, 3291, 2164, 1071, 5000, 7046, 3072, 5825, 5723, 5815,
|
||||
5937, 6024, 6048, 6045, 6044, 6074, 6128, 4683, 6996, 5491, 2992, 5595, 5690, 5781, 5903, 6030, 5987, 5998, 6059, 6069, 4681, 6935, 5400, 5281,
|
||||
2940, 5545, 5626, 5720, 5852, 5992, 5973, 6011, 6051, 4353, 6930, 5487, 5362, 5237, 2966, 5370, 5513, 5658, 5754, 5842, 5873, 5924, 4124, 7085,
|
||||
5596, 5452, 5306, 5076, 2937, 5452, 5597, 5617, 5766, 5878, 5893, 3758, 7032, 5685, 5571, 5411, 5213, 5146, 2947, 5470, 5565, 5681, 5784, 5963,
|
||||
3435, 7084, 5703, 5680, 5522, 5347, 5283, 5161, 2925, 5458, 5560, 5720, 5857, 3180, 7091, 5698, 5646, 5647, 5419, 5301, 5261, 5156, 2811, 5483,
|
||||
5597, 5727, 2903, 7113, 5700, 5657, 5627, 5513, 5432, 5350, 5260, 5173, 2859, 5593, 5732, 2759, 7162, 5729, 5703, 5672, 5526, 5533, 5463, 5385,
|
||||
5282, 5273, 2825, 5762, 2647, 7207, 5774, 5726, 5693, 5578, 5544, 5621, 5508, 5386, 5396, 5433, 2827, 2607, 4752, 4433, 4435, 4133, 3897, 3567,
|
||||
3270, 3026, 2765, 2633, 2529, 2488, 690, 5000, 1588, 4796, 4264, 3973, 3644, 3556, 3405, 3282, 3167, 3105, 3056, 2877, 4692, 4568, 1717, 4253,
|
||||
4090, 3916, 3937, 3899, 3850, 3802, 3801, 3813, 3687, 4144, 4098, 4002, 1635, 4005, 3883, 3885, 3858, 3836, 3775, 3816, 3802, 3661, 3957, 3806,
|
||||
3826, 3751, 1759, 3833, 3846, 3810, 3780, 3804, 3802, 3796, 3799, 3704, 3511, 3676, 3642, 3581, 1846, 3629, 3704, 3730, 3745, 3770, 3777, 3788,
|
||||
3443, 3411, 3684, 3648, 3589, 3375, 1810, 3720, 3704, 3713, 3772, 3821, 3798, 3325, 3277, 3644, 3613, 3565, 3468, 3484, 1830, 3696, 3741, 3786,
|
||||
3813, 3829, 3200, 3170, 3598, 3590, 3538, 3490, 3457, 3448, 1870, 3700, 3715, 3763, 3787, 3162, 3053, 3559, 3530, 3569, 3495, 3468, 3503, 3468,
|
||||
1828, 3713, 3766, 3761, 3090, 2991, 3554, 3571, 3562, 3528, 3530, 3542, 3458, 3489, 1815, 3771, 3814, 3055, 2934, 3577, 3582, 3561, 3544, 3566,
|
||||
3558, 3514, 3520, 3534, 1874, 3809, 2852, 2781, 3467, 3429, 3560, 3547, 3548, 3596, 3546, 3521, 3566, 3568, 1698, 5000, 6497, 6422, 6551, 6637,
|
||||
6729, 6712, 6706, 6702, 6753, 6797, 6664, 6676, 6139, 1896, 5239, 5259, 5311, 5308, 5466, 5391, 5393, 5421, 5464, 5428, 6572, 6073, 4979, 1842,
|
||||
5161, 5169, 5148, 5317, 5386, 5344, 5403, 5409, 5359, 6601, 6178, 5002, 4924, 1881, 5071, 5049, 5163, 5247, 5371, 5369, 5398, 5443, 6627, 6260,
|
||||
5060, 4919, 4831, 1864, 4904, 5063, 5116, 5243, 5346, 5354, 5369, 6529, 6346, 5046, 4915, 4822, 4671, 1842, 4900, 5016, 5104, 5201, 5326, 5321,
|
||||
6530, 6319, 5213, 5067, 4917, 4820, 4684, 1900, 4943, 5041, 5149, 5251, 5373, 6505, 6341, 5138, 5110, 4998, 4882, 4789, 4706, 1850, 4906, 5012,
|
||||
5123, 5287, 6511, 6333, 5116, 5089, 5114, 4993, 4866, 4816, 4658, 1848, 5050, 5165, 5293, 6541, 6364, 5158, 5138, 5109, 5088, 4966, 4894, 4773,
|
||||
4810, 1888, 5186, 5318, 6584, 6394, 5201, 5140, 5124, 5107, 5074, 4994, 4890, 4921, 4925, 1876, 5372, 6573, 6287, 5152, 5103, 5183, 5119, 5068,
|
||||
5123, 5025, 5040, 5050, 5105, 1812, 5000, 4024, 3703, 3532, 3396, 3216, 3134, 3025, 3005, 2914, 2724, 5100, 4743, 1229, 3887, 3629, 3422, 3142,
|
||||
3155, 3011, 2941, 2879, 2846, 2626, 4774, 3836, 3734, 1291, 3743, 3641, 3587, 3592, 3591, 3568, 3564, 3553, 3441, 4550, 3534, 3496, 3570, 1429,
|
||||
3605, 3556, 3594, 3607, 3606, 3604, 3582, 3586, 4374, 3382, 3295, 3482, 3452, 1548, 3473, 3522, 3599, 3582, 3617, 3598, 3569, 4170, 3242, 3029,
|
||||
3425, 3388, 3302, 1608, 3352, 3498, 3497, 3532, 3585, 3553, 4134, 3066, 3032, 3436, 3412, 3358, 3192, 1619, 3502, 3476, 3534, 3596, 3604, 4132,
|
||||
2997, 2887, 3418, 3435, 3440, 3319, 3335, 1664, 3464, 3513, 3581, 3584, 4089, 2875, 2818, 3400, 3443, 3420, 3340, 3321, 3293, 1667, 3521, 3543,
|
||||
3573, 4079, 2857, 2773, 3409, 3426, 3456, 3367, 3368, 3347, 3338, 1663, 3595, 3583, 4078, 2777, 2731, 3385, 3426, 3419, 3413, 3422, 3394, 3367,
|
||||
3428, 1660, 3581, 3952, 2602, 2534, 3296, 3413, 3403, 3390, 3424, 3416, 3411, 3404, 3406, 1524, 5000, 3784, 3573, 3481, 3287, 3126, 3092, 3038,
|
||||
3017, 2789, 5273, 5672, 3039, 4639, 4212, 4028, 3993, 3987, 3937, 3947, 3974, 3933, 3795, 5087, 4751, 4410, 1242, 3589, 3417, 3111, 3144, 3020,
|
||||
2962, 2891, 2866, 2605, 4541, 3625, 4010, 3453, 1436, 3570, 3542, 3630, 3614, 3620, 3597, 3565, 3613, 4422, 3405, 3818, 3287, 3403, 1574, 3501,
|
||||
3573, 3580, 3609, 3595, 3623, 3614, 4269, 3320, 3798, 2996, 3373, 3339, 1685, 3465, 3481, 3535, 3607, 3660, 3635, 4224, 3124, 3804, 3023, 3459,
|
||||
3414, 3296, 1673, 3469, 3566, 3591, 3666, 3660, 4118, 2979, 3734, 2888, 3445, 3414, 3323, 3298, 1659, 3485, 3550, 3545, 3565, 4101, 2934, 3758,
|
||||
2851, 3451, 3441, 3362, 3404, 3324, 1721, 3549, 3588, 3580, 4111, 2894, 3790, 2782, 3437, 3429, 3427, 3418, 3379, 3367, 1689, 3566, 3636, 4119,
|
||||
2863, 3742, 2758, 3407, 3455, 3484, 3485, 3368, 3422, 3399, 1711, 3706, 4046, 2666, 3627, 2515, 3458, 3452, 3450, 3488, 3392, 3403, 3460, 3533,
|
||||
1577, 5000, 3364, 3292, 3115, 3014, 2892, 2874, 2827, 2807, 5499, 5955, 3018, 5160, 4623, 3908, 3846, 3905, 3800, 3788, 3803, 3820, 3725, 5466,
|
||||
5893, 4880, 2886, 4291, 3795, 3725, 3743, 3781, 3745, 3805, 3792, 3694, 5070, 4752, 4377, 4087, 1014, 3148, 2942, 2957, 2831, 2778, 2728, 2671,
|
||||
2646, 4301, 3214, 3725, 3608, 3033, 1351, 3306, 3331, 3423, 3399, 3459, 3423, 3493, 4139, 3143, 3658, 3534, 2834, 3160, 1471, 3308, 3335, 3385,
|
||||
3421, 3495, 3465, 4064, 2978, 3704, 3565, 2850, 3173, 3158, 1466, 3313, 3358, 3464, 3446, 3566, 4029, 2864, 3600, 3600, 2730, 3265, 3171, 3152,
|
||||
1477, 3324, 3396, 3468, 3468, 3986, 2748, 3610, 3574, 2664, 3237, 3218, 3204, 3157, 1479, 3436, 3421, 3484, 4008, 2744, 3616, 3625, 2631, 3298,
|
||||
3268, 3294, 3236, 3267, 1488, 3457, 3499, 4040, 2693, 3642, 3602, 2574, 3261, 3314, 3287, 3303, 3252, 3289, 1528, 3554, 3966, 2690, 3537, 3521,
|
||||
2546, 3327, 3290, 3392, 3308, 3318, 3337, 3372, 1532, 5000, 3130, 2980, 2898, 2815, 2720, 2728, 2647, 5610, 6125, 3036, 5296, 5451, 4597, 3750,
|
||||
3782, 3733, 3712, 3690, 3734, 3634, 5584, 6079, 5002, 2920, 5324, 4254, 3649, 3663, 3699, 3664, 3659, 3695, 3618, 5787, 6264, 5160, 5030, 2881,
|
||||
3887, 3558, 3538, 3607, 3711, 3651, 3714, 3705, 5128, 4748, 4369, 4039, 3694, 841, 2750, 2795, 2673, 2618, 2603, 2583, 2474, 4041, 2983, 3558,
|
||||
3480, 3387, 2650, 1285, 3127, 3203, 3240, 3316, 3339, 3302, 4008, 2850, 3600, 3497, 3366, 2695, 2990, 1317, 3151, 3270, 3292, 3368, 3354, 3975,
|
||||
2764, 3553, 3522, 3437, 2585, 3040, 3001, 1343, 3174, 3282, 3326, 3342, 3978, 2695, 3528, 3488, 3523, 2529, 3089, 3109, 3034, 1347, 3234, 3367,
|
||||
3361, 3961, 2588, 3521, 3484, 3480, 2500, 3153, 3139, 3126, 3082, 1348, 3355, 3370, 3991, 2611, 3544, 3507, 3543, 2478, 3184, 3213, 3172, 3199,
|
||||
3188, 1384, 3373, 3845, 2526, 3457, 3448, 3523, 2383, 3139, 3205, 3185, 3204, 3199, 3221, 1360, 5000, 2833, 2716, 2656, 2645, 2588, 2542, 5650,
|
||||
6233, 3049, 5413, 5506, 5619, 4613, 3677, 3604, 3596, 3620, 3626, 3582, 5654, 6155, 5129, 2933, 5381, 5428, 4241, 3542, 3606, 3565, 3598, 3580,
|
||||
3528, 5820, 6335, 5188, 5071, 2870, 5337, 3882, 3444, 3515, 3605, 3602, 3584, 3621, 5899, 6474, 5291, 5119, 5028, 2815, 3493, 3323, 3418, 3509,
|
||||
3620, 3567, 3605, 5024, 4750, 4365, 4023, 3671, 3325, 665, 2601, 2539, 2486, 2439, 2432, 2338, 3853, 2721, 3493, 3367, 3285, 3157, 2509, 1176,
|
||||
3010, 3072, 3142, 3221, 3214, 3854, 2602, 3421, 3430, 3347, 3246, 2450, 2878, 1171, 3029, 3101, 3144, 3211, 3843, 2524, 3431, 3384, 3427, 3323,
|
||||
2405, 2932, 2910, 1174, 3129, 3220, 3274, 3875, 2537, 3438, 3430, 3423, 3437, 2359, 3007, 2964, 2972, 1244, 3231, 3272, 3847, 2485, 3451, 3403,
|
||||
3400, 3401, 2347, 3074, 2991, 3063, 3062, 1199, 3284, 3768, 2429, 3399, 3355, 3452, 3430, 2268, 3071, 3065, 3119, 3118, 3127, 1204, 5000, 2658,
|
||||
2608, 2615, 2586, 2540, 5799, 6418, 3130, 5551, 5625, 5716, 5798, 4698, 3596, 3612, 3668, 3691, 3585, 5739, 6344, 5224, 3002, 5476, 5553, 5612,
|
||||
4352, 3621, 3596, 3627, 3658, 3509, 5839, 6483, 5313, 5165, 2933, 5429, 5453, 3930, 3549, 3653, 3640, 3626, 3623, 5988, 6626, 5397, 5238, 5124,
|
||||
2875, 5314, 3545, 3456, 3525, 3624, 3647, 3571, 5947, 6760, 5471, 5290, 5159, 5018, 2757, 3187, 3323, 3388, 3489, 3644, 3577, 5015, 4749, 4434,
|
||||
4131, 3740, 3370, 3035, 692, 2496, 2472, 2440, 2425, 2388, 3839, 2545, 3430, 3445, 3369, 3281, 3167, 2417, 1183, 2964, 3042, 3166, 3235, 3848,
|
||||
2504, 3433, 3417, 3482, 3351, 3217, 2383, 2840, 1190, 3114, 3196, 3224, 3841, 2506, 3500, 3454, 3460, 3448, 3322, 2361, 2891, 2965, 1237, 3223,
|
||||
3274, 3879, 2476, 3503, 3484, 3451, 3475, 3470, 2342, 3033, 3040, 3078, 1251, 3270, 3747, 2424, 3394, 3342, 3430, 3413, 3398, 2300, 3088, 3072,
|
||||
3127, 3111, 1204, 5000, 2582, 2570, 2557, 2516, 5829, 6494, 3113, 5558, 5692, 5742, 5798, 5992, 4658, 3585, 3625, 3678, 3560, 5775, 6477, 5235,
|
||||
3045, 5563, 5619, 5666, 5856, 4389, 3600, 3637, 3644, 3570, 5883, 6588, 5366, 5249, 2992, 5458, 5544, 5732, 3997, 3642, 3597, 3638, 3656, 5968,
|
||||
6707, 5417, 5300, 5148, 2930, 5381, 5567, 3558, 3502, 3634, 3606, 3642, 5913, 6881, 5456, 5354, 5235, 5069, 2812, 5403, 3190, 3375, 3523, 3629,
|
||||
3595, 6003, 6913, 5658, 5519, 5395, 5242, 5094, 2777, 2954, 3303, 3452, 3569, 3670, 5048, 4743, 4407, 4155, 3793, 3381, 3029, 2811, 676, 2426,
|
||||
2420, 2422, 2339, 3766, 2482, 3417, 3431, 3458, 3342, 3221, 3148, 2347, 1190, 3015, 3076, 3165, 3834, 2473, 3452, 3467, 3427, 3458, 3361, 3278,
|
||||
2340, 2882, 1197, 3139, 3202, 3843, 2447, 3490, 3472, 3459, 3432, 3445, 3396, 2332, 2944, 2999, 1246, 3229, 3752, 2399, 3381, 3392, 3484, 3458,
|
||||
3420, 3498, 2265, 3026, 3062, 3084, 1266, 5000, 2548, 2550, 2500, 5828, 6577, 3096, 5565, 5728, 5757, 5826, 5987, 5965, 4698, 3632, 3643, 3566,
|
||||
5808, 6503, 5249, 3022, 5579, 5638, 5707, 5858, 5940, 4368, 3588, 3648, 3555, 5928, 6702, 5403, 5257, 3033, 5543, 5557, 5727, 5847, 4035, 3613,
|
||||
3662, 3683, 5955, 6785, 5411, 5308, 5241, 2954, 5401, 5574, 5691, 3630, 3631, 3644, 3655, 5960, 6930, 5500, 5383, 5228, 5088, 2844, 5433, 5561,
|
||||
3231, 3518, 3634, 3638, 6025, 6985, 5634, 5525, 5410, 5249, 5113, 2832, 5451, 2989, 3451, 3594, 3661, 6022, 7000, 5631, 5612, 5503, 5372, 5257,
|
||||
5144, 2750, 2726, 3304, 3428, 3512, 5033, 4740, 4437, 4142, 3822, 3450, 3075, 2854, 2601, 643, 2384, 2389, 2321, 3804, 2436, 3456, 3413, 3429,
|
||||
3458, 3338, 3277, 3135, 2319, 1185, 3127, 3173, 3819, 2446, 3456, 3467, 3485, 3471, 3466, 3406, 3268, 2315, 2980, 1220, 3250, 3761, 2398, 3387,
|
||||
3376, 3505, 3474, 3457, 3475, 3337, 2251, 3022, 3086, 1217, 5000, 2501, 2447, 5825, 6596, 3084, 5583, 5700, 5780, 5791, 5946, 5970, 6018, 4670,
|
||||
3600, 3475, 5784, 6556, 5269, 3001, 5566, 5647, 5681, 5814, 5946, 5945, 4393, 3554, 3493, 5915, 6726, 5356, 5254, 2967, 5514, 5547, 5711, 5809,
|
||||
5929, 4035, 3586, 3637, 6054, 6873, 5446, 5326, 5198, 2957, 5437, 5563, 5699, 5803, 3685, 3638, 3644, 5984, 6960, 5465, 5352, 5245, 5135, 2854,
|
||||
5454, 5514, 5676, 3268, 3642, 3599, 5978, 6977, 5614, 5499, 5376, 5257, 5144, 2819, 5457, 5596, 3024, 3564, 3654, 6002, 7009, 5628, 5608, 5485,
|
||||
5390, 5216, 5147, 2741, 5418, 2761, 3395, 3460, 6008, 7030, 5678, 5589, 5611, 5470, 5353, 5257, 5096, 2717, 2639, 3393, 3505, 5004, 4755, 4419,
|
||||
4164, 3831, 3511, 3120, 2889, 2646, 2516, 602, 2353, 2310, 3813, 2394, 3423, 3374, 3400, 3443, 3459, 3392, 3240, 3215, 2269, 1157, 3180, 3722,
|
||||
2339, 3299, 3322, 3470, 3454, 3427, 3467, 3283, 3334, 2233, 3041, 1137, 5000, 2375, 5827, 6678, 3015, 5552, 5682, 5732, 5827, 5960, 5957, 5927,
|
||||
5999, 4662, 3459, 5789, 6588, 5228, 2946, 5541, 5632, 5652, 5805, 5922, 5918, 5955, 4384, 3462, 5947, 6775, 5363, 5232, 2943, 5476, 5579, 5668,
|
||||
5788, 5891, 5932, 4052, 3610, 6031, 6882, 5394, 5312, 5170, 2909, 5429, 5577, 5620, 5805, 5921, 3657, 3561, 5921, 7001, 5491, 5341, 5257, 5125,
|
||||
2849, 5435, 5558, 5661, 5795, 3305, 3580, 5940, 6998, 5600, 5474, 5345, 5273, 5122, 2826, 5454, 5552, 5674, 3025, 3584, 5951, 7016, 5610, 5578,
|
||||
5461, 5307, 5240, 5134, 2758, 5391, 5546, 2752, 3467, 5998, 7034, 5598, 5578, 5547, 5469, 5335, 5232, 5086, 2730, 5561, 2632, 3492, 6068, 7074,
|
||||
5659, 5620, 5581, 5558, 5476, 5340, 5239, 5236, 2738, 2552, 3502, 5049, 4739, 4414, 4154, 3842, 3472, 3155, 2881, 2620, 2513, 2441, 587, 2291,
|
||||
3652, 2275, 3279, 3300, 3423, 3395, 3398, 3404, 3287, 3321, 3321, 2219, 1121, 5000, 5908, 6874, 3029, 5681, 5753, 5857, 5881, 6073, 6028, 6053,
|
||||
6076, 6126, 4694, 5882, 6808, 5380, 2975, 5633, 5692, 5709, 5914, 6067, 5991, 6043, 6062, 4383, 6018, 6804, 5415, 5312, 3037, 5509, 5529, 5706,
|
||||
5789, 5915, 5940, 5948, 4163, 6073, 6969, 5525, 5391, 5191, 2981, 5449, 5583, 5696, 5798, 5924, 5966, 3817, 6020, 7054, 5557, 5390, 5214, 5153,
|
||||
2964, 5474, 5560, 5638, 5784, 5945, 3433, 6053, 7056, 5728, 5584, 5378, 5269, 5171, 2981, 5483, 5604, 5747, 5875, 3228, 6047, 7068, 5676, 5712,
|
||||
5451, 5378, 5245, 5181, 2873, 5457, 5583, 5727, 2933, 6072, 7069, 5712, 5643, 5574, 5466, 5323, 5285, 5152, 2880, 5613, 5750, 2805, 6125, 7119,
|
||||
5735, 5701, 5599, 5586, 5447, 5413, 5254, 5283, 2869, 5770, 2717, 6121, 7186, 5773, 5704, 5592, 5618, 5597, 5527, 5403, 5408, 5443, 2859, 2652,
|
||||
5021, 4749, 4448, 4163, 3952, 3622, 3261, 3070, 2802, 2684, 2593, 2527, 725, 5000, 4668, 1577, 4182, 3927, 3620, 3553, 3386, 3299, 3189, 3142,
|
||||
3105, 2885, 4136, 4424, 4003, 1639, 3974, 3869, 3857, 3862, 3827, 3843, 3805, 3796, 3628, 3885, 4185, 3768, 3722, 1772, 3862, 3833, 3780, 3827,
|
||||
3839, 3788, 3824, 3842, 3745, 4113, 3480, 3635, 3606, 1870, 3737, 3744, 3789, 3784, 3799, 3844, 3822, 3515, 4077, 3419, 3606, 3582, 3492, 1864,
|
||||
3727, 3752, 3772, 3815, 3871, 3837, 3367, 3925, 3257, 3613, 3540, 3497, 3480, 1826, 3720, 3765, 3769, 3814, 3824, 3286, 3899, 3164, 3575, 3578,
|
||||
3540, 3515, 3473, 1889, 3695, 3763, 3824, 3816, 3156, 3902, 3070, 3593, 3601, 3543, 3527, 3529, 3444, 1872, 3753, 3773, 3803, 3116, 3902, 3019,
|
||||
3568, 3551, 3558, 3574, 3523, 3510, 3515, 1866, 3796, 3838, 3078, 3925, 2996, 3546, 3583, 3597, 3617, 3556, 3591, 3526, 3539, 1878, 3856, 2896,
|
||||
3841, 2784, 3401, 3599, 3567, 3588, 3580, 3583, 3551, 3595, 3610, 1737, 5000, 1725, 4227, 4005, 3800, 3562, 3547, 3422, 3347, 3312, 3258, 3024,
|
||||
5003, 4155, 4064, 1713, 4101, 4021, 3946, 3962, 3988, 3942, 3953, 3915, 3805, 4772, 3894, 3844, 3850, 1867, 3957, 3918, 3960, 3973, 3977, 3957,
|
||||
3952, 3968, 4623, 3731, 3662, 3760, 3716, 1958, 3853, 3903, 3975, 3948, 3988, 3964, 3942, 4443, 3622, 3425, 3707, 3660, 3597, 1996, 3736, 3863,
|
||||
3865, 3905, 3952, 3932, 4429, 3451, 3398, 3705, 3706, 3666, 3498, 2040, 3870, 3852, 3907, 3971, 4000, 4401, 3355, 3296, 3735, 3725, 3724, 3609,
|
||||
3621, 2064, 3843, 3887, 3936, 3951, 4353, 3304, 3217, 3698, 3731, 3706, 3624, 3606, 3600, 2039, 3887, 3905, 3950, 4338, 3255, 3173, 3694, 3716,
|
||||
3730, 3653, 3661, 3649, 3646, 2062, 3958, 3949, 4334, 3186, 3132, 3687, 3708, 3704, 3691, 3718, 3695, 3651, 3703, 2049, 3944, 4254, 3013, 2918,
|
||||
3561, 3718, 3690, 3685, 3745, 3696, 3689, 3687, 3687, 1929, 5000, 6342, 6483, 6547, 6658, 6768, 6760, 6757, 6796, 6853, 6724, 6699, 6614, 5984,
|
||||
1845, 5268, 5351, 5356, 5347, 5471, 5455, 5479, 5569, 5501, 6677, 6633, 6109, 5022, 1881, 5193, 5200, 5258, 5332, 5460, 5461, 5463, 5539, 6700,
|
||||
6607, 6180, 5102, 4946, 1857, 5059, 5080, 5235, 5365, 5431, 5460, 5472, 6605, 6602, 6276, 5088, 4963, 4817, 1871, 4949, 5096, 5186, 5313, 5399,
|
||||
5430, 6590, 6534, 6366, 5098, 5014, 4836, 4724, 1896, 4979, 5080, 5171, 5310, 5452, 6540, 6536, 6363, 5219, 5091, 4984, 4852, 4752, 1898, 4943,
|
||||
5062, 5185, 5341, 6555, 6546, 6377, 5196, 5182, 5106, 4935, 4840, 4721, 1883, 5103, 5235, 5331, 6604, 6561, 6396, 5204, 5190, 5171, 5061, 4926,
|
||||
4830, 4862, 1924, 5276, 5394, 6633, 6616, 6466, 5308, 5190, 5201, 5132, 5043, 4944, 4989, 5008, 1902, 5450, 6640, 6599, 6344, 5224, 5275, 5208,
|
||||
5153, 5185, 5089, 5058, 5130, 5185, 1870, 5000, 3813, 3583, 3455, 3419, 3309, 3252, 3195, 3121, 2917, 5164, 5073, 4746, 1427, 3656, 3469, 3358,
|
||||
3153, 3222, 3129, 3100, 3001, 2813, 4715, 4583, 3646, 3525, 1499, 3708, 3715, 3714, 3770, 3763, 3739, 3753, 3784, 4560, 4454, 3418, 3348, 3528,
|
||||
1623, 3638, 3669, 3738, 3718, 3783, 3755, 3787, 4426, 4361, 3302, 3236, 3544, 3482, 1756, 3553, 3640, 3717, 3757, 3804, 3777, 4266, 4200, 3248,
|
||||
3018, 3543, 3509, 3389, 1816, 3527, 3661, 3689, 3753, 3747, 4238, 4190, 3143, 3083, 3607, 3569, 3467, 3353, 1854, 3637, 3676, 3695, 3715, 4251,
|
||||
4202, 3092, 3020, 3595, 3545, 3542, 3471, 3449, 1881, 3706, 3728, 3793, 4250, 4192, 3042, 2962, 3570, 3599, 3571, 3511, 3498, 3523, 1876, 3748,
|
||||
3786, 4259, 4224, 2972, 2893, 3576, 3577, 3612, 3562, 3520, 3549, 3563, 1883, 3814, 4190, 4095, 2774, 2710, 3621, 3603, 3595, 3569, 3535, 3612,
|
||||
3606, 3625, 1747, 5000, 3418, 3313, 3259, 3132, 3055, 3019, 3025, 2965, 5584, 5457, 5847, 3002, 4383, 3917, 3839, 3850, 3938, 3887, 3915, 3943,
|
||||
3777, 5184, 5092, 4751, 4176, 1207, 3213, 3096, 2958, 3034, 2929, 2893, 2839, 2784, 4431, 4334, 3264, 3726, 3091, 1427, 3409, 3482, 3488, 3563,
|
||||
3585, 3594, 3616, 4273, 4243, 3167, 3654, 2981, 3261, 1549, 3405, 3490, 3526, 3574, 3627, 3642, 4217, 4131, 3107, 3671, 2856, 3333, 3248, 1636,
|
||||
3414, 3491, 3567, 3619, 3634, 4150, 4068, 2992, 3754, 2913, 3335, 3315, 3248, 1680, 3472, 3558, 3566, 3626, 4110, 4053, 2913, 3714, 2822, 3398,
|
||||
3359, 3312, 3309, 1664, 3535, 3574, 3614, 4142, 4093, 2880, 3721, 2783, 3416, 3412, 3405, 3391, 3367, 1689, 3590, 3659, 4146, 4099, 2869, 3742,
|
||||
2721, 3424, 3451, 3460, 3396, 3403, 3418, 1704, 3691, 4091, 4034, 2819, 3603, 2665, 3447, 3482, 3453, 3454, 3442, 3473, 3499, 1711, 5000, 3176,
|
||||
3137, 3012, 2918, 2895, 2876, 2809, 5741, 5645, 6087, 3000, 5442, 4326, 3762, 3770, 3848, 3777, 3790, 3816, 3728, 5886, 5760, 6230, 5136, 2949,
|
||||
3920, 3662, 3675, 3728, 3838, 3808, 3797, 3853, 5209, 5109, 4754, 4112, 3733, 1038, 2976, 2787, 2857, 2787, 2732, 2742, 2655, 4195, 4147, 3045,
|
||||
3584, 3498, 2880, 1385, 3274, 3333, 3378, 3469, 3490, 3473, 4147, 4045, 2996, 3601, 3515, 2694, 3116, 1472, 3295, 3377, 3445, 3507, 3482, 4120,
|
||||
4038, 2884, 3672, 3556, 2754, 3176, 3130, 1526, 3354, 3403, 3467, 3470, 4107, 4035, 2791, 3601, 3657, 2666, 3225, 3214, 3204, 1536, 3389, 3483,
|
||||
3503, 4068, 4005, 2758, 3607, 3620, 2618, 3303, 3283, 3242, 3220, 1500, 3451, 3500, 4112, 4054, 2732, 3629, 3622, 2628, 3335, 3340, 3312, 3306,
|
||||
3270, 1562, 3518, 3998, 3938, 2684, 3547, 3668, 2560, 3321, 3329, 3314, 3333, 3330, 3348, 1545, 5000, 2993, 2887, 2801, 2779, 2731, 2701, 5775,
|
||||
5679, 6157, 3023, 5535, 5618, 4323, 3697, 3734, 3709, 3704, 3675, 3631, 5887, 5773, 6328, 5218, 2959, 5482, 3933, 3566, 3651, 3741, 3703, 3707,
|
||||
3765, 6017, 5878, 6436, 5303, 5181, 2896, 3545, 3488, 3556, 3621, 3751, 3717, 3706, 5095, 5079, 4756, 4101, 3752, 3388, 864, 2618, 2714, 2637,
|
||||
2643, 2575, 2527, 3983, 3982, 2861, 3525, 3405, 3314, 2530, 1335, 3134, 3213, 3286, 3340, 3372, 3971, 3971, 2765, 3566, 3469, 3370, 2607, 3000,
|
||||
1381, 3167, 3241, 3322, 3366, 3959, 3981, 2686, 3539, 3537, 3445, 2535, 3076, 3027, 1387, 3276, 3344, 3372, 3991, 4001, 2653, 3520, 3515, 3576,
|
||||
2542, 3133, 3082, 3120, 1404, 3345, 3427, 3970, 3956, 2596, 3497, 3542, 3541, 2485, 3193, 3162, 3185, 3188, 1396, 3418, 3885, 3895, 2567, 3455,
|
||||
3581, 3526, 2437, 3216, 3200, 3205, 3259, 3247, 1417, 5000, 2691, 2626, 2624, 2596, 2490, 5721, 5631, 6216, 2976, 5541, 5622, 5732, 4332, 3614,
|
||||
3561, 3585, 3617, 3529, 5864, 5743, 6362, 5222, 2933, 5463, 5572, 3938, 3536, 3583, 3593, 3612, 3600, 5978, 5843, 6495, 5311, 5149, 2881, 5421,
|
||||
3542, 3427, 3490, 3607, 3601, 3591, 5924, 5955, 6608, 5417, 5254, 5114, 2784, 3178, 3324, 3404, 3528, 3668, 3579, 5031, 5006, 4762, 4110, 3740,
|
||||
3370, 3023, 701, 2544, 2476, 2453, 2426, 2379, 3840, 3808, 2581, 3437, 3352, 3263, 3156, 2460, 1188, 2942, 3072, 3162, 3205, 3828, 3819, 2520,
|
||||
3382, 3393, 3325, 3251, 2397, 2811, 1215, 3094, 3178, 3242, 3880, 3839, 2500, 3415, 3420, 3428, 3365, 2365, 2942, 2953, 1229, 3223, 3285, 3872,
|
||||
3834, 2469, 3439, 3439, 3431, 3487, 2336, 3016, 3022, 3071, 1268, 3269, 3764, 3715, 2377, 3357, 3436, 3423, 3401, 2294, 3056, 3078, 3130, 3110,
|
||||
1227, 5000, 2616, 2576, 2569, 2525, 5823, 5680, 6314, 3078, 5635, 5688, 5770, 5823, 4391, 3584, 3638, 3672, 3568, 5912, 5834, 6494, 5316, 2987,
|
||||
5572, 5629, 5711, 3979, 3656, 3612, 3635, 3681, 6003, 5893, 6592, 5365, 5267, 2940, 5478, 5531, 3582, 3534, 3646, 3648, 3641, 5991, 6021, 6728,
|
||||
5439, 5294, 5154, 2855, 5412, 3261, 3436, 3579, 3678, 3646, 6017, 6046, 6907, 5490, 5379, 5217, 5095, 2786, 2977, 3346, 3433, 3553, 3661, 5054,
|
||||
5045, 4745, 4153, 3764, 3409, 3107, 2843, 732, 2464, 2423, 2431, 2394, 3850, 3820, 2512, 3411, 3483, 3372, 3290, 3180, 2389, 1230, 3026, 3138,
|
||||
3197, 3874, 3830, 2465, 3466, 3439, 3474, 3402, 3272, 2333, 2893, 1241, 3170, 3236, 3890, 3848, 2453, 3494, 3468, 3468, 3490, 3388, 2348, 2990,
|
||||
3022, 1296, 3271, 3796, 3755, 2413, 3399, 3501, 3463, 3468, 3469, 2313, 3053, 3090, 3115, 1301, 5000, 2552, 2572, 2533, 5804, 5694, 6367, 3056,
|
||||
5652, 5714, 5771, 5815, 5986, 4392, 3610, 3638, 3565, 5958, 5849, 6547, 5313, 3056, 5612, 5657, 5729, 5869, 4052, 3654, 3668, 3686, 6021, 5922,
|
||||
6687, 5396, 5284, 2968, 5468, 5571, 5760, 3613, 3651, 3645, 3663, 6008, 6056, 6804, 5437, 5326, 5154, 2912, 5424, 5586, 3289, 3557, 3679, 3668,
|
||||
6002, 6015, 6967, 5489, 5390, 5258, 5128, 2828, 5485, 2980, 3441, 3587, 3662, 6019, 6025, 6957, 5640, 5530, 5433, 5289, 5171, 2763, 2769, 3334,
|
||||
3471, 3557, 5045, 4997, 4757, 4158, 3849, 3437, 3141, 2844, 2630, 679, 2455, 2418, 2377, 3828, 3785, 2453, 3426, 3481, 3475, 3383, 3269, 3169,
|
||||
2372, 1228, 3124, 3195, 3844, 3848, 2448, 3463, 3486, 3459, 3492, 3407, 3302, 2340, 2979, 1226, 3237, 3780, 3735, 2429, 3397, 3501, 3485, 3479,
|
||||
3471, 3384, 2299, 3043, 3083, 1256, 5000, 2497, 2448, 5831, 5681, 6425, 3017, 5615, 5731, 5741, 5812, 6004, 5992, 4402, 3564, 3503, 5971, 5840,
|
||||
6586, 5287, 3006, 5595, 5632, 5712, 5859, 5969, 4047, 3594, 3618, 6100, 5934, 6723, 5398, 5266, 2996, 5531, 5610, 5688, 5860, 3682, 3628, 3635,
|
||||
5971, 6023, 6836, 5435, 5299, 5232, 2906, 5436, 5596, 5722, 3285, 3684, 3655, 5964, 5948, 6962, 5480, 5389, 5293, 5125, 2820, 5450, 5582, 3000,
|
||||
3548, 3637, 5994, 6001, 7011, 5652, 5544, 5375, 5277, 5130, 2797, 5454, 2824, 3410, 3526, 6041, 6001, 7010, 5658, 5630, 5517, 5380, 5273, 5139,
|
||||
2773, 2658, 3430, 3525, 5047, 5032, 4751, 4178, 3845, 3502, 3119, 2860, 2693, 2541, 662, 2385, 2344, 3841, 3797, 2390, 3387, 3423, 3433, 3500,
|
||||
3377, 3238, 3271, 2307, 1205, 3221, 3728, 3699, 2350, 3333, 3436, 3455, 3471, 3447, 3353, 3366, 2267, 3061, 1194, 5000, 2408, 5808, 5704, 6519,
|
||||
2975, 5591, 5640, 5773, 5796, 5999, 5943, 6019, 4376, 3454, 5971, 5816, 6602, 5272, 2969, 5561, 5642, 5673, 5817, 5973, 5989, 4019, 3577, 6002,
|
||||
5911, 6723, 5321, 5227, 2921, 5524, 5522, 5697, 5825, 5962, 3665, 3613, 5971, 5997, 6862, 5438, 5312, 5216, 2904, 5486, 5598, 5676, 5797, 3371,
|
||||
3602, 5961, 5921, 6985, 5464, 5363, 5200, 5175, 2813, 5448, 5539, 5694, 3033, 3640, 5968, 5960, 6998, 5656, 5489, 5369, 5268, 5124, 2783, 5403,
|
||||
5553, 2818, 3480, 5983, 5987, 7033, 5615, 5624, 5485, 5363, 5216, 5097, 2740, 5595, 2677, 3523, 6036, 6035, 7086, 5678, 5643, 5611, 5460, 5374,
|
||||
5234, 5261, 2771, 2589, 3509, 5060, 5040, 4762, 4153, 3809, 3495, 3212, 2883, 2693, 2557, 2465, 634, 2352, 3710, 3668, 2310, 3283, 3413, 3431,
|
||||
3431, 3449, 3334, 3347, 3330, 2278, 1180, 5000, 5957, 5842, 6705, 2983, 5700, 5766, 5838, 5971, 6080, 6040, 6069, 6101, 4401, 5999, 5911, 6652,
|
||||
5375, 3062, 5576, 5592, 5703, 5847, 5962, 5944, 6008, 4202, 6121, 6000, 6783, 5432, 5264, 3016, 5527, 5600, 5740, 5829, 5998, 6010, 3802, 6043,
|
||||
6049, 6891, 5506, 5285, 5217, 3021, 5477, 5596, 5696, 5844, 6009, 3513, 6035, 6044, 7071, 5644, 5377, 5277, 5148, 2974, 5489, 5605, 5718, 5896,
|
||||
3214, 6050, 6057, 7078, 5725, 5516, 5408, 5281, 5174, 2941, 5442, 5581, 5756, 2968, 6080, 6061, 7043, 5703, 5614, 5509, 5365, 5286, 5134, 2916,
|
||||
5605, 5751, 2836, 6098, 6133, 7144, 5720, 5587, 5652, 5497, 5378, 5255, 5291, 2903, 5802, 2786, 6142, 6152, 7149, 5750, 5659, 5658, 5663, 5549,
|
||||
5436, 5431, 5465, 2908, 2683, 5035, 5032, 4756, 4176, 3990, 3609, 3348, 3062, 2834, 2707, 2653, 2564, 774, 5000, 4672, 4592, 1556, 3880, 3603,
|
||||
3533, 3361, 3301, 3219, 3140, 3088, 2918, 3907, 4237, 4116, 3724, 1801, 3816, 3751, 3797, 3862, 3848, 3815, 3846, 3821, 3765, 4124, 4005, 3473,
|
||||
3563, 1877, 3750, 3790, 3807, 3826, 3853, 3839, 3838, 3517, 4099, 3975, 3397, 3509, 3498, 1913, 3747, 3783, 3830, 3830, 3858, 3847, 3418, 4008,
|
||||
4010, 3238, 3560, 3535, 3514, 1910, 3748, 3757, 3821, 3852, 3919, 3297, 3944, 3888, 3175, 3615, 3561, 3547, 3498, 1893, 3725, 3784, 3805, 3828,
|
||||
3194, 3933, 3941, 3102, 3617, 3591, 3593, 3498, 3482, 1930, 3805, 3811, 3874, 3153, 3941, 3916, 3031, 3589, 3612, 3574, 3580, 3539, 3569, 1910,
|
||||
3862, 3840, 3113, 3945, 3935, 2968, 3603, 3583, 3603, 3618, 3565, 3558, 3609, 1910, 3898, 2950, 3842, 3806, 2820, 3576, 3586, 3606, 3662, 3577,
|
||||
3625, 3588, 3645, 1819, 5000, 4672, 1733, 3968, 3806, 3518, 3547, 3451, 3368, 3288, 3272, 3030, 4782, 3947, 4273, 3819, 1859, 3925, 3914, 4014,
|
||||
3990, 3965, 3969, 3947, 3994, 4661, 3774, 4100, 3658, 3677, 1966, 3880, 3945, 3941, 3968, 3965, 4002, 3976, 4538, 3700, 4065, 3388, 3674, 3641,
|
||||
2083, 3846, 3858, 3922, 3960, 4044, 4009, 4492, 3494, 4065, 3407, 3759, 3703, 3602, 2070, 3840, 3932, 3947, 4027, 4008, 4370, 3369, 4048, 3308,
|
||||
3739, 3698, 3612, 3582, 2063, 3859, 3905, 3913, 3943, 4390, 3334, 4040, 3243, 3736, 3723, 3652, 3697, 3626, 2106, 3897, 3972, 3951, 4383, 3285,
|
||||
4047, 3147, 3717, 3712, 3714, 3710, 3671, 3651, 2091, 3949, 3999, 4403, 3256, 4028, 3142, 3693, 3739, 3786, 3773, 3667, 3714, 3697, 2098, 4085,
|
||||
4317, 3055, 3896, 2932, 3755, 3745, 3746, 3773, 3686, 3695, 3741, 3826, 1965, 5000, 1927, 3999, 3839, 3746, 3558, 3622, 3527, 3480, 3390, 3218,
|
||||
4941, 4825, 3994, 3854, 1894, 4058, 4071, 4081, 4119, 4119, 4092, 4118, 4141, 4796, 4705, 3769, 3703, 3814, 2025, 3985, 4037, 4096, 4070, 4138,
|
||||
4120, 4141, 4675, 4597, 3671, 3595, 3819, 3745, 2147, 3895, 3998, 4068, 4110, 4151, 4122, 4529, 4472, 3610, 3410, 3839, 3792, 3655, 2195, 3885,
|
||||
4026, 4048, 4104, 4113, 4503, 4468, 3523, 3473, 3875, 3840, 3724, 3646, 2228, 3992, 4029, 4067, 4058, 4525, 4469, 3465, 3389, 3863, 3811, 3819,
|
||||
3766, 3740, 2262, 4079, 4078, 4130, 4525, 4456, 3409, 3334, 3835, 3888, 3850, 3798, 3784, 3820, 2246, 4096, 4135, 4519, 4479, 3350, 3256, 3874,
|
||||
3871, 3902, 3867, 3800, 3814, 3834, 2274, 4156, 4436, 4356, 3185, 3095, 3908, 3878, 3883, 3853, 3803, 3873, 3868, 3890, 2135, 5000, 6373, 6459,
|
||||
6590, 6680, 6805, 6769, 6828, 6887, 6776, 6840, 6752, 6653, 6015, 1874, 5330, 5341, 5387, 5368, 5511, 5531, 5594, 5657, 6813, 6727, 6650, 6104,
|
||||
5073, 1890, 5215, 5237, 5235, 5399, 5540, 5567, 5610, 6711, 6687, 6629, 6218, 5099, 4971, 1865, 5107, 5136, 5301, 5425, 5532, 5496, 6652, 6647,
|
||||
6672, 6286, 5146, 4993, 4871, 1901, 5019, 5192, 5318, 5417, 5519, 6589, 6613, 6576, 6415, 5102, 4984, 4886, 4794, 1923, 4993, 5138, 5242, 5370,
|
||||
6635, 6625, 6590, 6391, 5235, 5142, 5053, 4957, 4762, 1927, 5148, 5273, 5432, 6710, 6653, 6630, 6456, 5261, 5274, 5171, 5074, 4884, 4907, 1944,
|
||||
5331, 5468, 6728, 6707, 6674, 6495, 5318, 5287, 5255, 5154, 4986, 5025, 5073, 1968, 5520, 6720, 6685, 6667, 6377, 5373, 5351, 5239, 5260, 5123,
|
||||
5176, 5201, 5245, 1903, 5000, 3395, 3309, 3279, 3293, 3202, 3189, 3109, 3091, 5469, 5404, 5326, 4755, 1378, 3283, 3198, 3152, 3010, 3131, 3081,
|
||||
3038, 2983, 4580, 4424, 4331, 3265, 3167, 1448, 3545, 3582, 3627, 3692, 3766, 3766, 3781, 4390, 4379, 4241, 3163, 3084, 3379, 1603, 3562, 3579,
|
||||
3692, 3718, 3772, 3766, 4344, 4277, 4238, 3135, 3032, 3430, 3386, 1729, 3536, 3661, 3722, 3765, 3810, 4227, 4204, 4150, 3137, 2907, 3459, 3419,
|
||||
3362, 1803, 3471, 3645, 3681, 3723, 4250, 4200, 4149, 3048, 3004, 3528, 3518, 3481, 3319, 1829, 3689, 3701, 3773, 4290, 4207, 4167, 3036, 2947,
|
||||
3594, 3540, 3552, 3474, 3502, 1864, 3762, 3821, 4251, 4217, 4190, 2951, 2903, 3598, 3599, 3589, 3508, 3516, 3570, 1874, 3819, 4214, 4141, 4088,
|
||||
2940, 2864, 3601, 3599, 3631, 3541, 3583, 3631, 3628, 1889, 5000, 3153, 3168, 3157, 3071, 3042, 3008, 2922, 5962, 5848, 5733, 6259, 3047, 4006,
|
||||
3778, 3828, 3884, 3994, 3924, 3944, 3920, 5466, 5437, 5361, 4744, 3821, 1214, 3039, 3013, 2889, 2981, 2922, 2896, 2834, 4356, 4335, 4177, 3028,
|
||||
3608, 2931, 1457, 3394, 3478, 3545, 3578, 3685, 3638, 4304, 4225, 4160, 3029, 3645, 2910, 3238, 1591, 3433, 3526, 3604, 3652, 3655, 4278, 4170,
|
||||
4107, 3014, 3704, 2780, 3312, 3273, 1685, 3481, 3516, 3607, 3624, 4251, 4150, 4068, 2924, 3792, 2834, 3377, 3380, 3316, 1723, 3544, 3645, 3616,
|
||||
4181, 4131, 4067, 2889, 3732, 2803, 3432, 3442, 3342, 3372, 1701, 3609, 3613, 4213, 4146, 4145, 2868, 3754, 2772, 3526, 3494, 3438, 3461, 3432,
|
||||
1746, 3714, 4146, 4087, 4028, 2786, 3735, 2713, 3471, 3493, 3440, 3436, 3429, 3544, 1727, 5000, 2985, 3019, 2950, 2894, 2852, 2845, 6051, 5907,
|
||||
5809, 6322, 3034, 5609, 4027, 3721, 3804, 3864, 3830, 3816, 3876, 6127, 5975, 5891, 6451, 5310, 2988, 3621, 3620, 3683, 3776, 3856, 3850, 3846,
|
||||
5450, 5446, 5356, 4758, 3830, 3451, 1047, 2823, 2709, 2800, 2795, 2794, 2729, 4147, 4148, 4075, 2876, 3544, 3441, 2719, 1395, 3259, 3353, 3430,
|
||||
3511, 3558, 4088, 4122, 4020, 2882, 3616, 3503, 2617, 3113, 1524, 3287, 3401, 3462, 3514, 4090, 4066, 4020, 2811, 3664, 3592, 2695, 3203, 3117,
|
||||
1554, 3419, 3469, 3510, 4096, 4103, 4049, 2763, 3643, 3676, 2689, 3269, 3242, 3258, 1549, 3467, 3571, 4073, 4116, 4003, 2715, 3638, 3660, 2690,
|
||||
3350, 3295, 3308, 3309, 1575, 3570, 4059, 4055, 3937, 2717, 3697, 3669, 2628, 3401, 3344, 3344, 3393, 3393, 1599, 5000, 2875, 2766, 2730, 2713,
|
||||
2656, 5975, 5870, 5789, 6354, 3004, 5623, 5697, 4039, 3655, 3715, 3684, 3744, 3743, 6116, 5973, 5865, 6452, 5311, 2935, 5585, 3596, 3545, 3617,
|
||||
3761, 3767, 3743, 6082, 6076, 5954, 6621, 5371, 5258, 2887, 3274, 3432, 3558, 3685, 3780, 3734, 5368, 5366, 5356, 4737, 3835, 3422, 3127, 865,
|
||||
2552, 2680, 2640, 2634, 2571, 3943, 3932, 3952, 2745, 3474, 3383, 3283, 2475, 1358, 3109, 3217, 3322, 3320, 3950, 3930, 3963, 2645, 3531, 3456,
|
||||
3397, 2586, 2969, 1374, 3234, 3311, 3377, 3978, 3966, 3967, 2600, 3515, 3587, 3506, 2537, 3067, 3090, 1359, 3368, 3430, 4025, 3977, 3974, 2594,
|
||||
3575, 3593, 3589, 2522, 3173, 3164, 3219, 1432, 3432, 3906, 3866, 3808, 2542, 3564, 3566, 3554, 2471, 3167, 3221, 3248, 3268, 1405, 5000, 2605,
|
||||
2567, 2581, 2542, 5950, 5850, 5704, 6338, 3020, 5573, 5688, 5771, 3977, 3558, 3627, 3653, 3693, 6060, 5940, 5791, 6465, 5266, 2931, 5514, 5628,
|
||||
3590, 3534, 3648, 3641, 3619, 5990, 6038, 5894, 6584, 5361, 5209, 2870, 5460, 3277, 3457, 3558, 3679, 3619, 6008, 6003, 6010, 6726, 5428, 5311,
|
||||
5155, 2830, 3010, 3372, 3473, 3612, 3631, 5291, 5294, 5290, 4748, 3784, 3409, 3126, 2879, 724, 2477, 2458, 2414, 2409, 3864, 3842, 3817, 2496,
|
||||
3403, 3364, 3282, 3212, 2389, 1214, 3022, 3157, 3206, 3880, 3842, 3794, 2460, 3457, 3470, 3384, 3308, 2377, 2893, 1282, 3198, 3249, 3914, 3868,
|
||||
3794, 2474, 3482, 3465, 3500, 3437, 2334, 3009, 3046, 1303, 3287, 3795, 3727, 3719, 2442, 3512, 3447, 3429, 3460, 2324, 3061, 3098, 3137, 1276,
|
||||
5000, 2594, 2561, 2528, 6035, 5891, 5744, 6429, 3053, 5676, 5718, 5800, 5891, 4095, 3670, 3668, 3699, 6095, 5975, 5851, 6542, 5347, 2999, 5555,
|
||||
5676, 5708, 3661, 3683, 3688, 3693, 6028, 6047, 5922, 6665, 5382, 5250, 2947, 5519, 5611, 3314, 3591, 3725, 3676, 6054, 6033, 6070, 6833, 5450,
|
||||
5366, 5216, 2893, 5433, 3055, 3520, 3597, 3731, 6037, 6025, 6047, 6951, 5558, 5388, 5285, 5123, 2767, 2792, 3315, 3477, 3560, 5343, 5321, 5300,
|
||||
4751, 3890, 3482, 3153, 2917, 2673, 710, 2500, 2515, 2459, 3900, 3849, 3796, 2486, 3492, 3495, 3417, 3350, 3166, 2418, 1279, 3173, 3258, 3926,
|
||||
3864, 3850, 2451, 3481, 3499, 3536, 3433, 3314, 2429, 3029, 1305, 3316, 3805, 3803, 3781, 2428, 3514, 3504, 3495, 3556, 3383, 2360, 3116, 3165,
|
||||
1264, 5000, 2515, 2476, 6005, 5839, 5724, 6435, 3033, 5661, 5707, 5795, 5860, 6015, 4095, 3613, 3657, 6072, 5968, 5851, 6571, 5323, 3006, 5599,
|
||||
5648, 5722, 5886, 3692, 3662, 3652, 6014, 6025, 5961, 6710, 5377, 5283, 2929, 5519, 5582, 5723, 3316, 3675, 3656, 6017, 6007, 6040, 6852, 5481,
|
||||
5328, 5211, 2887, 5475, 5627, 3041, 3593, 3708, 6030, 5988, 5993, 7028, 5531, 5390, 5256, 5156, 2794, 5451, 2797, 3434, 3548, 6047, 6034, 6034,
|
||||
6999, 5658, 5542, 5412, 5307, 5155, 2801, 2736, 3451, 3571, 5324, 5302, 5288, 4757, 3882, 3509, 3157, 2898, 2680, 2615, 693, 2469, 2402, 3826,
|
||||
3813, 3770, 2407, 3436, 3477, 3501, 3413, 3274, 3282, 2388, 1244, 3217, 3766, 3761, 3742, 2370, 3476, 3478, 3478, 3524, 3379, 3411, 2326, 3070,
|
||||
1240, 5000, 2403, 5924, 5848, 5715, 6494, 2978, 5599, 5670, 5756, 5841, 6020, 6011, 4044, 3578, 6041, 5942, 5828, 6599, 5281, 2928, 5564, 5643,
|
||||
5727, 5861, 5991, 3679, 3610, 6027, 6057, 5942, 6744, 5358, 5260, 2945, 5551, 5571, 5686, 5850, 3396, 3685, 6009, 5964, 6008, 6891, 5443, 5323,
|
||||
5229, 2894, 5416, 5577, 5710, 3123, 3678, 6007, 5974, 5956, 7013, 5505, 5385, 5249, 5106, 2775, 5414, 5553, 2838, 3523, 6000, 5977, 5999, 7043,
|
||||
5670, 5530, 5359, 5272, 5098, 2798, 5595, 2735, 3536, 6015, 6063, 6055, 7064, 5658, 5644, 5520, 5389, 5220, 5280, 2808, 2632, 3543, 5307, 5322,
|
||||
5314, 4753, 3841, 3506, 3229, 2984, 2712, 2619, 2514, 649, 2386, 3743, 3742, 3699, 2301, 3402, 3443, 3491, 3503, 3357, 3368, 3361, 2303, 1226,
|
||||
5000, 6077, 5938, 5851, 6539, 3058, 5626, 5702, 5791, 5885, 5971, 5982, 6006, 4233, 6134, 6021, 5896, 6693, 5306, 3059, 5605, 5705, 5707, 5858,
|
||||
6025, 6039, 3837, 6111, 6089, 5980, 6780, 5394, 5267, 3031, 5550, 5579, 5736, 5881, 6057, 3529, 6077, 6104, 6095, 6943, 5462, 5381, 5245, 3022,
|
||||
5499, 5619, 5807, 5928, 3281, 6061, 6044, 6048, 7069, 5539, 5382, 5264, 5191, 2958, 5456, 5589, 5719, 2983, 6054, 6066, 6074, 7053, 5627, 5524,
|
||||
5414, 5293, 5130, 2942, 5624, 5739, 2851, 6136, 6136, 6123, 7099, 5639, 5682, 5544, 5457, 5277, 5316, 2930, 5801, 2800, 6145, 6142, 6157, 7151,
|
||||
5664, 5703, 5691, 5592, 5400, 5407, 5468, 2965, 2756, 5346, 5319, 5291, 4751, 4010, 3645, 3357, 3129, 2851, 2726, 2680, 2635, 811, 5000, 4663,
|
||||
4552, 4336, 1371, 3399, 3364, 3210, 3093, 3046, 3005, 2943, 2920, 3569, 3955, 3843, 3776, 3283, 1669, 3524, 3560, 3636, 3696, 3697, 3687, 3663,
|
||||
3385, 3921, 3852, 3688, 3245, 3280, 1685, 3568, 3637, 3655, 3689, 3706, 3725, 3247, 3867, 3851, 3763, 3088, 3332, 3333, 1747, 3571, 3614, 3645,
|
||||
3704, 3770, 3140, 3841, 3836, 3773, 2987, 3391, 3416, 3334, 1724, 3548, 3633, 3702, 3768, 3071, 3810, 3755, 3725, 2947, 3462, 3397, 3392, 3317,
|
||||
1708, 3626, 3716, 3720, 3043, 3818, 3780, 3761, 2901, 3445, 3447, 3408, 3394, 3397, 1782, 3726, 3762, 3000, 3805, 3789, 3818, 2830, 3439, 3469,
|
||||
3456, 3459, 3461, 3481, 1753, 3785, 2943, 3724, 3749, 3683, 2819, 3436, 3488, 3530, 3512, 3465, 3516, 3528, 1760, 5000, 4672, 4392, 1520, 3549,
|
||||
3364, 3384, 3233, 3186, 3144, 3093, 3070, 4545, 3604, 3996, 3881, 3425, 1764, 3679, 3705, 3805, 3787, 3838, 3800, 3862, 4391, 3507, 3941, 3838,
|
||||
3240, 3441, 1872, 3680, 3717, 3768, 3790, 3874, 3830, 4337, 3367, 3994, 3869, 3269, 3469, 3454, 1873, 3693, 3742, 3837, 3826, 3952, 4309, 3288,
|
||||
3893, 3893, 3127, 3561, 3469, 3469, 1879, 3704, 3774, 3850, 3845, 4273, 3162, 3874, 3846, 3071, 3545, 3533, 3511, 3467, 1889, 3837, 3798, 3856,
|
||||
4287, 3132, 3916, 3902, 3031, 3601, 3551, 3593, 3542, 3584, 1892, 3845, 3868, 4313, 3083, 3920, 3896, 2973, 3575, 3608, 3612, 3600, 3546, 3600,
|
||||
1936, 3910, 4226, 3079, 3845, 3814, 2956, 3609, 3600, 3688, 3604, 3612, 3613, 3648, 1936, 5000, 4480, 1697, 3602, 3497, 3357, 3449, 3348, 3297,
|
||||
3260, 3201, 4692, 4575, 3628, 4003, 3470, 1835, 3799, 3853, 3859, 3935, 3948, 3959, 3980, 4526, 4517, 3554, 3930, 3375, 3556, 1951, 3769, 3855,
|
||||
3898, 3953, 3996, 4016, 4482, 4405, 3486, 3962, 3240, 3608, 3521, 2034, 3787, 3850, 3931, 4001, 4000, 4434, 4340, 3377, 4028, 3316, 3612, 3629,
|
||||
3553, 2073, 3858, 3944, 3933, 4001, 4385, 4315, 3309, 3986, 3230, 3699, 3648, 3609, 3612, 2066, 3903, 3929, 3985, 4416, 4352, 3278, 4000, 3176,
|
||||
3716, 3702, 3705, 3690, 3643, 2077, 3958, 4013, 4403, 4375, 3267, 4027, 3135, 3712, 3759, 3735, 3675, 3688, 3706, 2101, 4052, 4364, 4318, 3187,
|
||||
3900, 3078, 3753, 3757, 3746, 3747, 3726, 3760, 3798, 2106, 5000, 1866, 3664, 3592, 3560, 3422, 3528, 3480, 3420, 3362, 4812, 4653, 4583, 3618,
|
||||
3541, 1866, 3903, 3939, 4014, 4057, 4129, 4132, 4140, 4645, 4635, 4489, 3544, 3466, 3657, 2000, 3925, 3960, 4038, 4077, 4126, 4146, 4627, 4547,
|
||||
4512, 3501, 3420, 3697, 3673, 2127, 3875, 4018, 4096, 4128, 4164, 4500, 4467, 4407, 3518, 3295, 3751, 3692, 3643, 2188, 3863, 4003, 4044, 4080,
|
||||
4515, 4460, 4391, 3434, 3389, 3802, 3805, 3767, 3613, 2219, 4043, 4072, 4124, 4540, 4476, 4431, 3409, 3345, 3867, 3844, 3815, 3745, 3798, 2257,
|
||||
4129, 4176, 4511, 4496, 4455, 3339, 3277, 3884, 3866, 3870, 3780, 3809, 3873, 2253, 4172, 4491, 4407, 4359, 3309, 3220, 3878, 3883, 3895, 3825,
|
||||
3868, 3910, 3914, 2266, 5000, 6395, 6511, 6606, 6735, 6856, 6878, 6958, 6989, 6879, 6764, 6690, 6612, 6043, 1862, 5316, 5374, 5374, 5440, 5636,
|
||||
5642, 5667, 6772, 6775, 6686, 6623, 6155, 5066, 1855, 5233, 5313, 5337, 5491, 5598, 5606, 6731, 6709, 6717, 6652, 6227, 5112, 4996, 1899, 5184,
|
||||
5208, 5357, 5479, 5582, 6691, 6667, 6649, 6615, 6356, 5123, 5066, 4932, 1930, 5044, 5178, 5313, 5479, 6652, 6634, 6596, 6592, 6475, 5186, 5077,
|
||||
4968, 4801, 1888, 5162, 5326, 5452, 6705, 6682, 6637, 6621, 6488, 5360, 5239, 5117, 4942, 4923, 1975, 5374, 5518, 6746, 6706, 6660, 6687, 6550,
|
||||
5367, 5328, 5209, 5071, 5081, 5119, 1984, 5518, 6679, 6621, 6593, 6599, 6589, 5397, 5335, 5316, 5225, 5194, 5250, 5259, 1952, 5000, 3147, 3152,
|
||||
3183, 3191, 3128, 3116, 3092, 5833, 5770, 5737, 5660, 4752, 1350, 3074, 3044, 3041, 2972, 3079, 3032, 2997, 4513, 4436, 4295, 4170, 3025, 2974,
|
||||
1456, 3489, 3566, 3587, 3725, 3795, 3761, 4417, 4338, 4332, 4144, 3019, 2933, 3324, 1609, 3541, 3599, 3693, 3732, 3792, 4373, 4329, 4195, 4191,
|
||||
3033, 2912, 3407, 3381, 1718, 3500, 3614, 3709, 3791, 4294, 4207, 4162, 4105, 3036, 2863, 3439, 3440, 3325, 1784, 3514, 3685, 3720, 4325, 4244,
|
||||
4181, 4132, 2975, 2945, 3568, 3522, 3440, 3345, 1835, 3737, 3777, 4367, 4289, 4215, 4170, 2968, 2904, 3615, 3559, 3527, 3508, 3553, 1871, 3838,
|
||||
4377, 4267, 4191, 4150, 2936, 2875, 3596, 3612, 3602, 3527, 3586, 3633, 1876, 5000, 2979, 3013, 3058, 3028, 2973, 2973, 6196, 6097, 5976, 5878,
|
||||
6458, 3006, 3635, 3732, 3775, 3855, 3949, 3916, 3976, 5786, 5775, 5736, 5643, 4750, 3473, 1180, 2874, 2881, 2761, 2947, 2887, 2891, 4276, 4321,
|
||||
4201, 4073, 2860, 3552, 2790, 1421, 3334, 3422, 3538, 3623, 3694, 4241, 4211, 4133, 4094, 2874, 3605, 2780, 3189, 1567, 3378, 3528, 3586, 3638,
|
||||
4161, 4209, 4113, 4065, 2912, 3679, 2660, 3247, 3236, 1693, 3473, 3545, 3632, 4221, 4218, 4138, 4073, 2892, 3772, 2830, 3384, 3363, 3310, 1697,
|
||||
3598, 3693, 4211, 4184, 4134, 4116, 2833, 3721, 2786, 3455, 3421, 3385, 3429, 1697, 3694, 4222, 4227, 4175, 4077, 2839, 3785, 2779, 3517, 3464,
|
||||
3442, 3495, 3524, 1774, 5000, 2811, 2894, 2863, 2836, 2806, 6190, 6098, 5968, 5805, 6466, 2988, 5703, 3635, 3636, 3704, 3848, 3831, 3858, 6133,
|
||||
6196, 6047, 5904, 6641, 5378, 2920, 3280, 3539, 3648, 3752, 3867, 3827, 5748, 5729, 5711, 5638, 4741, 3477, 3138, 1025, 2711, 2633, 2777, 2764,
|
||||
2725, 4077, 4045, 4071, 4015, 2681, 3460, 3385, 2616, 1398, 3221, 3308, 3423, 3491, 4079, 4047, 4041, 3979, 2772, 3538, 3454, 2542, 3078, 1508,
|
||||
3348, 3412, 3487, 4086, 4058, 4065, 3990, 2743, 3660, 3578, 2668, 3158, 3194, 1546, 3462, 3550, 4114, 4114, 4100, 4019, 2711, 3657, 3674, 2653,
|
||||
3271, 3257, 3283, 1566, 3568, 4103, 4070, 4074, 3992, 2666, 3668, 3641, 2613, 3337, 3309, 3385, 3393, 1572, 5000, 2744, 2725, 2687, 2675, 6150,
|
||||
6034, 5897, 5741, 6448, 2966, 5674, 5780, 3598, 3606, 3715, 3715, 3776, 6090, 6104, 5968, 5850, 6612, 5356, 2922, 5620, 3293, 3536, 3626, 3759,
|
||||
3757, 6089, 6067, 6104, 5975, 6793, 5449, 5313, 2867, 3030, 3462, 3550, 3663, 3775, 5679, 5662, 5676, 5684, 4746, 3428, 3136, 2902, 863, 2489,
|
||||
2624, 2594, 2566, 3948, 3941, 3908, 3898, 2624, 3425, 3373, 3300, 2410, 1347, 3137, 3229, 3335, 3977, 3958, 3920, 3927, 2609, 3540, 3454, 3378,
|
||||
2532, 2992, 1398, 3272, 3372, 4034, 3996, 3957, 3950, 2565, 3531, 3573, 3488, 2503, 3077, 3120, 1424, 3421, 4019, 3991, 3951, 3911, 2551, 3582,
|
||||
3571, 3592, 2477, 3174, 3221, 3254, 1452, 5000, 2561, 2568, 2560, 6049, 5918, 5784, 5651, 6426, 2968, 5633, 5688, 5797, 3600, 3641, 3649, 3676,
|
||||
6003, 6006, 5912, 5783, 6545, 5300, 2895, 5574, 5661, 3257, 3528, 3664, 3649, 6030, 5982, 6047, 5905, 6726, 5373, 5255, 2833, 5555, 3014, 3447,
|
||||
3552, 3700, 6004, 5980, 5969, 6057, 6853, 5462, 5333, 5236, 2774, 2769, 3304, 3426, 3544, 5629, 5636, 5622, 5563, 4757, 3435, 3108, 2891, 2649,
|
||||
685, 2470, 2444, 2467, 3905, 3851, 3824, 3790, 2458, 3472, 3364, 3284, 3156, 2390, 1199, 3188, 3292, 3916, 3889, 3831, 3773, 2457, 3478, 3490,
|
||||
3386, 3254, 2369, 3043, 1265, 3287, 3936, 3896, 3827, 3821, 2450, 3490, 3466, 3513, 3370, 2395, 3149, 3133, 1283, 5000, 2533, 2508, 6087, 5961,
|
||||
5844, 5721, 6505, 2987, 5642, 5715, 5817, 5875, 3693, 3643, 3640, 6030, 6055, 5936, 5812, 6598, 5333, 2939, 5591, 5685, 5730, 3306, 3666, 3666,
|
||||
6034, 5980, 6046, 5951, 6761, 5377, 5272, 2884, 5545, 5627, 3016, 3572, 3679, 6007, 6024, 6017, 5997, 6879, 5481, 5358, 5242, 2802, 5394, 2816,
|
||||
3435, 3597, 6014, 6025, 5979, 5958, 7014, 5541, 5399, 5302, 5088, 2768, 2707, 3472, 3594, 5651, 5624, 5634, 5573, 4746, 3520, 3159, 2879, 2690,
|
||||
2591, 701, 2502, 2464, 3872, 3859, 3803, 3781, 2421, 3463, 3484, 3399, 3282, 3310, 2417, 1236, 3263, 3908, 3849, 3846, 3795, 2395, 3453, 3470,
|
||||
3507, 3440, 3416, 2382, 3116, 1281, 5000, 2458, 6063, 5929, 5826, 5704, 6513, 2920, 5642, 5720, 5799, 5831, 6059, 3646, 3613, 6033, 6050, 5920,
|
||||
5833, 6659, 5314, 2936, 5614, 5640, 5715, 5910, 3381, 3653, 6014, 6012, 6031, 5887, 6769, 5383, 5297, 2866, 5529, 5576, 5797, 3078, 3704, 5991,
|
||||
6000, 5987, 5975, 6904, 5452, 5315, 5217, 2809, 5407, 5594, 2872, 3548, 5961, 5962, 5971, 5960, 7019, 5498, 5389, 5258, 5093, 2776, 5565, 2715,
|
||||
3532, 6041, 6040, 6028, 6002, 7039, 5712, 5570, 5450, 5283, 5244, 2794, 2650, 3600, 5643, 5632, 5640, 5607, 4738, 3462, 3218, 2946, 2749, 2610,
|
||||
2534, 667, 2439, 3849, 3834, 3784, 3776, 2352, 3420, 3473, 3520, 3375, 3347, 3411, 2346, 1256, 5000, 6047, 5934, 5788, 5714, 6546, 2885, 5590,
|
||||
5701, 5785, 5827, 5995, 5972, 3668, 5996, 6009, 5873, 5774, 6641, 5271, 2861, 5571, 5632, 5675, 5885, 6016, 3337, 6030, 6010, 6010, 5889, 6804,
|
||||
5379, 5253, 2840, 5504, 5607, 5729, 5875, 3117, 5961, 5951, 5960, 5943, 6908, 5463, 5322, 5203, 2810, 5398, 5580, 5718, 2867, 5947, 5952, 5941,
|
||||
5926, 7016, 5494, 5357, 5279, 5106, 2764, 5549, 5697, 2699, 6015, 5974, 5999, 5960, 7065, 5651, 5527, 5419, 5267, 5239, 2792, 5747, 2667, 6033,
|
||||
6007, 6025, 6036, 7121, 5614, 5667, 5534, 5397, 5370, 5413, 2812, 2602, 5552, 5509, 5480, 5433, 4746, 3503, 3183, 2974, 2735, 2584, 2548, 2484,
|
||||
658, 5000, 4633, 4551, 4324, 3970, 1190, 3164, 3057, 2979, 2903, 2879, 2827, 2727, 3253, 3821, 3710, 3616, 3539, 3065, 1551, 3360, 3485, 3526,
|
||||
3564, 3622, 3562, 3104, 3733, 3760, 3623, 3585, 2956, 3147, 1588, 3428, 3483, 3553, 3607, 3634, 3022, 3774, 3727, 3708, 3608, 2877, 3236, 3220,
|
||||
1585, 3462, 3546, 3610, 3611, 2960, 3749, 3726, 3666, 3707, 2807, 3309, 3253, 3225, 1611, 3564, 3634, 3638, 2933, 3697, 3653, 3677, 3659, 2783,
|
||||
3327, 3319, 3305, 3312, 1615, 3633, 3632, 2894, 3730, 3745, 3697, 3702, 2731, 3379, 3388, 3370, 3393, 3398, 1646, 3619, 2804, 3671, 3641, 3644,
|
||||
3702, 2630, 3337, 3398, 3373, 3397, 3388, 3368, 1617, 5000, 4637, 4343, 4032, 1353, 3189, 3214, 3104, 3054, 3023, 3002, 2907, 4320, 3380, 3848,
|
||||
3790, 3667, 3089, 1709, 3524, 3588, 3629, 3706, 3722, 3697, 4289, 3242, 3905, 3810, 3650, 3112, 3289, 1736, 3551, 3646, 3683, 3766, 3746, 4251,
|
||||
3161, 3861, 3789, 3727, 3000, 3352, 3324, 1755, 3574, 3678, 3716, 3721, 4242, 3095, 3811, 3772, 3831, 2947, 3400, 3402, 3341, 1769, 3622, 3749,
|
||||
3756, 4231, 3007, 3805, 3779, 3783, 2904, 3457, 3456, 3440, 3386, 1764, 3758, 3730, 4270, 3004, 3844, 3813, 3845, 2896, 3503, 3521, 3463, 3503,
|
||||
3503, 1794, 3751, 4139, 2946, 3764, 3749, 3819, 2796, 3452, 3508, 3487, 3510, 3490, 3505, 1783, 5000, 4423, 4071, 1553, 3380, 3210, 3290, 3209,
|
||||
3156, 3149, 3094, 4460, 4411, 3442, 3860, 3791, 3266, 1784, 3655, 3724, 3755, 3850, 3877, 3864, 4405, 4322, 3390, 3878, 3790, 3114, 3422, 1871,
|
||||
3661, 3754, 3850, 3881, 3870, 4398, 4313, 3281, 3951, 3839, 3174, 3488, 3420, 1932, 3754, 3781, 3841, 3848, 4392, 4293, 3186, 3891, 3961, 3087,
|
||||
3516, 3520, 3518, 1932, 3764, 3851, 3866, 4337, 4285, 3152, 3910, 3912, 3033, 3618, 3593, 3532, 3516, 1901, 3818, 3887, 4386, 4320, 3139, 3930,
|
||||
3913, 3029, 3630, 3630, 3596, 3603, 3579, 1966, 3905, 4286, 4221, 3078, 3847, 3962, 2972, 3617, 3628, 3609, 3613, 3648, 3664, 1924, 5000, 4139,
|
||||
1705, 3436, 3431, 3302, 3374, 3316, 3311, 3245, 4619, 4595, 4439, 3418, 3876, 3321, 1876, 3770, 3846, 3905, 3952, 4049, 4011, 4570, 4502, 4418,
|
||||
3413, 3915, 3310, 3517, 1978, 3788, 3905, 3970, 4017, 4019, 4545, 4412, 4364, 3393, 3984, 3171, 3610, 3541, 2081, 3842, 3890, 3969, 3988, 4512,
|
||||
4397, 4339, 3330, 4077, 3233, 3670, 3656, 3593, 2098, 3921, 4000, 3971, 4454, 4397, 4349, 3281, 4021, 3187, 3705, 3728, 3628, 3660, 2095, 3966,
|
||||
3977, 4483, 4417, 4407, 3260, 4027, 3177, 3790, 3755, 3726, 3749, 3714, 2138, 4059, 4438, 4362, 4295, 3166, 4013, 3100, 3748, 3766, 3734, 3717,
|
||||
3721, 3803, 2107, 5000, 1834, 3478, 3441, 3446, 3379, 3484, 3433, 3394, 4758, 4683, 4545, 4429, 3413, 3368, 1868, 3869, 3924, 3958, 4087, 4134,
|
||||
4116, 4679, 4580, 4577, 4412, 3409, 3320, 3637, 2007, 3926, 3965, 4058, 4094, 4161, 4643, 4583, 4467, 4471, 3417, 3304, 3684, 3681, 2118, 3871,
|
||||
3982, 4084, 4151, 4563, 4490, 4436, 4381, 3420, 3244, 3719, 3719, 3631, 2162, 3890, 4034, 4088, 4605, 4521, 4462, 4407, 3349, 3344, 3828, 3803,
|
||||
3731, 3644, 2213, 4103, 4134, 4634, 4554, 4483, 4435, 3340, 3292, 3872, 3858, 3839, 3786, 3848, 2244, 4183, 4622, 4536, 4475, 4415, 3319, 3249,
|
||||
3873, 3898, 3888, 3831, 3877, 3921, 2257, 5000, 6435, 6521, 6653, 6790, 6947, 6976, 6990, 6885, 6835, 6765, 6645, 6641, 6073, 1829, 5323, 5382,
|
||||
5456, 5520, 5680, 5677, 6839, 6778, 6754, 6695, 6665, 6146, 5079, 1863, 5283, 5344, 5379, 5577, 5674, 6763, 6729, 6703, 6729, 6683, 6267, 5139,
|
||||
5037, 1886, 5167, 5226, 5405, 5509, 6747, 6692, 6683, 6655, 6669, 6414, 5192, 5095, 4935, 1933, 5177, 5375, 5494, 6754, 6687, 6653, 6659, 6669,
|
||||
6554, 5259, 5127, 4988, 4943, 1907, 5392, 5487, 6776, 6736, 6719, 6712, 6710, 6583, 5404, 5309, 5146, 5114, 5125, 1964, 5556, 6707, 6662, 6626,
|
||||
6595, 6768, 6593, 5400, 5395, 5264, 5221, 5208, 5302, 1970, 5000, 2990, 3041, 3042, 3130, 3071, 3091, 6150, 6142, 6092, 6026, 6003, 4742, 1330,
|
||||
2914, 2924, 2971, 2874, 3015, 2966, 4429, 4434, 4334, 4197, 4082, 2881, 2841, 1423, 3420, 3528, 3631, 3713, 3806, 4399, 4373, 4294, 4245, 4113,
|
||||
2914, 2831, 3269, 1581, 3516, 3581, 3704, 3750, 4352, 4361, 4290, 4200, 4162, 2912, 2860, 3371, 3346, 1718, 3586, 3675, 3750, 4303, 4321, 4229,
|
||||
4158, 4133, 2982, 2770, 3468, 3412, 3426, 1783, 3560, 3763, 4327, 4320, 4235, 4213, 4131, 2918, 2889, 3549, 3532, 3504, 3391, 1826, 3764, 4301,
|
||||
4293, 4250, 4178, 4194, 2941, 2845, 3632, 3578, 3574, 3569, 3576, 1884, 5000, 2831, 2911, 3007, 2966, 2907, 6294, 6299, 6143, 6019, 5906, 6627,
|
||||
2987, 3332, 3675, 3748, 3828, 3966, 3910, 6173, 6090, 6093, 6024, 6017, 4755, 3198, 1166, 2761, 2810, 2728, 2904, 2871, 4284, 4203, 4223, 4146,
|
||||
4006, 2725, 3504, 2662, 1406, 3316, 3431, 3543, 3616, 4238, 4186, 4181, 4107, 4105, 2783, 3570, 2700, 3173, 1552, 3433, 3531, 3616, 4246, 4200,
|
||||
4149, 4134, 4061, 2876, 3643, 2623, 3284, 3289, 1664, 3533, 3590, 4275, 4193, 4256, 4131, 4068, 2831, 3773, 2795, 3389, 3364, 3361, 1702, 3652,
|
||||
4154, 4193, 4171, 4072, 4079, 2761, 3734, 2755, 3453, 3453, 3410, 3472, 1692, 5000, 2754, 2840, 2814, 2796, 6241, 6195, 6082, 5953, 5868, 6589,
|
||||
2980, 5763, 3288, 3625, 3732, 3868, 3849, 6224, 6170, 6189, 6083, 5991, 6781, 5451, 2903, 3053, 3555, 3645, 3778, 3864, 6118, 6051, 6059, 6068,
|
||||
6052, 4751, 3138, 2923, 1017, 2638, 2601, 2730, 2707, 4134, 4071, 4030, 4069, 3974, 2651, 3451, 3388, 2557, 1393, 3236, 3359, 3460, 4142, 4065,
|
||||
4087, 4045, 3978, 2722, 3554, 3473, 2513, 3092, 1525, 3400, 3463, 4123, 4155, 4075, 4063, 3981, 2678, 3676, 3605, 2644, 3207, 3237, 1570, 3533,
|
||||
4151, 4081, 4040, 4060, 3979, 2662, 3664, 3684, 2604, 3303, 3317, 3358, 1574, 5000, 2719, 2692, 2673, 6139, 6133, 6009, 5853, 5788, 6583, 2952,
|
||||
5687, 5784, 3283, 3630, 3764, 3740, 6130, 6096, 6122, 6020, 5934, 6710, 5349, 2871, 5693, 3031, 3525, 3659, 3751, 6132, 6108, 6094, 6102, 6020,
|
||||
6852, 5444, 5371, 2846, 2820, 3393, 3507, 3646, 6059, 6026, 6025, 5990, 6024, 4749, 3133, 2903, 2711, 809, 2435, 2572, 2547, 3995, 3991, 3923,
|
||||
3901, 3900, 2608, 3458, 3369, 3231, 2349, 1351, 3268, 3353, 4081, 3979, 3964, 3912, 3949, 2566, 3588, 3497, 3333, 2479, 3134, 1378, 3393, 4022,
|
||||
3991, 3939, 3917, 3938, 2562, 3556, 3566, 3480, 2458, 3196, 3241, 1430, 5000, 2491, 2489, 6032, 6016, 5885, 5775, 5703, 6488, 2876, 5601, 5706,
|
||||
5821, 3287, 3611, 3623, 6042, 6012, 6014, 5879, 5777, 6619, 5280, 2832, 5590, 5644, 3022, 3506, 3622, 6044, 5987, 5994, 5969, 5921, 6758, 5381,
|
||||
5274, 2756, 5474, 2803, 3378, 3505, 6030, 6003, 5965, 5945, 5965, 6879, 5485, 5327, 5169, 2772, 2651, 3429, 3558, 6033, 5976, 5961, 5937, 5953,
|
||||
4743, 3138, 2880, 2674, 2532, 657, 2461, 2429, 3909, 3876, 3815, 3794, 3734, 2381, 3433, 3322, 3224, 3269, 2376, 1199, 3253, 3914, 3854, 3791,
|
||||
3758, 3795, 2388, 3439, 3448, 3343, 3381, 2347, 3109, 1202, 5000, 2454, 6078, 6057, 5908, 5817, 5726, 6549, 2892, 5657, 5714, 5791, 5918, 3335,
|
||||
3614, 6065, 5983, 6025, 5868, 5799, 6641, 5330, 2830, 5566, 5699, 5775, 3045, 3621, 6025, 6020, 5990, 5987, 5912, 6797, 5392, 5260, 2778, 5499,
|
||||
5570, 2794, 3531, 6018, 5984, 5979, 5940, 5976, 6909, 5465, 5376, 5190, 2786, 5564, 2728, 3552, 6038, 5993, 5986, 5962, 5973, 7089, 5575, 5446,
|
||||
5258, 5247, 2762, 2642, 3576, 6039, 5985, 5957, 5962, 6008, 4755, 3180, 2908, 2683, 2612, 2533, 657, 2464, 3885, 3818, 3767, 3761, 3800, 2345,
|
||||
3434, 3453, 3354, 3380, 3398, 2369, 1244, 5000, 6072, 6019, 5942, 5780, 5674, 6545, 2861, 5630, 5676, 5786, 5852, 6019, 3328, 6059, 6053, 6031,
|
||||
5891, 5798, 6708, 5321, 2884, 5570, 5663, 5738, 5929, 3101, 6068, 6003, 5984, 6008, 5869, 6807, 5364, 5271, 2789, 5513, 5598, 5743, 2893, 6019,
|
||||
5983, 5964, 5942, 5948, 6906, 5466, 5340, 5210, 2828, 5583, 5735, 2740, 6036, 5983, 5977, 5967, 5983, 7094, 5508, 5415, 5286, 5261, 2799, 5754,
|
||||
2663, 6087, 6051, 5988, 6022, 5996, 7124, 5666, 5582, 5411, 5405, 5430, 2823, 2648, 5882, 5835, 5839, 5828, 6001, 4751, 3181, 2970, 2760, 2630,
|
||||
2543, 2522, 667, 5000, 4712, 4633, 4309, 4021, 3690, 1207, 3046, 2978, 2922, 2879, 2850, 2807, 3086, 3790, 3793, 3693, 3619, 3459, 2951, 1595,
|
||||
3382, 3455, 3539, 3640, 3636, 3018, 3796, 3758, 3745, 3658, 3513, 2879, 3161, 1585, 3425, 3532, 3590, 3606, 2960, 3771, 3716, 3735, 3730, 3627,
|
||||
2826, 3230, 3199, 1637, 3526, 3604, 3634, 2931, 3761, 3783, 3720, 3726, 3721, 2786, 3319, 3312, 3288, 1642, 3628, 3632, 2863, 3804, 3777, 3720,
|
||||
3727, 3689, 2752, 3399, 3348, 3370, 3382, 1631, 3657, 2871, 3709, 3710, 3656, 3762, 3678, 2696, 3399, 3353, 3397, 3382, 3403, 1653, 5000, 4648,
|
||||
4349, 4034, 3688, 1197, 3047, 2979, 2933, 2869, 2881, 2791, 4121, 3109, 3809, 3671, 3550, 3450, 2950, 1592, 3394, 3460, 3554, 3626, 3627, 4120,
|
||||
3016, 3718, 3712, 3626, 3560, 2879, 3170, 1604, 3426, 3494, 3547, 3593, 4124, 2952, 3706, 3672, 3723, 3636, 2837, 3248, 3211, 1588, 3541, 3610,
|
||||
3643, 4139, 2945, 3724, 3709, 3724, 3740, 2771, 3318, 3253, 3311, 1667, 3621, 3660, 4130, 2885, 3729, 3708, 3707, 3704, 2788, 3384, 3310, 3365,
|
||||
3382, 1618, 3682, 4046, 2863, 3689, 3677, 3741, 3726, 2708, 3377, 3364, 3394, 3405, 3440, 1621, 5000, 4416, 4066, 3731, 1391, 3047, 3146, 3061,
|
||||
3085, 3020, 2966, 4258, 4272, 3274, 3801, 3682, 3617, 2947, 1739, 3514, 3612, 3672, 3734, 3757, 4253, 4239, 3170, 3836, 3770, 3683, 3035, 3286,
|
||||
1791, 3552, 3626, 3699, 3748, 4225, 4239, 3089, 3811, 3846, 3745, 2938, 3376, 3321, 1808, 3662, 3736, 3756, 4261, 4255, 3052, 3822, 3819, 3863,
|
||||
2967, 3439, 3383, 3422, 1805, 3727, 3809, 4250, 4213, 3000, 3797, 3838, 3833, 2914, 3487, 3472, 3496, 3472, 1808, 3785, 4158, 4171, 2991, 3763,
|
||||
3871, 3810, 2868, 3517, 3503, 3506, 3562, 3543, 1828, 5000, 4154, 3819, 1559, 3250, 3118, 3216, 3219, 3221, 3138, 4421, 4426, 4314, 3267, 3819,
|
||||
3721, 3141, 1783, 3632, 3727, 3821, 3893, 3927, 4356, 4365, 4285, 3285, 3898, 3792, 3010, 3406, 1920, 3671, 3779, 3849, 3873, 4354, 4320, 4288,
|
||||
3204, 3953, 3890, 3105, 3501, 3437, 1954, 3801, 3815, 3884, 4358, 4366, 4325, 3152, 3925, 3946, 3094, 3561, 3541, 3545, 1928, 3852, 3927, 4335,
|
||||
4392, 4286, 3126, 3902, 3930, 3083, 3651, 3597, 3559, 3600, 1957, 3941, 4321, 4334, 4217, 3113, 3971, 3944, 3014, 3677, 3603, 3631, 3679, 3693,
|
||||
1994, 5000, 3818, 1676, 3292, 3297, 3206, 3363, 3294, 3294, 4537, 4568, 4459, 4346, 3253, 3853, 3181, 1820, 3725, 3803, 3910, 3992, 4051, 4508,
|
||||
4463, 4421, 4352, 3242, 3888, 3181, 3496, 1970, 3757, 3910, 3947, 4015, 4438, 4480, 4385, 4330, 3309, 3956, 3088, 3562, 3515, 2079, 3816, 3935,
|
||||
3995, 4482, 4493, 4409, 4349, 3274, 4044, 3235, 3672, 3668, 3578, 2093, 3967, 4065, 4477, 4470, 4423, 4374, 3236, 3991, 3167, 3740, 3696, 3684,
|
||||
3722, 2098, 4075, 4521, 4500, 4444, 4348, 3221, 4065, 3158, 3800, 3761, 3741, 3796, 3795, 2163, 5000, 1831, 3310, 3344, 3383, 3291, 3413, 3361,
|
||||
4688, 4670, 4598, 4451, 4365, 3283, 3203, 1829, 3801, 3889, 4008, 4069, 4162, 4648, 4645, 4567, 4510, 4376, 3300, 3218, 3565, 1958, 3878, 3929,
|
||||
4078, 4106, 4615, 4630, 4551, 4477, 4423, 3308, 3258, 3649, 3660, 2102, 3952, 4043, 4109, 4576, 4579, 4506, 4432, 4398, 3361, 3157, 3762, 3680,
|
||||
3713, 2155, 3936, 4117, 4605, 4602, 4521, 4454, 4400, 3294, 3273, 3822, 3825, 3789, 3681, 2195, 4117, 4581, 4568, 4505, 4439, 4443, 3327, 3211,
|
||||
3907, 3848, 3862, 3842, 3866, 2251, 5000, 6426, 6561, 6705, 6851, 7055, 7021, 6843, 6863, 6848, 6762, 6737, 6687, 6077, 1788, 5382, 5492, 5536,
|
||||
5591, 5708, 6831, 6839, 6786, 6792, 6733, 6649, 6213, 5117, 1853, 5299, 5397, 5417, 5558, 6790, 6798, 6740, 6710, 6742, 6698, 6313, 5230, 5052,
|
||||
1884, 5338, 5411, 5559, 6798, 6778, 6746, 6708, 6715, 6761, 6453, 5278, 5148, 5084, 1895, 5395, 5562, 6771, 6806, 6734, 6703, 6697, 6749, 6637,
|
||||
5330, 5155, 5159, 5143, 1941, 5561, 6708, 6705, 6644, 6615, 6775, 6787, 6622, 5439, 5295, 5289, 5292, 5302, 1971, 5000, 2823, 2897, 2983, 3088,
|
||||
3046, 6418, 6423, 6421, 6342, 6348, 6309, 4750, 1306, 2777, 2845, 2879, 2857, 2990, 4362, 4357, 4357, 4313, 4158, 4007, 2726, 2695, 1417, 3414,
|
||||
3489, 3559, 3715, 4337, 4345, 4357, 4260, 4194, 4115, 2782, 2754, 3262, 1545, 3526, 3615, 3750, 4348, 4317, 4343, 4244, 4195, 4170, 2841, 2776,
|
||||
3345, 3361, 1721, 3619, 3697, 4307, 4341, 4283, 4228, 4163, 4122, 2939, 2746, 3406, 3442, 3436, 1772, 3603, 4304, 4276, 4288, 4206, 4180, 4165,
|
||||
2897, 2877, 3540, 3581, 3535, 3429, 1811, 5000, 2732, 2833, 2991, 2925, 6279, 6293, 6293, 6185, 6091, 5947, 6789, 2963, 3049, 3611, 3742, 3852,
|
||||
3949, 6431, 6418, 6370, 6336, 6333, 6317, 4742, 2932, 1142, 2649, 2741, 2673, 2864, 4242, 4220, 4196, 4162, 4128, 4009, 2631, 3445, 2561, 1413,
|
||||
3321, 3478, 3549, 4190, 4257, 4174, 4196, 4098, 4080, 2697, 3575, 2653, 3173, 1556, 3453, 3603, 4243, 4201, 4182, 4187, 4131, 4067, 2849, 3672,
|
||||
2584, 3312, 3308, 1686, 3623, 4186, 4206, 4161, 4156, 4120, 4103, 2788, 3771, 2763, 3398, 3433, 3444, 1734, 5000, 2710, 2803, 2784, 6233, 6231,
|
||||
6225, 6074, 5988, 5893, 6705, 2915, 5817, 3013, 3639, 3724, 3866, 6224, 6256, 6184, 6173, 6085, 5992, 6864, 5478, 2854, 2789, 3501, 3635, 3771,
|
||||
6404, 6390, 6326, 6289, 6342, 6355, 4751, 2892, 2680, 984, 2610, 2556, 2684, 4131, 4087, 4069, 4055, 4057, 3987, 2604, 3467, 3338, 2522, 1374,
|
||||
3323, 3461, 4073, 4112, 4081, 4071, 4060, 3994, 2682, 3539, 3458, 2469, 3173, 1493, 3486, 4091, 4137, 4062, 4021, 4096, 3991, 2657, 3686, 3601,
|
||||
2583, 3313, 3318, 1546, 5000, 2634, 2608, 6145, 6142, 6100, 5957, 5890, 5798, 6645, 2871, 5672, 5831, 3016, 3600, 3730, 6123, 6106, 6046, 6077,
|
||||
6004, 5912, 6782, 5360, 2817, 5624, 2804, 3504, 3598, 6097, 6105, 6066, 6050, 6094, 6006, 6888, 5493, 5301, 2822, 2698, 3535, 3623, 6345, 6349,
|
||||
6319, 6302, 6324, 6331, 4760, 2902, 2686, 2590, 799, 2394, 2560, 3962, 3972, 3969, 3932, 3878, 3858, 2517, 3429, 3341, 3366, 2312, 1328, 3357,
|
||||
3977, 3978, 3923, 3895, 3890, 3924, 2495, 3558, 3424, 3452, 2471, 3192, 1378, 5000, 2420, 6006, 5981, 5975, 5867, 5783, 5669, 6541, 2799, 5623,
|
||||
5740, 5831, 2999, 3587, 6000, 6003, 5958, 5955, 5872, 5780, 6633, 5306, 2751, 5536, 5628, 2761, 3445, 5973, 6000, 5954, 5894, 5960, 5875, 6805,
|
||||
5411, 5224, 2726, 5638, 2663, 3478, 5985, 5998, 5932, 5947, 5970, 6001, 6963, 5485, 5312, 5312, 2742, 2577, 3525, 6319, 6313, 6249, 6215, 6257,
|
||||
6267, 4752, 2874, 2648, 2540, 2466, 638, 2433, 3825, 3833, 3773, 3735, 3787, 3771, 2327, 3414, 3271, 3315, 3342, 2357, 1189, 5000, 6064, 6063,
|
||||
6026, 5897, 5791, 5739, 6578, 2859, 5623, 5715, 5833, 5932, 3065, 6031, 6034, 5997, 6012, 5885, 5805, 6692, 5309, 2784, 5571, 5676, 5738, 2819,
|
||||
6017, 6004, 5943, 5949, 5991, 5897, 6813, 5402, 5266, 2818, 5624, 5733, 2733, 6068, 6012, 5957, 5978, 5952, 5993, 6986, 5504, 5357, 5308, 2814,
|
||||
5739, 2692, 6051, 6028, 6013, 5941, 5976, 5991, 7137, 5591, 5410, 5393, 5406, 2819, 2607, 6199, 6177, 6121, 6123, 6296, 6287, 4744, 2922, 2707,
|
||||
2622, 2564, 2497, 667, 5000, 4715, 4705, 4398, 4048, 3687, 3444, 1185, 2910, 2870, 2848, 2848, 2787, 2995, 3724, 3716, 3737, 3650, 3547, 3461,
|
||||
2819, 1570, 3355, 3441, 3517, 3580, 2906, 3713, 3763, 3684, 3720, 3608, 3530, 2779, 3147, 1574, 3447, 3547, 3585, 2871, 3754, 3762, 3737, 3723,
|
||||
3714, 3627, 2757, 3207, 3231, 1627, 3581, 3622, 2871, 3780, 3786, 3746, 3733, 3724, 3731, 2751, 3282, 3307, 3329, 1634, 3634, 2826, 3704, 3700,
|
||||
3661, 3731, 3674, 3690, 2683, 3337, 3348, 3379, 3395, 1589, 5000, 4737, 4419, 4058, 3734, 3406, 1219, 2926, 2906, 2881, 2861, 2824, 4116, 2972,
|
||||
3716, 3739, 3677, 3581, 3458, 2839, 1595, 3368, 3441, 3563, 3634, 4117, 2925, 3727, 3716, 3765, 3654, 3525, 2809, 3141, 1627, 3501, 3589, 3607,
|
||||
4146, 2925, 3783, 3751, 3768, 3748, 3619, 2789, 3206, 3278, 1654, 3606, 3660, 4170, 2886, 3793, 3778, 3761, 3750, 3767, 2752, 3339, 3346, 3370,
|
||||
1662, 3678, 4053, 2844, 3708, 3653, 3722, 3705, 3690, 2734, 3380, 3365, 3419, 3431, 1636, 5000, 4419, 4083, 3726, 3411, 1225, 2988, 2911, 2893,
|
||||
2878, 2824, 4112, 4083, 3001, 3739, 3669, 3556, 3460, 2892, 1607, 3359, 3471, 3581, 3615, 4131, 4089, 2928, 3687, 3703, 3634, 3549, 2829, 3142,
|
||||
1637, 3508, 3560, 3623, 4151, 4127, 2925, 3705, 3720, 3729, 3657, 2798, 3260, 3277, 1648, 3617, 3666, 4146, 4125, 2885, 3750, 3734, 3717, 3780,
|
||||
2785, 3344, 3327, 3383, 1674, 3652, 4039, 4023, 2826, 3666, 3741, 3737, 3708, 2732, 3379, 3388, 3434, 3408, 1651, 5000, 4143, 3779, 3486, 1377,
|
||||
2984, 3117, 3074, 3067, 2980, 4216, 4205, 4241, 3150, 3770, 3668, 3560, 2884, 1780, 3515, 3611, 3702, 3711, 4210, 4217, 4239, 3042, 3822, 3731,
|
||||
3672, 3004, 3282, 1792, 3596, 3702, 3761, 4270, 4248, 4243, 3020, 3797, 3867, 3798, 2962, 3384, 3359, 1779, 3743, 3821, 4288, 4251, 4255, 3005,
|
||||
3864, 3872, 3886, 2948, 3454, 3456, 3505, 1851, 3818, 4201, 4150, 4097, 2972, 3847, 3864, 3845, 2857, 3462, 3508, 3560, 3559, 1814, 5000, 3823,
|
||||
3512, 1532, 3146, 3082, 3205, 3159, 3142, 4362, 4351, 4337, 4289, 3087, 3758, 3669, 3045, 1808, 3597, 3678, 3803, 3871, 4361, 4325, 4327, 4264,
|
||||
3155, 3818, 3755, 2965, 3374, 1901, 3741, 3802, 3864, 4358, 4340, 4347, 4266, 3142, 3951, 3870, 3080, 3438, 3501, 1949, 3836, 3939, 4412, 4389,
|
||||
4359, 4296, 3110, 3953, 3959, 3033, 3569, 3556, 3587, 1974, 3939, 4382, 4351, 4353, 4274, 3079, 3945, 3930, 3023, 3627, 3600, 3680, 3679, 1968,
|
||||
5000, 3561, 1673, 3172, 3223, 3133, 3325, 3266, 4553, 4481, 4495, 4419, 4291, 3132, 3793, 3065, 1825, 3718, 3820, 3910, 3980, 4503, 4452, 4467,
|
||||
4383, 4366, 3168, 3849, 3108, 3471, 1959, 3820, 3910, 3990, 4523, 4476, 4441, 4385, 4343, 3252, 3945, 3012, 3597, 3580, 2054, 3906, 3965, 4548,
|
||||
4466, 4500, 4406, 4347, 3223, 4050, 3199, 3660, 3664, 3646, 2083, 4006, 4431, 4470, 4446, 4355, 4357, 3161, 4004, 3145, 3731, 3740, 3724, 3737,
|
||||
2095, 5000, 1790, 3196, 3261, 3297, 3265, 3392, 4621, 4612, 4597, 4572, 4425, 4294, 3109, 3093, 1832, 3786, 3856, 3939, 4071, 4610, 4587, 4610,
|
||||
4516, 4479, 4378, 3167, 3144, 3558, 1934, 3895, 3980, 4095, 4591, 4596, 4580, 4509, 4468, 4450, 3227, 3176, 3631, 3652, 2094, 3974, 4073, 4563,
|
||||
4587, 4554, 4506, 4429, 4394, 3323, 3143, 3690, 3734, 3727, 2153, 3960, 4580, 4541, 4559, 4476, 4464, 4411, 3295, 3250, 3818, 3841, 3810, 3713,
|
||||
2182, 5000, 6487, 6601, 6780, 6961, 7061, 6894, 6863, 6861, 6806, 6756, 6757, 6684, 6125, 1795, 5374, 5444, 5564, 5603, 6863, 6827, 6819, 6746,
|
||||
6815, 6782, 6744, 6239, 5115, 1832, 5454, 5523, 5549, 6853, 6822, 6832, 6752, 6778, 6824, 6790, 6392, 5200, 5188, 1868, 5531, 5566, 6856, 6813,
|
||||
6809, 6751, 6764, 6789, 6829, 6561, 5295, 5245, 5267, 1908, 5554, 6729, 6665, 6675, 6628, 6786, 6756, 6787, 6656, 5324, 5281, 5287, 5292, 1912,
|
||||
5000, 2729, 2864, 2953, 3031, 6673, 6643, 6635, 6595, 6551, 6534, 6578, 4752, 1291, 2654, 2791, 2808, 2809, 4306, 4325, 4285, 4346, 4220, 4099,
|
||||
3994, 2625, 2578, 1431, 3382, 3526, 3631, 4357, 4310, 4332, 4299, 4225, 4198, 4117, 2743, 2711, 3239, 1564, 3545, 3692, 4315, 4314, 4324, 4334,
|
||||
4233, 4217, 4145, 2825, 2698, 3371, 3389, 1719, 3720, 4302, 4291, 4262, 4255, 4268, 4196, 4159, 2887, 2701, 3483, 3525, 3521, 1845, 5000, 2695,
|
||||
2796, 2935, 6341, 6303, 6269, 6260, 6168, 6075, 6024, 6881, 2908, 2822, 3595, 3722, 3816, 6682, 6628, 6622, 6545, 6600, 6575, 6598, 4753, 2724,
|
||||
1091, 2612, 2692, 2660, 4186, 4201, 4193, 4159, 4154, 4149, 3963, 2598, 3422, 2531, 1371, 3434, 3548, 4195, 4216, 4230, 4177, 4209, 4070, 4051,
|
||||
2684, 3541, 2613, 3284, 1554, 3575, 4187, 4153, 4140, 4153, 4151, 4108, 4075, 2800, 3641, 2560, 3379, 3409, 1651, 5000, 2669, 2744, 6223, 6162,
|
||||
6198, 6168, 6094, 5996, 5915, 6746, 2844, 5775, 2809, 3554, 3663, 6195, 6173, 6191, 6112, 6183, 6100, 5993, 6913, 5439, 2856, 2696, 3584, 3723,
|
||||
6647, 6588, 6600, 6567, 6598, 6581, 6586, 4743, 2700, 2604, 928, 2547, 2533, 4085, 4100, 4072, 4050, 3985, 4001, 3954, 2554, 3390, 3424, 2463,
|
||||
1364, 3436, 4039, 4013, 4047, 3973, 4040, 4037, 3946, 2611, 3490, 3535, 2456, 3277, 1493, 5000, 2573, 6088, 6078, 6084, 6022, 5973, 5879, 5782,
|
||||
6669, 2776, 5669, 5790, 2794, 3539, 6128, 6049, 6051, 6033, 6084, 5961, 5919, 6803, 5341, 2770, 5768, 2659, 3569, 6132, 6055, 6088, 6040, 6037,
|
||||
6128, 6031, 6937, 5470, 5449, 2811, 2623, 3628, 6628, 6570, 6565, 6494, 6528, 6563, 6607, 4740, 2673, 2561, 2519, 766, 2368, 3925, 3914, 3888,
|
||||
3863, 3911, 3866, 3852, 2447, 3362, 3402, 3458, 2292, 1320, 5000, 6041, 5995, 5992, 5994, 5887, 5779, 5696, 6592, 2758, 5573, 5694, 5815, 2813,
|
||||
6022, 5966, 5957, 5903, 5927, 5876, 5783, 6692, 5260, 2774, 5668, 5805, 2696, 6025, 5970, 5993, 5912, 5948, 6012, 5899, 6861, 5374, 5340, 2783,
|
||||
5804, 2630, 6022, 6027, 5995, 5954, 5925, 5989, 6029, 6994, 5485, 5471, 5471, 2805, 2592, 6438, 6403, 6407, 6356, 6504, 6498, 6529, 4753, 2701,
|
||||
2583, 2514, 2479, 623, 5000, 4707, 4697, 4467, 4097, 3689, 3386, 3181, 1173, 2823, 2811, 2807, 2716, 2871, 3714, 3697, 3711, 3728, 3604, 3521,
|
||||
3430, 2740, 1572, 3363, 3456, 3497, 2859, 3733, 3735, 3727, 3716, 3714, 3629, 3542, 2720, 3143, 1576, 3498, 3574, 2845, 3764, 3749, 3733, 3758,
|
||||
3701, 3751, 3665, 2703, 3230, 3268, 1631, 3599, 2819, 3706, 3680, 3675, 3772, 3685, 3715, 3715, 2624, 3276, 3344, 3375, 1632, 5000, 4686, 4467,
|
||||
4112, 3736, 3417, 3212, 1202, 2880, 2845, 2850, 2763, 4084, 2900, 3723, 3718, 3769, 3632, 3515, 3455, 2782, 1602, 3392, 3453, 3551, 4111, 2885,
|
||||
3738, 3759, 3720, 3748, 3653, 3585, 2750, 3179, 1596, 3530, 3602, 4121, 2858, 3769, 3768, 3764, 3726, 3734, 3685, 2762, 3232, 3291, 1662, 3622,
|
||||
4021, 2832, 3685, 3688, 3774, 3746, 3707, 3761, 2666, 3320, 3370, 3383, 1679, 5000, 4472, 4095, 3757, 3482, 3238, 1263, 2917, 2884, 2862, 2831,
|
||||
4115, 4108, 2918, 3694, 3772, 3682, 3572, 3498, 2820, 1655, 3412, 3539, 3596, 4146, 4110, 2878, 3756, 3756, 3763, 3697, 3568, 2789, 3183, 1669,
|
||||
3552, 3639, 4166, 4141, 2897, 3789, 3768, 3759, 3780, 3677, 2753, 3297, 3334, 1703, 3657, 4094, 4044, 2827, 3688, 3793, 3760, 3754, 3770, 2730,
|
||||
3360, 3387, 3416, 1691, 5000, 4104, 3755, 3498, 3267, 1254, 2924, 2869, 2868, 2846, 4142, 4126, 4099, 2906, 3698, 3657, 3576, 3504, 2830, 1620,
|
||||
3440, 3552, 3605, 4146, 4134, 4077, 2893, 3765, 3755, 3686, 3588, 2769, 3212, 1689, 3593, 3634, 4203, 4149, 4091, 2892, 3751, 3759, 3779, 3708,
|
||||
2769, 3306, 3350, 1714, 3666, 4070, 4030, 4007, 2836, 3790, 3738, 3712, 3752, 2740, 3361, 3395, 3422, 1691, 5000, 3774, 3522, 3291, 1388, 2921,
|
||||
3074, 3017, 3013, 4235, 4218, 4189, 4196, 3048, 3736, 3661, 3586, 2821, 1767, 3534, 3633, 3715, 4261, 4234, 4219, 4209, 3015, 3828, 3743, 3651,
|
||||
2965, 3304, 1812, 3669, 3760, 4308, 4274, 4238, 4221, 2979, 3818, 3857, 3781, 2919, 3387, 3424, 1832, 3790, 4291, 4265, 4224, 4186, 2970, 3872,
|
||||
3863, 3882, 2887, 3490, 3515, 3540, 1867, 5000, 3495, 3330, 1522, 3079, 3039, 3167, 3125, 4417, 4346, 4312, 4337, 4263, 3029, 3753, 3679, 2982,
|
||||
1806, 3636, 3744, 3837, 4409, 4358, 4354, 4326, 4246, 3119, 3818, 3770, 2929, 3391, 1908, 3785, 3830, 4413, 4422, 4357, 4325, 4278, 3076, 3975,
|
||||
3878, 3032, 3499, 3554, 1949, 3894, 4410, 4361, 4307, 4343, 4270, 3064, 3939, 3965, 2999, 3597, 3574, 3657, 1965, 5000, 3311, 1646, 3077, 3177,
|
||||
3091, 3265, 4510, 4484, 4462, 4436, 4396, 4289, 3041, 3733, 2983, 1827, 3685, 3854, 3912, 4484, 4514, 4444, 4463, 4373, 4330, 3123, 3857, 3055,
|
||||
3466, 1961, 3811, 3960, 4511, 4479, 4446, 4457, 4387, 4337, 3238, 3955, 2982, 3608, 3576, 2081, 3992, 4457, 4464, 4436, 4437, 4396, 4370, 3169,
|
||||
4041, 3133, 3667, 3730, 3729, 2112, 5000, 1778, 3089, 3180, 3230, 3218, 4566, 4586, 4566, 4604, 4489, 4360, 4268, 3028, 2985, 1830, 3755, 3884,
|
||||
3992, 4614, 4577, 4600, 4568, 4469, 4471, 4381, 3139, 3083, 3527, 1945, 3912, 4066, 4570, 4570, 4580, 4600, 4496, 4473, 4417, 3206, 3105, 3645,
|
||||
3687, 2110, 4069, 4555, 4551, 4539, 4515, 4521, 4460, 4403, 3255, 3089, 3752, 3802, 3809, 2232, 5000, 6500, 6637, 6817, 6940, 6927, 6896, 6882,
|
||||
6863, 6874, 6788, 6789, 6743, 6146, 1780, 5538, 5657, 5690, 6928, 6898, 6838, 6871, 6831, 6882, 6834, 6792, 6269, 5268, 1830, 5678, 5715, 6917,
|
||||
6886, 6852, 6843, 6836, 6854, 6883, 6870, 6420, 5376, 5405, 1888, 5738, 6820, 6766, 6699, 6682, 6819, 6840, 6839, 6879, 6517, 5423, 5440, 5459,
|
||||
1902, 5000, 2691, 2827, 2943, 6903, 6853, 6817, 6808, 6819, 6777, 6803, 6784, 4745, 1273, 2629, 2760, 2868, 4353, 4350, 4319, 4310, 4378, 4281,
|
||||
4161, 4018, 2594, 2566, 1441, 3538, 3688, 4371, 4356, 4360, 4345, 4343, 4260, 4237, 4133, 2707, 2671, 3364, 1581, 3703, 4273, 4317, 4310, 4310,
|
||||
4346, 4257, 4198, 4214, 2820, 2774, 3516, 3527, 1731, 5000, 2638, 2745, 6351, 6318, 6308, 6307, 6306, 6224, 6126, 6035, 6919, 2904, 2717, 3716,
|
||||
3852, 6875, 6816, 6766, 6788, 6778, 6799, 6771, 6790, 4752, 2618, 1122, 2612, 2724, 4250, 4237, 4197, 4222, 4180, 4196, 4152, 4012, 2541, 3549,
|
||||
2523, 1399, 3562, 4146, 4186, 4194, 4184, 4187, 4168, 4097, 4085, 2635, 3664, 2640, 3402, 1556, 5000, 2570, 6225, 6193, 6166, 6140, 6184, 6117,
|
||||
5998, 5925, 6801, 2830, 5933, 2700, 3740, 6247, 6243, 6211, 6178, 6190, 6233, 6129, 6084, 6970, 5605, 2886, 2648, 3765, 6847, 6828, 6769, 6760,
|
||||
6712, 6795, 6825, 6794, 4762, 2591, 2555, 973, 2601, 4066, 4043, 4026, 4051, 4061, 4032, 4031, 3959, 2468, 3570, 3597, 2526, 1366, 5000, 6146,
|
||||
6125, 6071, 6074, 6081, 6003, 5866, 5827, 6675, 2825, 5834, 5973, 2701, 6152, 6167, 6091, 6093, 6032, 6117, 6034, 5973, 6879, 5495, 2836, 5989,
|
||||
2662, 6201, 6164, 6133, 6100, 6082, 6093, 6168, 6065, 7029, 5636, 5644, 2888, 2615, 6702, 6674, 6641, 6620, 6722, 6691, 6757, 6791, 4744, 2600,
|
||||
2563, 2517, 812, 5000, 4697, 4687, 4417, 4140, 3761, 3437, 3194, 2994, 1125, 2781, 2777, 2715, 2831, 3717, 3698, 3703, 3718, 3715, 3643, 3569,
|
||||
3424, 2693, 1563, 3464, 3562, 2818, 3719, 3753, 3725, 3775, 3735, 3775, 3623, 3517, 2670, 3240, 1613, 3607, 2802, 3672, 3652, 3679, 3790, 3737,
|
||||
3734, 3702, 3593, 2624, 3334, 3369, 1585, 5000, 4720, 4445, 4150, 3807, 3451, 3259, 3013, 1176, 2799, 2817, 2769, 4087, 2856, 3765, 3706, 3742,
|
||||
3741, 3648, 3584, 3451, 2718, 1593, 3519, 3566, 4088, 2862, 3748, 3752, 3767, 3751, 3745, 3705, 3551, 2725, 3298, 1638, 3634, 4041, 2827, 3669,
|
||||
3669, 3803, 3762, 3736, 3760, 3620, 2679, 3329, 3388, 1634, 5000, 4466, 4196, 3791, 3522, 3242, 3072, 1200, 2891, 2865, 2814, 4106, 4077, 2881,
|
||||
3738, 3760, 3757, 3683, 3590, 3456, 2799, 1651, 3520, 3596, 4146, 4128, 2870, 3741, 3776, 3768, 3798, 3694, 3582, 2774, 3286, 1656, 3650, 4056,
|
||||
4028, 2837, 3686, 3791, 3775, 3795, 3776, 3672, 2723, 3347, 3404, 1671, 5000, 4207, 3818, 3531, 3305, 3057, 1238, 2932, 2940, 2876, 4195, 4115,
|
||||
4096, 2897, 3781, 3806, 3713, 3621, 3468, 2827, 1702, 3565, 3663, 4196, 4148, 4121, 2850, 3783, 3788, 3806, 3711, 3593, 2838, 3315, 1727, 3677,
|
||||
4105, 4081, 4043, 2840, 3803, 3793, 3779, 3823, 3684, 2771, 3424, 3439, 1683, 5000, 3784, 3487, 3261, 3065, 1226, 2917, 2880, 2924, 4180, 4164,
|
||||
4081, 4073, 2879, 3768, 3646, 3582, 3445, 2820, 1620, 3591, 3671, 4197, 4168, 4117, 4067, 2877, 3749, 3774, 3676, 3545, 2794, 3364, 1670, 3663,
|
||||
4214, 4168, 4116, 4093, 2866, 3779, 3770, 3803, 3671, 2816, 3430, 3427, 1697, 5000, 3496, 3315, 3108, 1343, 2876, 3019, 2967, 4288, 4248, 4191,
|
||||
4191, 4195, 2988, 3739, 3652, 3527, 2775, 1768, 3648, 3715, 4348, 4257, 4237, 4199, 4206, 2988, 3857, 3761, 3623, 2915, 3403, 1779, 3774, 4292,
|
||||
4267, 4209, 4187, 4215, 2962, 3835, 3861, 3767, 2848, 3488, 3521, 1836, 5000, 3281, 3084, 1486, 3027, 2984, 3099, 4389, 4364, 4340, 4319, 4300,
|
||||
4247, 2995, 3744, 3634, 2925, 1776, 3702, 3866, 4368, 4382, 4362, 4330, 4327, 4268, 3077, 3832, 3747, 2878, 3470, 1908, 3855, 4365, 4384, 4334,
|
||||
4304, 4364, 4272, 3065, 3931, 3853, 2988, 3612, 3611, 1961, 5000, 3104, 1582, 3015, 3117, 3089, 4455, 4474, 4464, 4403, 4423, 4409, 4243, 2988,
|
||||
3715, 2913, 1790, 3824, 3906, 4456, 4489, 4483, 4435, 4467, 4341, 4311, 3077, 3808, 3004, 3562, 1958, 3945, 4457, 4422, 4405, 4406, 4432, 4378,
|
||||
4327, 3172, 3908, 2978, 3664, 3689, 2050, 5000, 1773, 3053, 3168, 3268, 4618, 4596, 4570, 4573, 4625, 4550, 4418, 4289, 2978, 2956, 1840, 3897,
|
||||
4043, 4626, 4618, 4603, 4611, 4602, 4528, 4514, 4379, 3101, 3064, 3661, 1983, 4054, 4548, 4564, 4580, 4569, 4607, 4506, 4462, 4467, 3189, 3147,
|
||||
3781, 3819, 2125, 5000, 6676, 6849, 6975, 6949, 6914, 6868, 6835, 6875, 6887, 6829, 6807, 6741, 6310, 1825, 5650, 5717, 6958, 6911, 6883, 6826,
|
||||
6873, 6843, 6916, 6861, 6817, 6459, 5361, 1852, 5710, 6782, 6772, 6734, 6709, 6858, 6828, 6820, 6882, 6816, 6591, 5425, 5427, 1880, 5000, 2615,
|
||||
2731, 6990, 6941, 6925, 6856, 6881, 6925, 6903, 6906, 6885, 4759, 1075, 2591, 2714, 4197, 4205, 4182, 4195, 4213, 4219, 4126, 4015, 3859, 2519,
|
||||
2529, 1370, 3526, 4179, 4161, 4184, 4154, 4206, 4178, 4140, 4106, 3975, 2626, 2621, 3360, 1529, 5000, 2579, 6251, 6236, 6183, 6191, 6154, 6191,
|
||||
6091, 6042, 5920, 6984, 2842, 2602, 3726, 6994, 6957, 6913, 6864, 6868, 6860, 6924, 6900, 6895, 4748, 2503, 908, 2571, 4028, 4044, 4026, 4043,
|
||||
4062, 4029, 4040, 3991, 3818, 2475, 3544, 2485, 1347, 5000, 6187, 6106, 6107, 6080, 6037, 6074, 6005, 5910, 5797, 6865, 2789, 5991, 2618, 6147,
|
||||
6133, 6106, 6081, 6084, 6067, 6109, 6053, 5890, 7013, 5642, 2841, 2627, 6830, 6801, 6760, 6743, 6888, 6847, 6856, 6900, 6896, 4759, 2513, 2528,
|
||||
772, 5000, 4739, 4686, 4431, 4141, 3804, 3500, 3208, 3001, 2877, 1109, 2770, 2713, 2784, 3672, 3710, 3715, 3702, 3717, 3756, 3604, 3502, 3516,
|
||||
2677, 1538, 3544, 2737, 3632, 3635, 3616, 3723, 3718, 3657, 3718, 3594, 3590, 2626, 3302, 1537, 5000, 4704, 4460, 4152, 3845, 3482, 3279, 3038,
|
||||
2926, 1130, 2780, 2733, 4099, 2821, 3712, 3679, 3714, 3748, 3742, 3673, 3517, 3532, 2687, 1568, 3560, 4004, 2761, 3596, 3622, 3757, 3738, 3718,
|
||||
3755, 3604, 3629, 2652, 3313, 1570, 5000, 4463, 4162, 3878, 3518, 3237, 3095, 2951, 1197, 2833, 2808, 4131, 4080, 2811, 3693, 3708, 3753, 3811,
|
||||
3682, 3552, 3558, 2740, 1639, 3598, 4028, 3984, 2774, 3637, 3734, 3787, 3772, 3739, 3656, 3653, 2704, 3366, 1619, 5000, 4200, 3869, 3519, 3317,
|
||||
3069, 3033, 1210, 2910, 2824, 4120, 4098, 4077, 2843, 3743, 3773, 3793, 3699, 3576, 3577, 2813, 1644, 3608, 4056, 4042, 4034, 2784, 3769, 3754,
|
||||
3758, 3822, 3669, 3687, 2726, 3381, 1671, 5000, 3846, 3545, 3269, 3100, 3006, 1222, 2918, 2905, 4169, 4151, 4103, 4081, 2850, 3762, 3780, 3695,
|
||||
3574, 3611, 2817, 1656, 3647, 4195, 4140, 4125, 4095, 2816, 3761, 3768, 3805, 3725, 3698, 2799, 3415, 1705, 5000, 3495, 3273, 3071, 2974, 1183,
|
||||
2904, 2871, 4203, 4168, 4110, 4077, 4031, 2810, 3732, 3623, 3543, 3559, 2814, 1623, 3654, 4178, 4126, 4074, 4042, 4087, 2805, 3731, 3735, 3618,
|
||||
3685, 2767, 3398, 1634, 5000, 3281, 3080, 2994, 1318, 2871, 2993, 4249, 4257, 4241, 4213, 4169, 4143, 2935, 3717, 3627, 3651, 2774, 1755, 3748,
|
||||
4247, 4255, 4196, 4176, 4187, 4215, 2890, 3845, 3709, 3765, 2878, 3501, 1779, 5000, 3080, 3002, 1438, 2976, 2958, 4367, 4365, 4333, 4322, 4269,
|
||||
4288, 4238, 2971, 3678, 3723, 2872, 1768, 3790, 4329, 4288, 4335, 4262, 4327, 4311, 4229, 3014, 3795, 3805, 2855, 3553, 1886, 5000, 3015, 1618,
|
||||
3029, 3144, 4507, 4473, 4480, 4480, 4444, 4454, 4423, 4279, 2926, 3826, 2928, 1805, 3929, 4428, 4468, 4458, 4438, 4443, 4428, 4371, 4373, 3014,
|
||||
3937, 3017, 3690, 1960, 5000, 1576, 3036, 3154, 4448, 4495, 4444, 4443, 4478, 4477, 4398, 4288, 4133, 2920, 2916, 1795, 3877, 4475, 4432, 4431,
|
||||
4425, 4463, 4444, 4425, 4383, 4231, 3010, 3042, 3643, 1922, 5000, 6883, 6977, 6941, 6886, 6878, 6816, 6841, 6855, 6886, 6820, 6753, 6801, 6491,
|
||||
1761, 5685, 6830, 6773, 6732, 6716, 6823, 6827, 6816, 6862, 6791, 6852, 6580, 5409, 1826, 5000, 2549, 7061, 7032, 6994, 6965, 6902, 6925, 6982,
|
||||
6955, 6936, 6975, 4752, 873, 2522, 4014, 3992, 3968, 3963, 4011, 4017, 4026, 3972, 3815, 3817, 2441, 2448, 1283, 5000, 6174, 6129, 6104, 6079,
|
||||
6016, 6043, 6096, 6004, 5869, 5919, 7037, 2775, 2563, 6949, 6887, 6799, 6780, 6920, 6907, 6906, 6958, 6943, 6957, 4750, 2448, 711, 5000, 4700,
|
||||
4681, 4454, 4149, 3800, 3488, 3217, 3020, 2901, 2834, 1073, 2670, 2689, 3608, 3609, 3604, 3690, 3617, 3680, 3716, 3569, 3593, 3577, 2573, 1504,
|
||||
5000, 4689, 4463, 4172, 3817, 3526, 3275, 3053, 2937, 2839, 1122, 2743, 3967, 2706, 3591, 3600, 3710, 3683, 3712, 3713, 3594, 3622, 3604, 2659,
|
||||
1547, 5000, 4461, 4131, 3843, 3581, 3284, 3112, 2968, 2906, 1155, 2798, 3996, 3967, 2729, 3577, 3709, 3745, 3727, 3764, 3621, 3638, 3644, 2703,
|
||||
1601, 5000, 4153, 3843, 3601, 3359, 3107, 3024, 2915, 1181, 2819, 4045, 4026, 3979, 2737, 3714, 3732, 3793, 3777, 3650, 3639, 3661, 2718, 1646,
|
||||
5000, 3815, 3592, 3331, 3160, 3001, 2950, 1207, 2875, 4128, 4109, 4074, 4075, 2772, 3748, 3757, 3797, 3655, 3662, 3727, 2778, 1671, 5000, 3549,
|
||||
3288, 3068, 3026, 2950, 1207, 2906, 4148, 4096, 4067, 4045, 4100, 2767, 3733, 3725, 3655, 3674, 3701, 2792, 1665, 5000, 3269, 3056, 2974, 2901,
|
||||
1167, 2870, 4103, 4118, 4056, 4047, 4058, 4053, 2755, 3734, 3584, 3608, 3638, 2762, 1607, 5000, 3088, 2964, 2924, 1286, 2808, 4212, 4201, 4180,
|
||||
4138, 4194, 4131, 4132, 2877, 3663, 3681, 3730, 2715, 1723, 5000, 3008, 2944, 1482, 3032, 4338, 4317, 4294, 4323, 4329, 4306, 4313, 4253, 2872,
|
||||
3845, 3872, 2923, 1771, 5000, 2940, 1415, 3000, 4307, 4295, 4295, 4304, 4335, 4303, 4314, 4245, 4101, 2903, 3824, 2887, 1750, 5000, 1379, 2951,
|
||||
4267, 4247, 4248, 4252, 4290, 4287, 4299, 4246, 4105, 4096, 2856, 2863, 1729, 5000, 7015, 6796, 6775, 6712, 6669, 6803, 6823, 6803, 6844, 6748,
|
||||
6805, 6866, 6620, 1813, 5000, 6972, 6915, 6886, 6824, 6974, 6942, 6964, 7007, 6949, 6940, 7021, 4744, 669, 5000, 4722, 4699, 4449, 4235, 3920,
|
||||
3641, 3428, 3161, 3030, 2925, 2890, 1211, 5000, 4725, 4457, 4270, 3970, 3640, 3445, 3183, 3078, 3000, 2949, 1253, 5000, 4488, 4308, 3938, 3700,
|
||||
3445, 3243, 3111, 3073, 2987, 1295, 5000, 4324, 3965, 3725, 3506, 3229, 3119, 3074, 3033, 1325, 5000, 3836, 3563, 3356, 3148, 3004, 2965, 2909,
|
||||
1192, 5000, 3550, 3367, 3167, 3032, 2960, 2937, 1189, 5000, 3312, 3114, 3033, 2970, 2909, 1190, 5000, 3089, 2995, 2926, 2888, 1158, 5000, 3009,
|
||||
2960, 2917, 1332, 5000, 2914, 2929, 1301, 5000, 2891, 1231, 5000, 1225, 5000,
|
||||
];
|
||||
@@ -0,0 +1,119 @@
|
||||
//! The 169 hold'em starting-hand classes on a fixed 13 x 13 grid.
|
||||
//!
|
||||
//! Class id = `row * 13 + col` with rank indices `Two = 0 .. Ace = 12`:
|
||||
//! pairs on the diagonal, suited above it (`row` = high rank, `col` = low rank),
|
||||
//! offsuit below it (`row` = low rank, `col` = high rank). The grid is the same for every deck;
|
||||
//! a deck without the low ranks (short deck) simply leaves those cells empty
|
||||
//! (`class_exists` is false), so the generated tables keep one layout for all variants.
|
||||
|
||||
use crate::card::{Card, Rank, Suit};
|
||||
use crate::variant::DeckRule;
|
||||
|
||||
pub const CLASS_COUNT: usize = 169;
|
||||
|
||||
/// Dense class index `0..CLASS_COUNT`.
|
||||
pub type ClassId = usize;
|
||||
|
||||
const RANKS: usize = 13;
|
||||
|
||||
/// Class of a hand with the given ranks (any order). `suited` is ignored for pairs.
|
||||
pub fn class_id(a: Rank, b: Rank, suited: bool) -> ClassId {
|
||||
let (high, low) = if a >= b { (a as usize, b as usize) } else { (b as usize, a as usize) };
|
||||
if high == low {
|
||||
high * RANKS + high
|
||||
} else if suited {
|
||||
high * RANKS + low
|
||||
} else {
|
||||
low * RANKS + high
|
||||
}
|
||||
}
|
||||
|
||||
/// `None` when both cards are the same card.
|
||||
pub fn class_of(a: Card, b: Card) -> Option<ClassId> {
|
||||
(a != b).then(|| class_id(a.rank, b.rank, a.suit == b.suit))
|
||||
}
|
||||
|
||||
/// `(high, low, suited)` rank indices of a class; pairs report `suited = false`.
|
||||
fn decode(id: ClassId) -> Option<(usize, usize, bool)> {
|
||||
(id < CLASS_COUNT).then(|| {
|
||||
let (row, col) = (id / RANKS, id % RANKS);
|
||||
match row.cmp(&col) {
|
||||
std::cmp::Ordering::Equal => (row, row, false),
|
||||
std::cmp::Ordering::Greater => (row, col, true),
|
||||
std::cmp::Ordering::Less => (col, row, false),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// `"AA"`, `"AKs"`, `"T9o"`.
|
||||
pub fn class_name(id: ClassId) -> Option<String> {
|
||||
decode(id).map(|(high, low, suited)| {
|
||||
let kind = if high == low {
|
||||
""
|
||||
} else if suited {
|
||||
"s"
|
||||
} else {
|
||||
"o"
|
||||
};
|
||||
format!("{}{}{}", Rank::ALL[high].symbol(), Rank::ALL[low].symbol(), kind)
|
||||
})
|
||||
}
|
||||
|
||||
/// Inverse of `class_name`. Pairs take no suffix, other classes need `s` or `o`.
|
||||
pub fn class_parse(name: &str) -> Option<ClassId> {
|
||||
let chars: Vec<char> = name.trim().chars().collect();
|
||||
let rank = |c: char| Rank::parse(&c.to_string());
|
||||
match chars.as_slice() {
|
||||
[a, b] => {
|
||||
let (a, b) = (rank(*a)?, rank(*b)?);
|
||||
(a == b).then(|| class_id(a, b, false))
|
||||
}
|
||||
[a, b, kind] => {
|
||||
let (a, b) = (rank(*a)?, rank(*b)?);
|
||||
if a == b {
|
||||
return None;
|
||||
}
|
||||
match kind {
|
||||
's' | 'S' => Some(class_id(a, b, true)),
|
||||
'o' | 'O' => Some(class_id(a, b, false)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Every two-card combination of the class in a full 52-card deck (6 / 4 / 12).
|
||||
pub fn class_combos(id: ClassId) -> Vec<[Card; 2]> {
|
||||
let Some((high, low, suited)) = decode(id) else {
|
||||
return Vec::new();
|
||||
};
|
||||
let (high, low) = (Rank::ALL[high], Rank::ALL[low]);
|
||||
let suits = Suit::ALL;
|
||||
if high == low {
|
||||
(0..4)
|
||||
.flat_map(|i| (i + 1..4).map(move |j| (i, j)))
|
||||
.map(|(i, j)| [Card::new(high, suits[i]), Card::new(low, suits[j])])
|
||||
.collect()
|
||||
} else if suited {
|
||||
suits.iter().map(|s| [Card::new(high, *s), Card::new(low, *s)]).collect()
|
||||
} else {
|
||||
suits
|
||||
.iter()
|
||||
.flat_map(|a| suits.iter().filter(move |b| *b != a).map(move |b| (*a, *b)))
|
||||
.map(|(a, b)| [Card::new(high, a), Card::new(low, b)])
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// True when both ranks of the class are in the deck.
|
||||
pub fn class_exists(deck: DeckRule, id: ClassId) -> bool {
|
||||
decode(id).is_some_and(|(high, low, _)| {
|
||||
deck.contains(Rank::ALL[high]) && deck.contains(Rank::ALL[low])
|
||||
})
|
||||
}
|
||||
|
||||
/// All classes that exist in the deck, in id order.
|
||||
pub fn classes_in(deck: DeckRule) -> Vec<ClassId> {
|
||||
(0..CLASS_COUNT).filter(|id| class_exists(deck, *id)).collect()
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//! One CFR+ iteration as a pure fold step `(state, rng) -> (state, rng)`.
|
||||
//!
|
||||
//! Full-width, vectorised over hand classes: every deal is enumerated exactly through the chance
|
||||
//! table, so no random numbers are drawn and the generator passes through unchanged (it is part
|
||||
//! of the signature so a sampling variant can replace this step without touching callers).
|
||||
//! Update rule: CFR+ with alternating players -- regrets are floored at zero, the average
|
||||
//! strategy is weighted linearly by the iteration number (Tammelin 2014), player 0 is updated
|
||||
//! first and player 1 then responds to the updated strategy.
|
||||
//!
|
||||
//! The mutation below is local to this function: the input state is consumed, a new one returned.
|
||||
|
||||
use super::regret_matching::matched;
|
||||
use super::solver_state::SolverState;
|
||||
use super::terminal_value::terminal_value;
|
||||
use super::tree::{Node, Tree};
|
||||
use crate::rng::Rng;
|
||||
|
||||
pub fn iterate(tree: &Tree, state: SolverState, rng: Rng) -> (SolverState, Rng) {
|
||||
let (iteration, mut regret, mut sums) = state.into_parts();
|
||||
let next = iteration.saturating_add(1);
|
||||
if tree.is_playable() && regret.len() == tree.nodes.len() {
|
||||
let ones = vec![1.0; tree.classes];
|
||||
for player in 0..2 {
|
||||
let mut pass = Pass { tree, player, weight: next as f64, regret: &mut regret, sums: &mut sums };
|
||||
pass.walk(tree.root, &ones, &ones);
|
||||
}
|
||||
}
|
||||
(SolverState::from_parts(next, regret, sums), rng)
|
||||
}
|
||||
|
||||
struct Pass<'a> {
|
||||
tree: &'a Tree,
|
||||
player: usize,
|
||||
weight: f64,
|
||||
regret: &'a mut Vec<Vec<f64>>,
|
||||
sums: &'a mut Vec<Vec<f64>>,
|
||||
}
|
||||
|
||||
impl Pass<'_> {
|
||||
/// Counterfactual values of the traversing player at `node`, one per class.
|
||||
fn walk(&mut self, node: usize, own: &[f64], opp: &[f64]) -> Vec<f64> {
|
||||
let tree = self.tree;
|
||||
let n = tree.classes;
|
||||
match tree.nodes.get(node) {
|
||||
None => vec![0.0; n],
|
||||
Some(Node::Terminal(payoff)) => terminal_value(payoff, &tree.chance, n, self.player, opp),
|
||||
Some(Node::Chance(branches)) => {
|
||||
let mut total = vec![0.0; n];
|
||||
for (p, child) in branches {
|
||||
let scaled: Vec<f64> = opp.iter().map(|x| x * p).collect();
|
||||
let value = self.walk(*child, own, &scaled);
|
||||
total.iter_mut().zip(&value).for_each(|(t, v)| *t += v);
|
||||
}
|
||||
total
|
||||
}
|
||||
Some(Node::Decision { player, children, .. }) => {
|
||||
let actions = children.len();
|
||||
if actions == 0 {
|
||||
return vec![0.0; n];
|
||||
}
|
||||
let sigma = matched(&self.regret[node], actions);
|
||||
if *player == self.player {
|
||||
self.own_node(node, children, &sigma, own, opp)
|
||||
} else {
|
||||
let mut total = vec![0.0; n];
|
||||
for (a, child) in children.iter().enumerate() {
|
||||
let reach: Vec<f64> = (0..n).map(|j| opp[j] * sigma[j * actions + a]).collect();
|
||||
let value = self.walk(*child, own, &reach);
|
||||
total.iter_mut().zip(&value).for_each(|(t, v)| *t += v);
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn own_node(&mut self, node: usize, children: &[usize], sigma: &[f64], own: &[f64], opp: &[f64]) -> Vec<f64> {
|
||||
let n = self.tree.classes;
|
||||
let actions = children.len();
|
||||
let values: Vec<Vec<f64>> = children
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(a, child)| {
|
||||
let reach: Vec<f64> = (0..n).map(|i| own[i] * sigma[i * actions + a]).collect();
|
||||
self.walk(*child, &reach, opp)
|
||||
})
|
||||
.collect();
|
||||
let mut node_value = vec![0.0; n];
|
||||
for i in 0..n {
|
||||
node_value[i] = (0..actions).map(|a| sigma[i * actions + a] * values[a][i]).sum();
|
||||
for a in 0..actions {
|
||||
let r = &mut self.regret[node][i * actions + a];
|
||||
*r = (*r + values[a][i] - node_value[i]).max(0.0);
|
||||
self.sums[node][i * actions + a] += self.weight * own[i] * sigma[i * actions + a];
|
||||
}
|
||||
}
|
||||
node_value
|
||||
}
|
||||
}
|
||||
+78
-2
@@ -1,2 +1,78 @@
|
||||
//! Offline preflop chart derivation: counterfactual regret minimisation over a small,
|
||||
//! documented preflop abstraction. Pure; the only I/O lives in `src/bin/chartgen.rs`.
|
||||
//! Offline preflop chart derivation: counterfactual regret minimisation over a small,
|
||||
//! documented preflop abstraction. Pure; the only I/O lives in `src/bin/chartgen.rs`.
|
||||
//!
|
||||
//! # Abstraction (every assumption)
|
||||
//!
|
||||
//! **Hands.** The 169 hold'em classes (`hand_class`), dealt with exact combo weights:
|
||||
//! a deal is an ordered pair of disjoint combos, all equally likely, so card removal between the
|
||||
//! two players is exact (`chance_table`). Other players' cards are ignored (see multiway).
|
||||
//!
|
||||
//! **Equity.** `equity_matrix`: all-in preflop equity of every class against every class, from a
|
||||
//! seeded Monte Carlo over disjoint combo pairs and uniformly random five-card boards, evaluated
|
||||
//! with `hand::showdown::judge` (`equity_pair`). Frozen as integers in `generated_equity.rs`
|
||||
//! (regenerate with `chartgen equity`). Noise: about 0.2 % per entry at 60 000 samples.
|
||||
//!
|
||||
//! **Games** (`push_fold_game`, `open_game`), blinds 0.5 / 1, 6-max seats `seat`:
|
||||
//! - push / fold: the first actor jams the effective stack or folds; the big blind calls or folds.
|
||||
//! - open / call / 3-bet: raise to a fixed size or fold; the big blind folds, calls or 3-bets to a
|
||||
//! fixed size; versus the 3-bet the opener folds, calls or jams; the big blind calls or folds
|
||||
//! the jam. Sizes: `spot_params`.
|
||||
//!
|
||||
//! **Multiway.** One opponent is modelled. The players behind the first actor each hold a hand
|
||||
//! that continues with probability `WAKE_FRACTION` (the top 15 % of combos by random-hand
|
||||
//! equity); if one does, the first actor is called by that range and the big blind takes no
|
||||
//! decision. Players behind are independent, and their cards do not block the modelled hands.
|
||||
//!
|
||||
//! **Payoffs.** Net result in bb for the first actor, zero-sum. All-in lines use raw equity.
|
||||
//! Lines that leave chips behind use `pot x realised share`: equity is stretched around 50 %
|
||||
//! (the better hand realises more, `REALIZATION_SPREAD`), then the out-of-position player's side
|
||||
//! counts `R` (0.85 in single-raised, 0.90 in 3-bet pots) against the in-position player's 1.0 and
|
||||
//! the pot is split in proportion -- zero-sum, unlike a one-sided `pot x equity x R`.
|
||||
//! The big blind is out of position against every seat but the small blind.
|
||||
//!
|
||||
//! **Variants.** `Environment::new(rules, equity)` is generic over the rules: any two-card game
|
||||
//! whose deck rule yields the class set (`classes_in`). AOF (binary action shape) is exactly the
|
||||
//! push / fold game. Short deck needs only one more run once `hand::showdown::judge` is
|
||||
//! deck-aware: `chartgen equity --deck short` (equity for the 81 classes of the 36-card deck),
|
||||
//! then solve the spots with that `Environment`.
|
||||
//!
|
||||
//! # Solver
|
||||
//!
|
||||
//! Full-width vectorised CFR+ (`iterate`): regrets floored at zero, alternating updates, average
|
||||
//! strategy linearly weighted. One iteration is a pure fold step `(state, rng) -> (state, rng)`;
|
||||
//! the generator is passed through because enumerating all deals needs no randomness.
|
||||
//! `solve` records the convergence (`checkpoints`, `stable_since`), `exploitability` and
|
||||
//! `deviation` implement the Nash test, `spot_solver` freezes a spot as permille tables.
|
||||
|
||||
pub mod chance_table;
|
||||
pub mod chart_signature;
|
||||
pub mod deviation;
|
||||
pub mod environment;
|
||||
pub mod equity_matrix;
|
||||
pub mod equity_pair;
|
||||
pub mod equity_run;
|
||||
pub mod exploitability;
|
||||
pub mod frozen_equity;
|
||||
pub mod frozen_spot;
|
||||
pub mod frozen_strategy;
|
||||
pub mod generated_equity;
|
||||
pub mod hand_class;
|
||||
pub mod iterate;
|
||||
pub mod open_game;
|
||||
pub mod payoffs;
|
||||
pub mod permille;
|
||||
pub mod push_fold_game;
|
||||
pub mod regret_matching;
|
||||
pub mod render_charts;
|
||||
pub mod render_equity;
|
||||
pub mod run_plan;
|
||||
pub mod seat;
|
||||
pub mod solve;
|
||||
pub mod solver_state;
|
||||
pub mod spot_params;
|
||||
pub mod spot_solver;
|
||||
pub mod strategy;
|
||||
pub mod terminal_value;
|
||||
pub mod tree;
|
||||
pub mod value_walk;
|
||||
pub mod wake_range;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//! Game (b): open / call / 3-bet, one defender.
|
||||
//!
|
||||
//! The first actor at `seat` folds or raises to `OPEN_SIZE` (`SMALL_BLIND_OPEN_SIZE` from the
|
||||
//! small blind). If the players behind fold the big blind folds, calls or 3-bets to
|
||||
//! `THREE_BET_SIZE`; otherwise (probability `1 - field_folds`) a hand of the top `WAKE_FRACTION`
|
||||
//! range calls the open and the opener plays that pot with the equity of his class against the
|
||||
//! range, out of position unless he is on the button.
|
||||
//!
|
||||
//! Versus the 3-bet the opener folds, calls or jams; the big blind then calls or folds the jam.
|
||||
//! Calls that leave chips behind end in a postflop payoff (pot x realised equity, see
|
||||
//! `spot_params`); jams are raw all-in equity.
|
||||
//!
|
||||
//! Decisions: `open` (P0: fold / raise), `defend` (P1: fold / call / 3-bet),
|
||||
//! `vs_three_bet` (P0: fold / call / jam), `vs_jam` (P1: fold / call).
|
||||
|
||||
use super::environment::Environment;
|
||||
use super::hand_class::CLASS_COUNT;
|
||||
use super::payoffs::{all_in, postflop, share};
|
||||
use super::seat::Seat;
|
||||
use super::spot_params::{
|
||||
field_folds, BIG_BLIND, OPEN_SIZE, REALIZATION_OOP_SINGLE_RAISED, REALIZATION_OOP_THREE_BET,
|
||||
SMALL_BLIND, SMALL_BLIND_OPEN_SIZE, THREE_BET_SIZE, WAKE_FRACTION,
|
||||
};
|
||||
use super::tree::{Node, Payoff, Tree};
|
||||
use super::wake_range::{equity_against, top_membership};
|
||||
use crate::fault::Fault;
|
||||
|
||||
pub fn open_size(seat: Seat) -> f64 {
|
||||
if seat == Seat::SmallBlind {
|
||||
SMALL_BLIND_OPEN_SIZE
|
||||
} else {
|
||||
OPEN_SIZE
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open_tree(env: &Environment, seat: Seat, depth_bb: f64) -> Result<Tree, Fault> {
|
||||
if !depth_bb.is_finite() || depth_bb <= THREE_BET_SIZE {
|
||||
return Err(Fault::Invalid {
|
||||
field: "depth_bb".into(),
|
||||
detail: "stack must exceed the 3-bet size".into(),
|
||||
});
|
||||
}
|
||||
let (s, x, y) = (depth_bb, open_size(seat), THREE_BET_SIZE);
|
||||
let dead = seat.dead_money();
|
||||
let ip = seat.is_in_position_against_big_blind();
|
||||
let r = field_folds(seat.players_behind());
|
||||
let wake = equity_against(env, &top_membership(env, WAKE_FRACTION));
|
||||
let wake_ip = seat == Seat::Button;
|
||||
let wake_payoff = Payoff::Own(
|
||||
wake.iter()
|
||||
.map(|e| (2.0 * x + SMALL_BLIND + BIG_BLIND) * share(*e, wake_ip, REALIZATION_OOP_SINGLE_RAISED) - x)
|
||||
.collect(),
|
||||
);
|
||||
|
||||
let mut nodes: Vec<Node> = Vec::new();
|
||||
let mut add = |node: Node| -> usize {
|
||||
nodes.push(node);
|
||||
nodes.len() - 1
|
||||
};
|
||||
let t_open_fold = add(Node::Terminal(Payoff::Flat(-seat.posted_blind())));
|
||||
let t_big_blind_folds = add(Node::Terminal(Payoff::Flat(BIG_BLIND + dead)));
|
||||
let t_called = add(Node::Terminal(postflop(env, 2.0 * x + dead, x, ip, REALIZATION_OOP_SINGLE_RAISED)));
|
||||
let t_opener_folds = add(Node::Terminal(Payoff::Flat(-x)));
|
||||
let t_three_bet_called =
|
||||
add(Node::Terminal(postflop(env, 2.0 * y + dead, y, ip, REALIZATION_OOP_THREE_BET)));
|
||||
let t_jam_folded = add(Node::Terminal(Payoff::Flat(y + dead)));
|
||||
let t_jam_called = add(Node::Terminal(all_in(env, 2.0 * s + dead, s)));
|
||||
let vs_jam = add(Node::Decision { player: 1, name: "vs_jam", children: vec![t_jam_folded, t_jam_called] });
|
||||
let vs_three_bet = add(Node::Decision {
|
||||
player: 0,
|
||||
name: "vs_three_bet",
|
||||
children: vec![t_opener_folds, t_three_bet_called, vs_jam],
|
||||
});
|
||||
let defend = add(Node::Decision {
|
||||
player: 1,
|
||||
name: "defend",
|
||||
children: vec![t_big_blind_folds, t_called, vs_three_bet],
|
||||
});
|
||||
let raised = if r < 1.0 {
|
||||
let t_woken = add(Node::Terminal(wake_payoff));
|
||||
add(Node::Chance(vec![(r, defend), (1.0 - r, t_woken)]))
|
||||
} else {
|
||||
defend
|
||||
};
|
||||
let root = add(Node::Decision { player: 0, name: "open", children: vec![t_open_fold, raised] });
|
||||
Ok(Tree { classes: CLASS_COUNT, chance: env.chance.joint(), nodes, root })
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//! Payoff matrices for the two kinds of showdown the games use. `u(i, j)` is always the net
|
||||
//! result in bb for player 0 (invested chips already subtracted).
|
||||
|
||||
use super::environment::Environment;
|
||||
use super::hand_class::CLASS_COUNT;
|
||||
use super::spot_params::REALIZATION_SPREAD;
|
||||
use super::tree::Payoff;
|
||||
|
||||
fn matrix(env: &Environment, f: impl Fn(f64) -> f64) -> Payoff {
|
||||
Payoff::Pair(
|
||||
(0..CLASS_COUNT * CLASS_COUNT)
|
||||
.map(|k| f(env.equity.get(k / CLASS_COUNT, k % CLASS_COUNT)))
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
/// All-in showdown: raw equity of the whole pot.
|
||||
pub fn all_in(env: &Environment, pot: f64, invested: f64) -> Payoff {
|
||||
matrix(env, |eq| pot * eq - invested)
|
||||
}
|
||||
|
||||
/// Pot not yet decided by chips: each side gets `share` of it (see `share`).
|
||||
/// `player0_in_position` says who is who.
|
||||
pub fn postflop(env: &Environment, pot: f64, invested: f64, player0_in_position: bool, realization: f64) -> Payoff {
|
||||
matrix(env, |eq| pot * share(eq, player0_in_position, realization) - invested)
|
||||
}
|
||||
|
||||
/// Player 0's share of the pot given his all-in equity: stretch the equity around 50 % by
|
||||
/// `REALIZATION_SPREAD`, weight the out-of-position side by `realization`, split in proportion.
|
||||
/// The two players' shares always add up to 1.
|
||||
pub fn share(equity: f64, player0_in_position: bool, realization: f64) -> f64 {
|
||||
let stretched = (0.5 + REALIZATION_SPREAD * (equity - 0.5)).clamp(0.0, 1.0);
|
||||
let (ip, oop) = if player0_in_position {
|
||||
(stretched, realization * (1.0 - stretched))
|
||||
} else {
|
||||
(1.0 - stretched, realization * stretched)
|
||||
};
|
||||
let total = ip + oop;
|
||||
let ip_share = if total > 0.0 { ip / total } else { 0.5 };
|
||||
if player0_in_position { ip_share } else { 1.0 - ip_share }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//! Rounding probabilities to whole permille that still sum to exactly 1000.
|
||||
|
||||
/// Largest-remainder rounding. Negative or non-finite entries count as 0; an all-zero row puts
|
||||
/// everything on the first action.
|
||||
pub fn to_permille(row: &[f64]) -> Vec<u16> {
|
||||
let clean: Vec<f64> = row.iter().map(|p| if p.is_finite() && *p > 0.0 { *p } else { 0.0 }).collect();
|
||||
let total: f64 = clean.iter().sum();
|
||||
if row.is_empty() {
|
||||
return Vec::new();
|
||||
}
|
||||
if total <= 0.0 {
|
||||
return (0..row.len()).map(|a| if a == 0 { 1000 } else { 0 }).collect();
|
||||
}
|
||||
let scaled: Vec<f64> = clean.iter().map(|p| p / total * 1000.0).collect();
|
||||
let mut out: Vec<u16> = scaled.iter().map(|x| x.floor() as u16).collect();
|
||||
let missing = 1000 - out.iter().map(|x| *x as u32).sum::<u32>().min(1000);
|
||||
let mut order: Vec<usize> = (0..row.len()).collect();
|
||||
order.sort_by(|a, b| {
|
||||
let (fa, fb) = (scaled[*a] - scaled[*a].floor(), scaled[*b] - scaled[*b].floor());
|
||||
fb.partial_cmp(&fa).unwrap_or(std::cmp::Ordering::Equal).then(a.cmp(b))
|
||||
});
|
||||
for index in order.into_iter().take(missing as usize) {
|
||||
out[index] += 1;
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub fn from_permille(row: &[u16]) -> Vec<f64> {
|
||||
row.iter().map(|p| *p as f64 / 1000.0).collect()
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//! 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::{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();
|
||||
let wake = equity_against(env, &top_membership(env, WAKE_FRACTION));
|
||||
let wake_payoff = Payoff::Own(wake.iter().map(|e| e * (2.0 * s + SMALL_BLIND + BIG_BLIND) - 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())));
|
||||
let t_big_blind_folds = add(Node::Terminal(Payoff::Flat(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 })
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//! Regret matching: play each action in proportion to its positive regret, uniformly if none.
|
||||
|
||||
/// `regrets` is `[class * actions + action]`; the result has the same layout.
|
||||
pub fn matched(regrets: &[f64], actions: usize) -> Vec<f64> {
|
||||
if actions == 0 {
|
||||
return Vec::new();
|
||||
}
|
||||
regrets
|
||||
.chunks(actions)
|
||||
.flat_map(|row| {
|
||||
let positive: f64 = row.iter().map(|r| r.max(0.0)).sum();
|
||||
row.iter()
|
||||
.map(move |r| if positive > 0.0 { r.max(0.0) / positive } else { 1.0 / actions as f64 })
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//! Rust source text of `preflop/generated_charts.rs`: header, convergence table, data.
|
||||
|
||||
use super::frozen_spot::{OpenSpot, PushFoldSpot, SpotMeta};
|
||||
use super::generated_equity;
|
||||
use super::render_equity::wrapped;
|
||||
use super::run_plan::{CFR_SEED, OPEN_DEPTHS, PUSH_FOLD_DEPTHS};
|
||||
use super::spot_params::{
|
||||
OPEN_SIZE, REALIZATION_OOP_SINGLE_RAISED, REALIZATION_OOP_THREE_BET, REALIZATION_SPREAD,
|
||||
SMALL_BLIND_OPEN_SIZE, THREE_BET_SIZE, WAKE_FRACTION,
|
||||
};
|
||||
|
||||
fn header() -> String {
|
||||
format!(
|
||||
"\
|
||||
//! GENERATED by `cargo run --release --bin chartgen -- charts > src/preflop/generated_charts.rs`.
|
||||
//! Do not edit. Frozen output of `crate::cfr`; the equity table is `src/cfr/generated_equity.rs`
|
||||
//! (`chartgen equity > src/cfr/generated_equity.rs`).
|
||||
//!
|
||||
//! Frequencies are permille (0..=1000) per hand class, indexed by `ClassId` of
|
||||
//! `cfr::hand_class` (13 x 13 grid; pairs on the diagonal, suited above, offsuit below).
|
||||
//! Layout and meaning of every field: `cfr::frozen_spot`.
|
||||
//!
|
||||
//! Abstraction (details in the `cfr` module docs; all numbers in `cfr::spot_params`):
|
||||
//! - 169 hold'em classes, exact combo weights with card removal between the two players.
|
||||
//! - Class-vs-class all-in equity: seeded Monte Carlo, `hand::showdown::judge`.
|
||||
//! - Blinds 0.5 / 1, 6-max, one modelled opponent (the big blind) plus a multiway tax: every
|
||||
//! player behind the first actor holds a continuing hand (top {wake:.0} % of combos) with
|
||||
//! probability {wake_p:.2}; if one does, the first actor is simply called by that range.
|
||||
//! - Push/fold: jam the effective stack or fold; the big blind calls or folds. AOF is the same
|
||||
//! game (`AOF_PUSH_FOLD` aliases `PUSH_FOLD`; `tests/generated_charts_reproduce.rs` re-solves it
|
||||
//! under the AOF rules).
|
||||
//! - Open/call/3-bet: open to {open} bb ({sb_open} bb from the small blind), the big blind folds,
|
||||
//! calls or 3-bets to {three_bet} bb, the opener folds, calls or jams, the big blind calls or folds
|
||||
//! the jam. Lines that leave chips behind pay pot x realised share: equity stretched by
|
||||
//! {spread} around 50 %, then split by position (out of position realises {oop} of its
|
||||
//! equity against the in-position player, {oop3} in 3-bet pots); all-in lines pay raw equity.
|
||||
//! - Solver: full-width CFR+ (regret floor 0, alternating players, average strategy weighted by
|
||||
//! iteration). Exploitability is that of the permille strategy printed here, in micro-bb
|
||||
//! (1e-6 bb): the sum of both players' best-response gains, as a share of every deal.
|
||||
//! - Ranges come out wider than 6-max solver charts for EP / MP because only one defender is
|
||||
//! modelled: read them as relative, abstraction-internal equilibria, not as solver output.
|
||||
//!
|
||||
//! Convergence per spot (`iterations`, `stable_since` = argmax chart final from that iteration,
|
||||
//! exploitability in micro-bb at N/100, N/20, N/5, N/2, N):
|
||||
//!
|
||||
",
|
||||
wake = WAKE_FRACTION * 100.0,
|
||||
wake_p = WAKE_FRACTION,
|
||||
open = OPEN_SIZE,
|
||||
sb_open = SMALL_BLIND_OPEN_SIZE,
|
||||
three_bet = THREE_BET_SIZE,
|
||||
spread = REALIZATION_SPREAD,
|
||||
oop = REALIZATION_OOP_SINGLE_RAISED,
|
||||
oop3 = REALIZATION_OOP_THREE_BET,
|
||||
)
|
||||
}
|
||||
|
||||
fn meta_line(label: &str, meta: &SpotMeta) -> String {
|
||||
let curve: Vec<String> = meta.checkpoints.iter().map(|(_, e)| e.to_string()).collect();
|
||||
format!(
|
||||
"//! {label:<10} iterations {:>6} stable_since {:>6} exploitability {}\n",
|
||||
meta.iterations,
|
||||
meta.stable_since,
|
||||
curve.join(" / ")
|
||||
)
|
||||
}
|
||||
|
||||
fn meta_source(meta: &SpotMeta) -> String {
|
||||
let points: Vec<String> = meta.checkpoints.iter().map(|(t, e)| format!("({t}, {e})")).collect();
|
||||
format!(
|
||||
"SpotMeta {{ iterations: {}, stable_since: {}, checkpoints: [{}], exploitability_micro_bb: {} }}",
|
||||
meta.iterations,
|
||||
meta.stable_since,
|
||||
points.join(", "),
|
||||
meta.exploitability_micro_bb
|
||||
)
|
||||
}
|
||||
|
||||
fn row(name: &str, values: &[u16]) -> String {
|
||||
format!(" {name}: [\n{} ],\n", wrapped(values, 24).lines().map(|l| format!(" {l}\n")).collect::<String>())
|
||||
}
|
||||
|
||||
fn pair_row(name: &str, values: &[[u16; 2]]) -> String {
|
||||
let flat: Vec<u16> = values.iter().flat_map(|p| p.iter().copied()).collect();
|
||||
let lines: String = flat
|
||||
.chunks(24)
|
||||
.map(|c| {
|
||||
let items: Vec<String> = c.chunks(2).map(|p| format!("[{}, {}]", p[0], p[1])).collect();
|
||||
format!(" {},\n", items.join(", "))
|
||||
})
|
||||
.collect();
|
||||
format!(" {name}: [\n{lines} ],\n")
|
||||
}
|
||||
|
||||
fn push_spot_source(s: &PushFoldSpot) -> String {
|
||||
format!(
|
||||
" PushFoldSpot {{\n seat: Seat::{:?},\n depth_bb: {},\n{}{} meta: {},\n }},\n",
|
||||
s.seat,
|
||||
s.depth_bb,
|
||||
row("push", &s.push),
|
||||
row("call", &s.call),
|
||||
meta_source(&s.meta)
|
||||
)
|
||||
}
|
||||
|
||||
fn open_spot_source(s: &OpenSpot) -> String {
|
||||
format!(
|
||||
" OpenSpot {{\n seat: Seat::{:?},\n depth_bb: {},\n{}{}{}{} meta: {},\n }},\n",
|
||||
s.seat,
|
||||
s.depth_bb,
|
||||
row("open", &s.open),
|
||||
pair_row("defend", &s.defend),
|
||||
pair_row("vs_three_bet", &s.vs_three_bet),
|
||||
row("vs_jam", &s.vs_jam),
|
||||
meta_source(&s.meta)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn render_charts(push: &[PushFoldSpot], open: &[OpenSpot]) -> String {
|
||||
let convergence: String = push
|
||||
.iter()
|
||||
.map(|s| meta_line(&format!("push {} {}", s.seat.label(), s.depth_bb), &s.meta))
|
||||
.chain(open.iter().map(|s| meta_line(&format!("open {} {}", s.seat.label(), s.depth_bb), &s.meta)))
|
||||
.collect();
|
||||
let push_body: String = push.iter().map(push_spot_source).collect();
|
||||
let open_body: String = open.iter().map(open_spot_source).collect();
|
||||
format!(
|
||||
"{header}{convergence}//!\n\
|
||||
//! Equity table: seed {eq_seed}, {eq_samples} samples per class pair. CFR seed {cfr_seed}.\n\n\
|
||||
use crate::cfr::frozen_spot::{{OpenSpot, PushFoldSpot, SpotMeta}};\n\
|
||||
use crate::cfr::seat::Seat;\n\n\
|
||||
pub const EQUITY_SEED: u64 = {eq_seed};\n\
|
||||
pub const EQUITY_SAMPLES: u32 = {eq_samples};\n\
|
||||
pub const CFR_SEED: u64 = {cfr_seed};\n\
|
||||
pub const PUSH_FOLD_DEPTHS: [u8; {nd}] = {push_depths:?};\n\
|
||||
pub const OPEN_DEPTHS: [u8; {nod}] = {open_depths:?};\n\n\
|
||||
pub static PUSH_FOLD: [PushFoldSpot; {np}] = [\n{push_body}];\n\n\
|
||||
pub static OPEN: [OpenSpot; {no}] = [\n{open_body}];\n\n\
|
||||
/// All-in-or-fold has no other choice than push or fold: the same game, the same tables.\n\
|
||||
pub static AOF_PUSH_FOLD: &[PushFoldSpot] = &PUSH_FOLD;\n",
|
||||
header = header(),
|
||||
eq_seed = generated_equity::SEED,
|
||||
nd = PUSH_FOLD_DEPTHS.len(),
|
||||
nod = OPEN_DEPTHS.len(),
|
||||
push_depths = PUSH_FOLD_DEPTHS,
|
||||
open_depths = OPEN_DEPTHS,
|
||||
eq_samples = generated_equity::SAMPLES,
|
||||
cfr_seed = CFR_SEED,
|
||||
np = push.len(),
|
||||
no = open.len(),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//! Rust source text of `generated_equity.rs`.
|
||||
|
||||
use super::equity_matrix::TRIANGLE_LEN;
|
||||
|
||||
/// Lines of numbers, `per_line` per line, indented.
|
||||
pub fn wrapped(numbers: &[u16], per_line: usize) -> String {
|
||||
numbers
|
||||
.chunks(per_line.max(1))
|
||||
.map(|chunk| {
|
||||
let line: Vec<String> = chunk.iter().map(|n| n.to_string()).collect();
|
||||
format!(" {},\n", line.join(", "))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn render_equity(seed: u64, samples: u32, triangle: &[u16]) -> String {
|
||||
format!(
|
||||
"//! GENERATED by `cargo run --release --bin chartgen -- equity > src/cfr/generated_equity.rs`.\n\
|
||||
//! Do not edit.\n\
|
||||
//!\n\
|
||||
//! All-in preflop equity of hand class `i` against class `j` (`i <= j`, row-major over the\n\
|
||||
//! 13 x 13 class grid of `hand_class`) in 1/10 000, from {samples} seeded Monte-Carlo\n\
|
||||
//! board runouts per class pair with exact card removal, evaluated by `hand::showdown::judge`.\n\
|
||||
//! The diagonal is 5000 by symmetry; the lower triangle is `10000 - upper`.\n\
|
||||
//! Standard error per entry: at most {err:.2} % (sqrt(0.25 / samples)).\n\n\
|
||||
pub const SEED: u64 = {seed};\n\
|
||||
pub const SAMPLES: u32 = {samples};\n\n\
|
||||
pub static TRIANGLE: [u16; {len}] = [\n{body}];\n",
|
||||
err = (0.25 / samples.max(1) as f64).sqrt() * 100.0,
|
||||
len = TRIANGLE_LEN,
|
||||
body = wrapped(triangle, 24),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//! What the generator runs: seeds, sample counts, iteration counts and the depth grids.
|
||||
|
||||
use super::seat::Seat;
|
||||
|
||||
/// Seed of the Monte-Carlo equity table.
|
||||
pub const EQUITY_SEED: u64 = 0x504F_4B45_5246_5245;
|
||||
/// Board runouts per class pair (about 14 000 pairs, 0.6 us per evaluation).
|
||||
pub const EQUITY_SAMPLES: u32 = 60_000;
|
||||
/// Seed handed to the CFR fold. Full-width CFR draws no random numbers, so it does not change
|
||||
/// the result; it is recorded so a sampling variant stays reproducible.
|
||||
pub const CFR_SEED: u64 = 0x4346_522B;
|
||||
|
||||
pub const PUSH_FOLD_ITERATIONS: u32 = 8_000;
|
||||
pub const OPEN_ITERATIONS: u32 = 20_000;
|
||||
|
||||
/// Effective stacks in bb.
|
||||
pub const PUSH_FOLD_DEPTHS: [u8; 7] = [5, 8, 10, 12, 15, 20, 25];
|
||||
pub const OPEN_DEPTHS: [u8; 3] = [20, 40, 100];
|
||||
|
||||
/// `(seat, depth)` of every push / fold spot, seat-major.
|
||||
pub fn push_fold_plan() -> Vec<(Seat, u8)> {
|
||||
Seat::ALL.iter().flat_map(|s| PUSH_FOLD_DEPTHS.iter().map(move |d| (*s, *d))).collect()
|
||||
}
|
||||
|
||||
pub fn open_plan() -> Vec<(Seat, u8)> {
|
||||
Seat::ALL.iter().flat_map(|s| OPEN_DEPTHS.iter().map(move |d| (*s, *d))).collect()
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//! The five seats the charts distinguish in 6-max. The big blind is always the modelled
|
||||
//! opponent (caller / defender), so it has no chart of its own as first actor.
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Seat {
|
||||
Early,
|
||||
Middle,
|
||||
Cutoff,
|
||||
Button,
|
||||
SmallBlind,
|
||||
}
|
||||
|
||||
impl Seat {
|
||||
pub const ALL: [Seat; 5] = [Seat::Early, Seat::Middle, Seat::Cutoff, Seat::Button, Seat::SmallBlind];
|
||||
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Seat::Early => "EP",
|
||||
Seat::Middle => "MP",
|
||||
Seat::Cutoff => "CO",
|
||||
Seat::Button => "BTN",
|
||||
Seat::SmallBlind => "SB",
|
||||
}
|
||||
}
|
||||
|
||||
/// Players who still act behind this seat before the big blind: the modelled "field".
|
||||
pub fn players_behind(self) -> usize {
|
||||
match self {
|
||||
Seat::Early => 4,
|
||||
Seat::Middle => 3,
|
||||
Seat::Cutoff => 2,
|
||||
Seat::Button => 1,
|
||||
Seat::SmallBlind => 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// Postflop the big blind acts before every seat except the small blind.
|
||||
pub fn is_in_position_against_big_blind(self) -> bool {
|
||||
self != Seat::SmallBlind
|
||||
}
|
||||
|
||||
pub fn posted_blind(self) -> f64 {
|
||||
if self == Seat::SmallBlind {
|
||||
super::spot_params::SMALL_BLIND
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Money in the pot from players that fold in the modelled line (the small blind when
|
||||
/// somebody else is the first actor).
|
||||
pub fn dead_money(self) -> f64 {
|
||||
if self == Seat::SmallBlind {
|
||||
0.0
|
||||
} else {
|
||||
super::spot_params::SMALL_BLIND
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
//! Run CFR+ for a fixed number of iterations and record how it converged.
|
||||
//!
|
||||
//! Two records, both about the average strategy:
|
||||
//! - `checkpoints`: exploitability (in payoff units) at five iteration counts,
|
||||
//! `N/100, N/20, N/5, N/2, N` (the last one is always `N`);
|
||||
//! - `stable_since`: the argmax chart (`chart_signature`, permille-rounded) is sampled every
|
||||
//! `N/200` iterations (at least every iteration); `stable_since` is the first sampled
|
||||
//! iteration from which every later sample equals the final chart. A chart that only settles
|
||||
//! at the very end reports `N`.
|
||||
|
||||
use super::chart_signature::signature;
|
||||
use super::exploitability::exploitability;
|
||||
use super::iterate::iterate;
|
||||
use super::solver_state::SolverState;
|
||||
use super::strategy::{average_strategy, Strategy};
|
||||
use super::tree::Tree;
|
||||
use crate::rng::Rng;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Solved {
|
||||
pub iterations: u32,
|
||||
pub strategy: Strategy,
|
||||
/// Five `(iteration, exploitability)` pairs.
|
||||
pub checkpoints: Vec<(u32, f64)>,
|
||||
pub stable_since: u32,
|
||||
pub final_exploitability: f64,
|
||||
}
|
||||
|
||||
fn checkpoint_iterations(n: u32) -> [u32; 5] {
|
||||
[n / 100, n / 20, n / 5, n / 2, n].map(|k| k.max(1).min(n.max(1)))
|
||||
}
|
||||
|
||||
pub fn solve(tree: &Tree, iterations: u32, rng: Rng) -> Solved {
|
||||
let stride = (iterations / 200).max(1);
|
||||
let marks = checkpoint_iterations(iterations);
|
||||
let start = (SolverState::fresh(tree), rng, Vec::new(), Vec::new());
|
||||
let (state, _, samples, curve) = (1..=iterations).fold(start, |(state, rng, mut samples, mut curve), t| {
|
||||
let (state, rng) = iterate(tree, state, rng);
|
||||
let sampled = t % stride == 0 || t == iterations;
|
||||
let marked = marks.contains(&t);
|
||||
if sampled || marked {
|
||||
let average = average_strategy(tree, &state);
|
||||
if sampled {
|
||||
samples.push((t, signature(&average)));
|
||||
}
|
||||
if marked {
|
||||
curve.push((t, exploitability(tree, &average)));
|
||||
}
|
||||
}
|
||||
(state, rng, samples, curve)
|
||||
});
|
||||
let strategy = average_strategy(tree, &state);
|
||||
let final_exploitability = exploitability(tree, &strategy);
|
||||
let checkpoints: Vec<(u32, f64)> = marks
|
||||
.iter()
|
||||
.map(|m| curve.iter().find(|(t, _)| t == m).copied().unwrap_or((*m, final_exploitability)))
|
||||
.collect();
|
||||
let final_chart = samples.last().map(|(_, s): &(u32, Vec<u8>)| s.clone());
|
||||
let stable_since = match final_chart {
|
||||
Some(chart) => samples
|
||||
.iter()
|
||||
.rev()
|
||||
.take_while(|(_, s)| *s == chart)
|
||||
.last()
|
||||
.map_or(iterations, |(t, _)| *t),
|
||||
None => iterations,
|
||||
};
|
||||
Solved { iterations, strategy, checkpoints, stable_since, final_exploitability }
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//! Everything CFR+ remembers between iterations, as one value.
|
||||
|
||||
use super::tree::{Node, Tree};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct SolverState {
|
||||
iteration: u32,
|
||||
/// Per node `[class * actions + action]`; empty for non-decision nodes.
|
||||
regret: Vec<Vec<f64>>,
|
||||
strategy_sum: Vec<Vec<f64>>,
|
||||
}
|
||||
|
||||
impl SolverState {
|
||||
pub fn fresh(tree: &Tree) -> SolverState {
|
||||
let zeros: Vec<Vec<f64>> = tree
|
||||
.nodes
|
||||
.iter()
|
||||
.map(|n| match n {
|
||||
Node::Decision { children, .. } => vec![0.0; tree.classes * children.len()],
|
||||
_ => Vec::new(),
|
||||
})
|
||||
.collect();
|
||||
SolverState { iteration: 0, regret: zeros.clone(), strategy_sum: zeros }
|
||||
}
|
||||
|
||||
pub fn iteration(&self) -> u32 {
|
||||
self.iteration
|
||||
}
|
||||
|
||||
pub fn regret(&self, node: usize) -> &[f64] {
|
||||
self.regret.get(node).map_or(&[], |r| r.as_slice())
|
||||
}
|
||||
|
||||
pub fn strategy_sum(&self, node: usize) -> &[f64] {
|
||||
self.strategy_sum.get(node).map_or(&[], |r| r.as_slice())
|
||||
}
|
||||
|
||||
pub(crate) fn into_parts(self) -> (u32, Vec<Vec<f64>>, Vec<Vec<f64>>) {
|
||||
(self.iteration, self.regret, self.strategy_sum)
|
||||
}
|
||||
|
||||
pub(crate) fn from_parts(iteration: u32, regret: Vec<Vec<f64>>, strategy_sum: Vec<Vec<f64>>) -> SolverState {
|
||||
SolverState { iteration, regret, strategy_sum }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//! Every number of the preflop abstraction in one place (bb = big blind, blinds 0.5 / 1).
|
||||
//!
|
||||
//! These are modelling assumptions, not measurements; changing any of them means regenerating
|
||||
//! the charts (`chartgen charts`).
|
||||
|
||||
pub const SMALL_BLIND: f64 = 0.5;
|
||||
pub const BIG_BLIND: f64 = 1.0;
|
||||
|
||||
/// Open-raise size from EP / MP / CO / BTN (raise-to, in bb).
|
||||
pub const OPEN_SIZE: f64 = 2.5;
|
||||
/// Open-raise size from the small blind (out of position against the big blind).
|
||||
pub const SMALL_BLIND_OPEN_SIZE: f64 = 3.0;
|
||||
/// The big blind's 3-bet (raise-to, in bb) against every open.
|
||||
pub const THREE_BET_SIZE: f64 = 9.0;
|
||||
|
||||
/// Out-of-position realisation in single-raised pots (three streets left): the out-of-position
|
||||
/// player's stretched equity (see `REALIZATION_SPREAD`) counts only 0.85 against the in-position
|
||||
/// player's 1.0, and the pot is split in proportion -- `share_ip = e_ip / (e_ip + R * e_oop)` --
|
||||
/// so the game stays zero-sum (a plain `pot x equity x R` for one side only is not).
|
||||
pub const REALIZATION_OOP_SINGLE_RAISED: f64 = 0.85;
|
||||
/// 3-bet pots (lower stack-to-pot ratio, fewer decisions left): 0.90.
|
||||
pub const REALIZATION_OOP_THREE_BET: f64 = 0.90;
|
||||
|
||||
/// Hand-strength spread of the realised pot share: the better hand realises more than its raw
|
||||
/// equity, the worse hand less (the weaker hand folds out on later streets). Equity `e` becomes
|
||||
/// `0.5 + SPREAD * (e - 0.5)`, clamped to `[0, 1]`, before the position split.
|
||||
pub const REALIZATION_SPREAD: f64 = 1.3;
|
||||
|
||||
/// Multiway part. Each player behind the first actor (but not the big blind) holds a hand
|
||||
/// worth continuing with probability `WAKE_FRACTION`, modelled as the top 15 % of combos by
|
||||
/// all-in equity against a random hand (roughly 66+, ATs+, KQs, AJo+). If at least one does --
|
||||
/// probability `1 - (1 - WAKE_FRACTION)^players_behind` -- the first actor is called by a hand of
|
||||
/// that range instead of facing the big blind, and the big blind takes no decision. Players behind
|
||||
/// are independent and their cards do not block anything.
|
||||
pub const WAKE_FRACTION: f64 = 0.15;
|
||||
|
||||
/// Probability that every player behind folds.
|
||||
pub fn field_folds(players_behind: usize) -> f64 {
|
||||
(0..players_behind).fold(1.0, |p, _| p * (1.0 - WAKE_FRACTION))
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//! Solve one spot end to end and freeze it: build the tree, run CFR+, round to permille, measure
|
||||
//! the exploitability of the rounded strategy that is actually shipped.
|
||||
|
||||
use super::environment::Environment;
|
||||
use super::exploitability::exploitability;
|
||||
use super::frozen_spot::{OpenSpot, PushFoldSpot, SpotMeta};
|
||||
use super::frozen_strategy::{binary_row, open_strategy, push_fold_strategy, ternary_row};
|
||||
use super::open_game::open_tree;
|
||||
use super::push_fold_game::push_fold_tree;
|
||||
use super::run_plan::{CFR_SEED, OPEN_ITERATIONS, PUSH_FOLD_ITERATIONS};
|
||||
use super::seat::Seat;
|
||||
use super::solve::{solve, Solved};
|
||||
use crate::fault::Fault;
|
||||
use crate::rng::Rng;
|
||||
|
||||
fn micro(x: f64) -> u32 {
|
||||
(x.max(0.0) * 1e6).round().min(u32::MAX as f64) as u32
|
||||
}
|
||||
|
||||
fn meta(solved: &Solved, frozen_exploitability: f64) -> SpotMeta {
|
||||
let mut checkpoints = [(0u32, 0u32); 5];
|
||||
for (slot, (t, e)) in checkpoints.iter_mut().zip(&solved.checkpoints) {
|
||||
*slot = (*t, micro(*e));
|
||||
}
|
||||
checkpoints[4].1 = micro(frozen_exploitability);
|
||||
SpotMeta {
|
||||
iterations: solved.iterations,
|
||||
stable_since: solved.stable_since,
|
||||
checkpoints,
|
||||
exploitability_micro_bb: micro(frozen_exploitability),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn solve_push_fold_spot(env: &Environment, seat: Seat, depth_bb: u8) -> Result<PushFoldSpot, Fault> {
|
||||
solve_push_fold_spot_for(env, seat, depth_bb, PUSH_FOLD_ITERATIONS)
|
||||
}
|
||||
|
||||
pub fn solve_push_fold_spot_for(
|
||||
env: &Environment,
|
||||
seat: Seat,
|
||||
depth_bb: u8,
|
||||
iterations: u32,
|
||||
) -> Result<PushFoldSpot, Fault> {
|
||||
let tree = push_fold_tree(env, seat, depth_bb as f64)?;
|
||||
let solved = solve(&tree, iterations, Rng::seeded(CFR_SEED));
|
||||
let mut spot = PushFoldSpot {
|
||||
seat,
|
||||
depth_bb,
|
||||
push: binary_row(&tree, &solved.strategy, "push")?,
|
||||
call: binary_row(&tree, &solved.strategy, "call")?,
|
||||
meta: meta(&solved, 0.0),
|
||||
};
|
||||
let frozen = exploitability(&tree, &push_fold_strategy(&tree, &spot)?);
|
||||
spot.meta = meta(&solved, frozen);
|
||||
Ok(spot)
|
||||
}
|
||||
|
||||
pub fn solve_open_spot(env: &Environment, seat: Seat, depth_bb: u8) -> Result<OpenSpot, Fault> {
|
||||
solve_open_spot_for(env, seat, depth_bb, OPEN_ITERATIONS)
|
||||
}
|
||||
|
||||
pub fn solve_open_spot_for(
|
||||
env: &Environment,
|
||||
seat: Seat,
|
||||
depth_bb: u8,
|
||||
iterations: u32,
|
||||
) -> Result<OpenSpot, Fault> {
|
||||
let tree = open_tree(env, seat, depth_bb as f64)?;
|
||||
let solved = solve(&tree, iterations, Rng::seeded(CFR_SEED));
|
||||
let mut spot = OpenSpot {
|
||||
seat,
|
||||
depth_bb,
|
||||
open: binary_row(&tree, &solved.strategy, "open")?,
|
||||
defend: ternary_row(&tree, &solved.strategy, "defend")?,
|
||||
vs_three_bet: ternary_row(&tree, &solved.strategy, "vs_three_bet")?,
|
||||
vs_jam: binary_row(&tree, &solved.strategy, "vs_jam")?,
|
||||
meta: meta(&solved, 0.0),
|
||||
};
|
||||
let frozen = exploitability(&tree, &open_strategy(&tree, &spot)?);
|
||||
spot.meta = meta(&solved, frozen);
|
||||
Ok(spot)
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
//! A behaviour strategy: for every decision node and hand class a probability per action.
|
||||
|
||||
use super::regret_matching::matched;
|
||||
use super::solver_state::SolverState;
|
||||
use super::tree::{Node, Tree};
|
||||
use crate::fault::Fault;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Strategy {
|
||||
classes: usize,
|
||||
actions: Vec<usize>,
|
||||
probs: Vec<Vec<f64>>,
|
||||
}
|
||||
|
||||
fn actions_of(tree: &Tree) -> Vec<usize> {
|
||||
tree.nodes
|
||||
.iter()
|
||||
.map(|n| match n {
|
||||
Node::Decision { children, .. } => children.len(),
|
||||
_ => 0,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
impl Strategy {
|
||||
/// Every action equally likely everywhere.
|
||||
pub fn uniform(tree: &Tree) -> Strategy {
|
||||
let actions = actions_of(tree);
|
||||
let probs = actions
|
||||
.iter()
|
||||
.map(|a| if *a == 0 { Vec::new() } else { vec![1.0 / *a as f64; tree.classes * *a] })
|
||||
.collect();
|
||||
Strategy { classes: tree.classes, actions, probs }
|
||||
}
|
||||
|
||||
/// The same action for each class at every decision node: `choose(node name, class)`.
|
||||
pub fn pure(tree: &Tree, choose: impl Fn(&str, usize) -> usize) -> Strategy {
|
||||
let base = Strategy::uniform(tree);
|
||||
tree.nodes.iter().enumerate().fold(base, |s, (index, node)| match node {
|
||||
Node::Decision { name, .. } => s.replaced(index, |class| pure_row(s.actions[index], choose(name, class))),
|
||||
_ => s,
|
||||
})
|
||||
}
|
||||
|
||||
/// Copy with the named node replaced by a pure choice per class (no-op if the name is unknown).
|
||||
pub fn with_pure(&self, tree: &Tree, name: &str, choose: impl Fn(usize) -> usize) -> Strategy {
|
||||
match tree.find(name) {
|
||||
Some(index) => self.replaced(index, |class| pure_row(self.actions[index], choose(class))),
|
||||
None => self.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy with the named node replaced by explicit rows (`row(class)` = one probability per action).
|
||||
pub fn with_rows(
|
||||
&self,
|
||||
tree: &Tree,
|
||||
name: &str,
|
||||
row: impl Fn(usize) -> Vec<f64>,
|
||||
) -> Result<Strategy, Fault> {
|
||||
let index = tree
|
||||
.find(name)
|
||||
.ok_or_else(|| Fault::Missing(format!("decision node {name}")))?;
|
||||
let width = self.actions.get(index).copied().unwrap_or(0);
|
||||
let rows: Vec<Vec<f64>> = (0..self.classes).map(&row).collect();
|
||||
if rows.iter().any(|r| r.len() != width) {
|
||||
return Err(Fault::Invalid { field: name.into(), detail: "wrong number of actions".into() });
|
||||
}
|
||||
Ok(self.replaced(index, |class| rows[class].clone()))
|
||||
}
|
||||
|
||||
fn replaced(&self, index: usize, row: impl Fn(usize) -> Vec<f64>) -> Strategy {
|
||||
let mut probs = self.probs.clone();
|
||||
probs[index] = (0..self.classes).flat_map(row).collect();
|
||||
Strategy { classes: self.classes, actions: self.actions.clone(), probs }
|
||||
}
|
||||
|
||||
pub fn classes(&self) -> usize {
|
||||
self.classes
|
||||
}
|
||||
|
||||
pub fn node_count(&self) -> usize {
|
||||
self.actions.len()
|
||||
}
|
||||
|
||||
pub fn action_count(&self, node: usize) -> usize {
|
||||
self.actions.get(node).copied().unwrap_or(0)
|
||||
}
|
||||
|
||||
/// Probabilities of one class at one node (empty when not a decision node).
|
||||
pub fn row(&self, node: usize, class: usize) -> &[f64] {
|
||||
let width = self.action_count(node);
|
||||
self.probs
|
||||
.get(node)
|
||||
.and_then(|p| p.get(class * width..(class + 1) * width))
|
||||
.unwrap_or(&[])
|
||||
}
|
||||
|
||||
pub fn probability(&self, node: usize, class: usize, action: usize) -> f64 {
|
||||
self.row(node, class).get(action).copied().unwrap_or(0.0)
|
||||
}
|
||||
}
|
||||
|
||||
fn pure_row(width: usize, action: usize) -> Vec<f64> {
|
||||
(0..width).map(|a| if a == action.min(width.saturating_sub(1)) { 1.0 } else { 0.0 }).collect()
|
||||
}
|
||||
|
||||
/// Current strategy by regret matching (the last iterate, not the average).
|
||||
pub fn current_strategy(tree: &Tree, state: &SolverState) -> Strategy {
|
||||
let actions = actions_of(tree);
|
||||
let probs = actions
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(node, a)| match state.regret(node) {
|
||||
regrets if *a > 0 => matched(regrets, *a),
|
||||
_ => Vec::new(),
|
||||
})
|
||||
.collect();
|
||||
Strategy { classes: tree.classes, actions, probs }
|
||||
}
|
||||
|
||||
/// The average strategy (weighted by iteration and own reach). A class that never reached a node
|
||||
/// falls back to the current regret-matching strategy there.
|
||||
pub fn average_strategy(tree: &Tree, state: &SolverState) -> Strategy {
|
||||
let current = current_strategy(tree, state);
|
||||
let probs = current
|
||||
.actions
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(node, a)| {
|
||||
let sums = state.strategy_sum(node);
|
||||
if *a == 0 {
|
||||
return Vec::new();
|
||||
}
|
||||
(0..tree.classes)
|
||||
.flat_map(|class| {
|
||||
let row = sums.get(class * a..(class + 1) * a).unwrap_or(&[]);
|
||||
let total: f64 = row.iter().sum();
|
||||
if total > 0.0 {
|
||||
row.iter().map(|x| x / total).collect::<Vec<f64>>()
|
||||
} else {
|
||||
current.row(node, class).to_vec()
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.collect();
|
||||
Strategy { classes: tree.classes, actions: current.actions, probs }
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//! Counterfactual value of a terminal node for one traverser, given the opponent's reach.
|
||||
//!
|
||||
//! For player 0: `value[i] = sum_j chance[i][j] * opp[j] * payoff(i, j)`.
|
||||
//! For player 1: `value[j] = -sum_i chance[i][j] * opp[i] * payoff(i, j)` (zero-sum).
|
||||
//! The traverser's own reach is not part of the value.
|
||||
|
||||
use super::tree::Payoff;
|
||||
|
||||
pub fn terminal_value(payoff: &Payoff, chance: &[f64], classes: usize, player: usize, opp: &[f64]) -> Vec<f64> {
|
||||
let n = classes;
|
||||
let mut out = vec![0.0; n];
|
||||
for i in 0..n {
|
||||
let row = &chance[i * n..(i + 1) * n];
|
||||
let pair_row = match payoff {
|
||||
Payoff::Pair(m) => m.get(i * n..(i + 1) * n),
|
||||
_ => None,
|
||||
};
|
||||
let scale = match payoff {
|
||||
Payoff::Flat(c) => *c,
|
||||
Payoff::Own(v) => v.get(i).copied().unwrap_or(0.0),
|
||||
Payoff::Pair(_) => 1.0,
|
||||
};
|
||||
if player == 0 {
|
||||
let mut acc = 0.0;
|
||||
match pair_row {
|
||||
Some(m) => {
|
||||
for j in 0..n {
|
||||
acc += row[j] * opp[j] * m[j];
|
||||
}
|
||||
}
|
||||
None if matches!(payoff, Payoff::Pair(_)) => {}
|
||||
None => {
|
||||
for j in 0..n {
|
||||
acc += row[j] * opp[j];
|
||||
}
|
||||
acc *= scale;
|
||||
}
|
||||
}
|
||||
out[i] = acc;
|
||||
} else {
|
||||
let weight = opp[i];
|
||||
if weight == 0.0 {
|
||||
continue;
|
||||
}
|
||||
match pair_row {
|
||||
Some(m) => {
|
||||
for j in 0..n {
|
||||
out[j] -= row[j] * weight * m[j];
|
||||
}
|
||||
}
|
||||
None if matches!(payoff, Payoff::Pair(_)) => {}
|
||||
None => {
|
||||
for j in 0..n {
|
||||
out[j] -= row[j] * weight * scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//! A two-player zero-sum game as data: a public tree whose decision nodes are played per hand
|
||||
//! class (the information set is node x class), plus a table of chance weights.
|
||||
//!
|
||||
//! - Player 0 holds class `i`, player 1 holds class `j`; `chance[i * classes + j]` is the
|
||||
//! probability of that deal (card removal is already inside).
|
||||
//! - Every payoff is the result for player 0; player 1 receives the negative (zero-sum).
|
||||
//! - A node is a decision of one player (children = actions), a chance split with fixed
|
||||
//! probabilities (e.g. "the field behind folds"), or a terminal payoff.
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Payoff {
|
||||
/// The same result for every deal.
|
||||
Flat(f64),
|
||||
/// Depends on player 0's class only (`classes` entries).
|
||||
Own(Vec<f64>),
|
||||
/// Depends on both classes (`classes * classes` entries, `[i * classes + j]`).
|
||||
Pair(Vec<f64>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Node {
|
||||
Decision { player: usize, name: &'static str, children: Vec<usize> },
|
||||
/// Branches `(probability, child)`; probabilities should sum to 1.
|
||||
Chance(Vec<(f64, usize)>),
|
||||
Terminal(Payoff),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Tree {
|
||||
pub classes: usize,
|
||||
pub chance: Vec<f64>,
|
||||
pub nodes: Vec<Node>,
|
||||
pub root: usize,
|
||||
}
|
||||
|
||||
impl Tree {
|
||||
/// Index of the decision node with this name.
|
||||
pub fn find(&self, name: &str) -> Option<usize> {
|
||||
self.nodes
|
||||
.iter()
|
||||
.position(|n| matches!(n, Node::Decision { name: found, .. } if *found == name))
|
||||
}
|
||||
|
||||
/// Number of actions of a decision node; `None` for other nodes and unknown indices.
|
||||
pub fn action_count(&self, node: usize) -> Option<usize> {
|
||||
match self.nodes.get(node) {
|
||||
Some(Node::Decision { children, .. }) => Some(children.len()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The tree can be traversed: a root, a square chance table, no zero-class game.
|
||||
pub fn is_playable(&self) -> bool {
|
||||
self.classes > 0
|
||||
&& self.chance.len() == self.classes * self.classes
|
||||
&& self.root < self.nodes.len()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
//! Evaluation traversals without learning: expected value of a fixed strategy, best response,
|
||||
//! and the per-action values at every information set (for the deviation report).
|
||||
//!
|
||||
//! Values are counterfactual in the same sense as in `iterate`: for the traverser they are summed
|
||||
//! over the opponent's holdings weighted by chance and the opponent's reach, and exclude the
|
||||
//! traverser's own reach.
|
||||
|
||||
use super::strategy::Strategy;
|
||||
use super::terminal_value::terminal_value;
|
||||
use super::tree::{Node, Tree};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Responder {
|
||||
/// The traverser plays the given strategy.
|
||||
Follow,
|
||||
/// The traverser picks, per hand class, the best action everywhere.
|
||||
Best,
|
||||
}
|
||||
|
||||
/// What a traverser's decision node looked like during the walk.
|
||||
pub(crate) struct Visit<'a> {
|
||||
pub node: usize,
|
||||
pub name: &'static str,
|
||||
pub own: &'a [f64],
|
||||
pub opp: &'a [f64],
|
||||
/// `[action][class]`
|
||||
pub action_values: &'a [Vec<f64>],
|
||||
}
|
||||
|
||||
struct Walker<'a> {
|
||||
tree: &'a Tree,
|
||||
strategy: &'a Strategy,
|
||||
responder: Responder,
|
||||
player: usize,
|
||||
}
|
||||
|
||||
impl Walker<'_> {
|
||||
fn walk<F: FnMut(&Visit)>(&self, node: usize, own: &[f64], opp: &[f64], visit: &mut F) -> Vec<f64> {
|
||||
let n = self.tree.classes;
|
||||
match self.tree.nodes.get(node) {
|
||||
None => vec![0.0; n],
|
||||
Some(Node::Terminal(payoff)) => terminal_value(payoff, &self.tree.chance, n, self.player, opp),
|
||||
Some(Node::Chance(branches)) => {
|
||||
let mut total = vec![0.0; n];
|
||||
for (p, child) in branches {
|
||||
let scaled: Vec<f64> = opp.iter().map(|x| x * p).collect();
|
||||
let value = self.walk(*child, own, &scaled, visit);
|
||||
total.iter_mut().zip(&value).for_each(|(t, v)| *t += v);
|
||||
}
|
||||
total
|
||||
}
|
||||
Some(Node::Decision { player: owner, name, children }) => {
|
||||
if *owner == self.player {
|
||||
self.own_decision(node, name, children, own, opp, visit)
|
||||
} else {
|
||||
let mut total = vec![0.0; n];
|
||||
for (a, child) in children.iter().enumerate() {
|
||||
let reach: Vec<f64> =
|
||||
(0..n).map(|j| opp[j] * self.strategy.probability(node, j, a)).collect();
|
||||
let value = self.walk(*child, own, &reach, visit);
|
||||
total.iter_mut().zip(&value).for_each(|(t, v)| *t += v);
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn own_decision<F: FnMut(&Visit)>(
|
||||
&self,
|
||||
node: usize,
|
||||
name: &'static str,
|
||||
children: &[usize],
|
||||
own: &[f64],
|
||||
opp: &[f64],
|
||||
visit: &mut F,
|
||||
) -> Vec<f64> {
|
||||
let n = self.tree.classes;
|
||||
let sigma = |class: usize, a: usize| self.strategy.probability(node, class, a);
|
||||
let values: Vec<Vec<f64>> = children
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(a, child)| {
|
||||
let reach: Vec<f64> = match self.responder {
|
||||
Responder::Follow => (0..n).map(|i| own[i] * sigma(i, a)).collect(),
|
||||
Responder::Best => own.to_vec(),
|
||||
};
|
||||
self.walk(*child, &reach, opp, visit)
|
||||
})
|
||||
.collect();
|
||||
visit(&Visit { node, name, own, opp, action_values: &values });
|
||||
(0..n)
|
||||
.map(|i| match self.responder {
|
||||
Responder::Follow => (0..children.len()).map(|a| sigma(i, a) * values[a][i]).sum(),
|
||||
Responder::Best => values.iter().map(|v| v[i]).fold(f64::NEG_INFINITY, f64::max),
|
||||
})
|
||||
.map(|v: f64| if v.is_finite() { v } else { 0.0 })
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Value vector of `player` from the root with full reach; `visit` sees every decision node of
|
||||
/// that player.
|
||||
pub(crate) fn root_values<F: FnMut(&Visit)>(
|
||||
tree: &Tree,
|
||||
strategy: &Strategy,
|
||||
responder: Responder,
|
||||
player: usize,
|
||||
visit: &mut F,
|
||||
) -> Vec<f64> {
|
||||
if !tree.is_playable() {
|
||||
return vec![0.0; tree.classes];
|
||||
}
|
||||
let ones = vec![1.0; tree.classes];
|
||||
Walker { tree, strategy, responder, player }.walk(tree.root, &ones, &ones, visit)
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//! The hands that "wake up" behind the first actor: the strongest `fraction` of all combos,
|
||||
//! ranked by all-in equity against a random hand (`Environment::order`). The class on the
|
||||
//! border is included fractionally, so the covered combos equal the requested share exactly.
|
||||
|
||||
use super::environment::Environment;
|
||||
use super::hand_class::CLASS_COUNT;
|
||||
|
||||
/// Membership in `[0, 1]` per class.
|
||||
pub fn top_membership(env: &Environment, fraction: f64) -> Vec<f64> {
|
||||
let total: f64 = env.order.iter().map(|c| env.chance.combos(*c) as f64).sum();
|
||||
let budget = fraction.clamp(0.0, 1.0) * total;
|
||||
let (_, membership) = env.order.iter().fold((budget, vec![0.0; CLASS_COUNT]), |(left, mut m), c| {
|
||||
let combos = env.chance.combos(*c) as f64;
|
||||
let take = if combos > 0.0 { (left / combos).clamp(0.0, 1.0) } else { 0.0 };
|
||||
m[*c] = take;
|
||||
(left - take * combos, m)
|
||||
});
|
||||
membership
|
||||
}
|
||||
|
||||
/// Equity of each class against that range (card removal exact). A class that blocks the whole
|
||||
/// range keeps 0.5.
|
||||
pub fn equity_against(env: &Environment, membership: &[f64]) -> Vec<f64> {
|
||||
(0..CLASS_COUNT)
|
||||
.map(|i| {
|
||||
let (num, den) = (0..CLASS_COUNT).fold((0.0, 0.0), |(n, d), j| {
|
||||
let w = env.chance.probability(i, j) * membership.get(j).copied().unwrap_or(0.0);
|
||||
(n + w * env.equity.get(i, j), d + w)
|
||||
});
|
||||
if den > 0.0 {
|
||||
num / den
|
||||
} else {
|
||||
0.5
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,180 @@
|
||||
//! Pure lookup over the frozen CFR charts (`generated_charts`). No allocation, no I/O.
|
||||
//!
|
||||
//! Depth rule: the frequencies of the two grid depths around `depth_bb` are interpolated
|
||||
//! linearly in the stack size; below the shallowest or above the deepest grid depth the nearest
|
||||
//! table is used unchanged (clamping -- see `push_depth_range` / `open_depth_range` for the
|
||||
//! covered range). Non-finite or non-positive depths, unknown classes and variants without a
|
||||
//! chart give `None`.
|
||||
//!
|
||||
//! Every function answers for the *seat that acts* in that situation:
|
||||
//! - `push_frequency`: the first actor jams (raise = jam) or folds.
|
||||
//! - `call_vs_push`: the big blind facing that jam (`seat` = the pusher).
|
||||
//! - `open_frequency`: the first actor raises or folds.
|
||||
//! - `vs_open`: the big blind facing the open of `seat`: fold / call / 3-bet.
|
||||
//! - `vs_three_bet`: the opener (`seat`) facing the big blind's 3-bet: fold / call / jam.
|
||||
//! - `vs_jam`: the big blind facing the opener's jam: fold / call.
|
||||
//!
|
||||
//! Class ids are those of `crate::cfr::hand_class` (`class_of(card, card)`).
|
||||
|
||||
use super::generated_charts::{AOF_PUSH_FOLD, OPEN, OPEN_DEPTHS, PUSH_FOLD, PUSH_FOLD_DEPTHS};
|
||||
use super::position::Position;
|
||||
use crate::cfr::frozen_spot::{OpenSpot, PushFoldSpot};
|
||||
use crate::cfr::hand_class::{ClassId, CLASS_COUNT};
|
||||
use crate::cfr::seat::Seat;
|
||||
use crate::variant::Variant;
|
||||
|
||||
/// Action probabilities; `raise` is the aggressive action of the node (raise / 3-bet / jam).
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct Frequencies {
|
||||
pub fold: f64,
|
||||
pub call: f64,
|
||||
pub raise: f64,
|
||||
}
|
||||
|
||||
impl Frequencies {
|
||||
fn aggressive(permille: u16) -> Frequencies {
|
||||
let p = permille as f64 / 1000.0;
|
||||
Frequencies { fold: 1.0 - p, call: 0.0, raise: p }
|
||||
}
|
||||
|
||||
fn passive(permille: u16) -> Frequencies {
|
||||
let p = permille as f64 / 1000.0;
|
||||
Frequencies { fold: 1.0 - p, call: p, raise: 0.0 }
|
||||
}
|
||||
|
||||
fn split(call_raise: [u16; 2]) -> Frequencies {
|
||||
let (call, raise) = (call_raise[0] as f64 / 1000.0, call_raise[1] as f64 / 1000.0);
|
||||
Frequencies { fold: (1.0 - call - raise).max(0.0), call, raise }
|
||||
}
|
||||
|
||||
fn blend(self, other: Frequencies, t: f64) -> Frequencies {
|
||||
let mix = |a: f64, b: f64| a * (1.0 - t) + b * t;
|
||||
Frequencies {
|
||||
fold: mix(self.fold, other.fold),
|
||||
call: mix(self.call, other.call),
|
||||
raise: mix(self.raise, other.raise),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Chart seat for a table position; `None` for the big blind (it never acts first in these
|
||||
/// charts). An unknown position uses the tightest (early) row, like the heuristic charts do.
|
||||
pub fn seat_of(position: Position) -> Option<Seat> {
|
||||
match position {
|
||||
Position::Middle => Some(Seat::Middle),
|
||||
Position::Cutoff => Some(Seat::Cutoff),
|
||||
Position::Button => Some(Seat::Button),
|
||||
Position::SmallBlind | Position::HeadsUpButton => Some(Seat::SmallBlind),
|
||||
Position::BigBlind => None,
|
||||
_ => Some(Seat::Early),
|
||||
}
|
||||
}
|
||||
|
||||
/// Covered stack range in bb for the push / fold charts.
|
||||
pub fn push_depth_range() -> (f64, f64) {
|
||||
range(&PUSH_FOLD_DEPTHS)
|
||||
}
|
||||
|
||||
/// Covered stack range in bb for the open / call / 3-bet charts.
|
||||
pub fn open_depth_range() -> (f64, f64) {
|
||||
range(&OPEN_DEPTHS)
|
||||
}
|
||||
|
||||
fn range(depths: &[u8]) -> (f64, f64) {
|
||||
let lo = depths.iter().copied().min().unwrap_or(0) as f64;
|
||||
let hi = depths.iter().copied().max().unwrap_or(0) as f64;
|
||||
(lo, hi)
|
||||
}
|
||||
|
||||
trait Placed {
|
||||
fn seat(&self) -> Seat;
|
||||
fn depth(&self) -> u8;
|
||||
}
|
||||
|
||||
impl Placed for PushFoldSpot {
|
||||
fn seat(&self) -> Seat {
|
||||
self.seat
|
||||
}
|
||||
fn depth(&self) -> u8 {
|
||||
self.depth_bb
|
||||
}
|
||||
}
|
||||
|
||||
impl Placed for OpenSpot {
|
||||
fn seat(&self) -> Seat {
|
||||
self.seat
|
||||
}
|
||||
fn depth(&self) -> u8 {
|
||||
self.depth_bb
|
||||
}
|
||||
}
|
||||
|
||||
/// The two grid spots around `depth` (both the same one when clamped or on the grid) and the
|
||||
/// weight of the deeper one.
|
||||
fn bracket<T: Placed>(spots: &[T], seat: Seat, depth: f64) -> Option<(&T, &T, f64)> {
|
||||
let mine = || spots.iter().filter(|s| s.seat() == seat);
|
||||
let below = mine().filter(|s| s.depth() as f64 <= depth).max_by_key(|s| s.depth());
|
||||
let above = mine().filter(|s| s.depth() as f64 >= depth).min_by_key(|s| s.depth());
|
||||
match (below, above) {
|
||||
(Some(lo), Some(hi)) if lo.depth() != hi.depth() => {
|
||||
let t = (depth - lo.depth() as f64) / (hi.depth() as f64 - lo.depth() as f64);
|
||||
Some((lo, hi, t))
|
||||
}
|
||||
(Some(lo), Some(_)) => Some((lo, lo, 0.0)),
|
||||
(Some(lo), None) => Some((lo, lo, 0.0)),
|
||||
(None, Some(hi)) => Some((hi, hi, 0.0)),
|
||||
(None, None) => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn lookup<T: Placed>(
|
||||
spots: &[T],
|
||||
seat: Seat,
|
||||
depth_bb: f64,
|
||||
class: ClassId,
|
||||
read: impl Fn(&T, ClassId) -> Frequencies,
|
||||
) -> Option<Frequencies> {
|
||||
if !depth_bb.is_finite() || depth_bb <= 0.0 || class >= CLASS_COUNT {
|
||||
return None;
|
||||
}
|
||||
let (lo, hi, t) = bracket(spots, seat, depth_bb)?;
|
||||
Some(read(lo, class).blend(read(hi, class), t))
|
||||
}
|
||||
|
||||
fn push_chart(variant: Variant) -> Option<&'static [PushFoldSpot]> {
|
||||
match variant {
|
||||
Variant::Nlhe => Some(&PUSH_FOLD),
|
||||
Variant::Aof => Some(AOF_PUSH_FOLD),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The first actor's jam frequency (`raise`) or fold.
|
||||
pub fn push_frequency(variant: Variant, seat: Seat, depth_bb: f64, class: ClassId) -> Option<Frequencies> {
|
||||
lookup(push_chart(variant)?, seat, depth_bb, class, |s, c| Frequencies::aggressive(s.push[c]))
|
||||
}
|
||||
|
||||
/// The big blind's response to a jam from `pusher`.
|
||||
pub fn call_vs_push(variant: Variant, pusher: Seat, depth_bb: f64, class: ClassId) -> Option<Frequencies> {
|
||||
lookup(push_chart(variant)?, pusher, depth_bb, class, |s, c| Frequencies::passive(s.call[c]))
|
||||
}
|
||||
|
||||
/// The first actor's raise frequency or fold (NLHE only).
|
||||
pub fn open_frequency(seat: Seat, depth_bb: f64, class: ClassId) -> Option<Frequencies> {
|
||||
lookup(&OPEN, seat, depth_bb, class, |s, c| Frequencies::aggressive(s.open[c]))
|
||||
}
|
||||
|
||||
/// The big blind facing the open of `opener`: fold / call / 3-bet.
|
||||
pub fn vs_open(opener: Seat, depth_bb: f64, class: ClassId) -> Option<Frequencies> {
|
||||
lookup(&OPEN, opener, depth_bb, class, |s, c| Frequencies::split(s.defend[c]))
|
||||
}
|
||||
|
||||
/// The opener facing the big blind's 3-bet: fold / call / jam.
|
||||
pub fn vs_three_bet(opener: Seat, depth_bb: f64, class: ClassId) -> Option<Frequencies> {
|
||||
lookup(&OPEN, opener, depth_bb, class, |s, c| Frequencies::split(s.vs_three_bet[c]))
|
||||
}
|
||||
|
||||
/// The big blind facing the opener's jam over the 3-bet: fold / call.
|
||||
pub fn vs_jam(opener: Seat, depth_bb: f64, class: ClassId) -> Option<Frequencies> {
|
||||
lookup(&OPEN, opener, depth_bb, class, |s, c| Frequencies::passive(s.vs_jam[c]))
|
||||
}
|
||||
@@ -22,3 +22,5 @@ pub mod push_chart;
|
||||
pub mod reason;
|
||||
pub mod situation;
|
||||
pub mod width_factor;
|
||||
pub mod generated_charts;
|
||||
pub mod generated_lookup;
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
//! Class-vs-class all-in equity: seeded Monte Carlo with `hand::showdown`, frozen as integers.
|
||||
//!
|
||||
//! References (same as tests/equity_reference.rs): AA vs KK ~ 81.9 %, AKo vs QQ ~ 43 %,
|
||||
//! AKs vs 22 ~ 50 % (PokerStove / ProPokerTools); AA vs a random hand 85.2 % and 32o 32.3 %
|
||||
//! (the measurement quoted in `preflop/holdem_ranking.rs`).
|
||||
mod cfr_support;
|
||||
|
||||
use cfr_support::id;
|
||||
use pokerfreak::cfr::chance_table::chance_table;
|
||||
use pokerfreak::cfr::equity_matrix::{triangle_pairs, EquityMatrix, TRIANGLE_LEN};
|
||||
use pokerfreak::cfr::equity_pair::pair_equity;
|
||||
use pokerfreak::cfr::frozen_equity::frozen_equity;
|
||||
use pokerfreak::cfr::generated_equity as frozen;
|
||||
use pokerfreak::cfr::hand_class::CLASS_COUNT;
|
||||
use pokerfreak::variant::{rules, DeckRule, Rules, Variant};
|
||||
|
||||
fn nlhe() -> Rules {
|
||||
rules(Variant::Nlhe)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pair_equity_matches_published_numbers() {
|
||||
let aa_kk = pair_equity(&nlhe(), 7, 40_000, id("AA"), id("KK")).expect("equity");
|
||||
assert!((aa_kk as f64 / 1e4 - 0.82).abs() < 0.012, "AA vs KK {aa_kk}");
|
||||
let ako_qq = pair_equity(&nlhe(), 7, 40_000, id("AKo"), id("QQ")).expect("equity");
|
||||
assert!((ako_qq as f64 / 1e4 - 0.43).abs() < 0.015, "AKo vs QQ {ako_qq}");
|
||||
let aks_22 = pair_equity(&nlhe(), 7, 40_000, id("AKs"), id("22")).expect("equity");
|
||||
assert!((aks_22 as f64 / 1e4 - 0.50).abs() < 0.015, "AKs vs 22 {aks_22}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pair_equity_is_deterministic_per_seed_and_close_across_seeds() {
|
||||
let a = pair_equity(&nlhe(), 11, 5_000, id("JTs"), id("A5o")).expect("equity");
|
||||
let b = pair_equity(&nlhe(), 11, 5_000, id("JTs"), id("A5o")).expect("equity");
|
||||
let c = pair_equity(&nlhe(), 12, 5_000, id("JTs"), id("A5o")).expect("equity");
|
||||
assert_eq!(a, b);
|
||||
assert!(a.abs_diff(c) < 400, "different seeds stay statistically close");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pair_equity_rejects_nonsense_without_panicking() {
|
||||
assert!(pair_equity(&nlhe(), 1, 0, id("AA"), id("KK")).is_err(), "zero samples");
|
||||
assert!(pair_equity(&nlhe(), 1, 100, CLASS_COUNT, id("KK")).is_err(), "class out of range");
|
||||
let omaha = rules(Variant::Plo5);
|
||||
assert!(pair_equity(&omaha, 1, 100, id("AA"), id("KK")).is_err(), "only two hole cards");
|
||||
let short = rules(Variant::ShortDeck);
|
||||
assert!(pair_equity(&short, 1, 100, id("52o"), id("KK")).is_err(), "class not in the deck");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn triangle_layout_is_dense_and_covers_every_pair_once() {
|
||||
let pairs = triangle_pairs();
|
||||
assert_eq!(pairs.len(), TRIANGLE_LEN);
|
||||
assert_eq!(TRIANGLE_LEN, 169 * 170 / 2);
|
||||
assert!(pairs.iter().all(|(i, j)| i <= j && *j < CLASS_COUNT));
|
||||
let distinct: std::collections::HashSet<_> = pairs.iter().collect();
|
||||
assert_eq!(distinct.len(), TRIANGLE_LEN);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn matrix_from_triangle_is_antisymmetric_and_rejects_bad_input() {
|
||||
let matrix = frozen_equity();
|
||||
for i in (0..CLASS_COUNT).step_by(7) {
|
||||
assert!((matrix.get(i, i) - 0.5).abs() < 1e-9, "class vs itself is a coin flip");
|
||||
for j in (0..CLASS_COUNT).step_by(5) {
|
||||
assert!((matrix.get(i, j) + matrix.get(j, i) - 1.0).abs() < 1e-9);
|
||||
}
|
||||
}
|
||||
assert!(EquityMatrix::from_triangle(&[0u16; 10]).is_err(), "wrong length");
|
||||
assert!(EquityMatrix::from_triangle(&vec![10_001u16; TRIANGLE_LEN]).is_err(), "above 100 %");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frozen_table_has_the_published_values() {
|
||||
let m = frozen_equity();
|
||||
assert!((m.get(id("AA"), id("KK")) - 0.819).abs() < 0.01);
|
||||
assert!((m.get(id("AKo"), id("QQ")) - 0.43).abs() < 0.012);
|
||||
assert!((m.get(id("AKs"), id("22")) - 0.50).abs() < 0.012);
|
||||
assert!((m.get(id("AA"), id("72o")) - 0.88).abs() < 0.02);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frozen_table_reproduces_equity_against_a_random_hand() {
|
||||
let m = frozen_equity();
|
||||
let chance = chance_table(DeckRule::FULL);
|
||||
let vs_random = |c: usize| -> f64 {
|
||||
let (num, den) = (0..CLASS_COUNT).fold((0.0, 0.0), |(n, d), j| {
|
||||
let p = chance.probability(c, j);
|
||||
(n + p * m.get(c, j), d + p)
|
||||
});
|
||||
num / den
|
||||
};
|
||||
assert!((vs_random(id("AA")) - 0.852).abs() < 0.006, "AA {}", vs_random(id("AA")));
|
||||
assert!((vs_random(id("32o")) - 0.323).abs() < 0.006, "32o {}", vs_random(id("32o")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sampled_frozen_entries_regenerate_bit_for_bit_from_the_recorded_seed() {
|
||||
let pairs = triangle_pairs();
|
||||
// A fixed stride so the whole table is represented, not just the corners.
|
||||
for k in (0..TRIANGLE_LEN).step_by(2_411) {
|
||||
let (i, j) = pairs[k];
|
||||
if i == j {
|
||||
continue;
|
||||
}
|
||||
let again = pair_equity(&nlhe(), frozen::SEED, frozen::SAMPLES, i, j).expect("equity");
|
||||
assert_eq!(again, frozen::TRIANGLE[k], "entry {k} ({i},{j})");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
//! The two preflop game trees: structure, input faults and exact payoff identities.
|
||||
//!
|
||||
//! Identities used (all independent of the solver): with a symmetric chance table and an
|
||||
//! antisymmetric equity matrix, "always push / always call" from the small blind is worth
|
||||
//! exactly 0 (a fair coin on every deal), "always push / always fold" is +1 (the big blind),
|
||||
//! "always fold" is -0.5 (the small blind already posted).
|
||||
mod cfr_support;
|
||||
|
||||
use pokerfreak::cfr::environment::Environment;
|
||||
use pokerfreak::cfr::exploitability::game_value;
|
||||
use pokerfreak::cfr::open_game::open_tree;
|
||||
use pokerfreak::cfr::push_fold_game::push_fold_tree;
|
||||
use pokerfreak::cfr::seat::Seat;
|
||||
use pokerfreak::cfr::spot_params::{OPEN_SIZE, THREE_BET_SIZE, WAKE_FRACTION};
|
||||
use pokerfreak::cfr::strategy::Strategy;
|
||||
use pokerfreak::cfr::tree::Node;
|
||||
use pokerfreak::cfr::wake_range::top_membership;
|
||||
use pokerfreak::variant::{rules, Variant};
|
||||
|
||||
fn env() -> Environment {
|
||||
Environment::frozen()
|
||||
}
|
||||
|
||||
fn names(tree: &pokerfreak::cfr::tree::Tree) -> Vec<&'static str> {
|
||||
tree.nodes
|
||||
.iter()
|
||||
.filter_map(|n| match n {
|
||||
Node::Decision { name, .. } => Some(*name),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn seats_know_how_many_players_act_behind_them() {
|
||||
let behind: Vec<usize> = Seat::ALL.iter().map(|s| s.players_behind()).collect();
|
||||
// EP, MP, CO, BTN, SB: the big blind is the modelled opponent, the others are "behind".
|
||||
assert_eq!(behind, vec![4, 3, 2, 1, 0]);
|
||||
assert!(Seat::Button.is_in_position_against_big_blind());
|
||||
assert!(!Seat::SmallBlind.is_in_position_against_big_blind());
|
||||
assert_eq!(Seat::Early.label(), "EP");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn push_fold_tree_has_two_decisions_over_169_classes() {
|
||||
let tree = push_fold_tree(&env(), Seat::Button, 10.0).expect("tree");
|
||||
assert_eq!(tree.classes, 169);
|
||||
let mut found = names(&tree);
|
||||
found.sort_unstable();
|
||||
assert_eq!(found, vec!["call", "push"]);
|
||||
assert!(tree.find("push").is_some() && tree.find("call").is_some());
|
||||
assert_eq!(tree.action_count(tree.find("push").unwrap()), Some(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_tree_has_the_four_documented_decisions() {
|
||||
let tree = open_tree(&env(), Seat::Cutoff, 40.0).expect("tree");
|
||||
for name in ["open", "defend", "vs_three_bet", "vs_jam"] {
|
||||
assert!(tree.find(name).is_some(), "{name}");
|
||||
}
|
||||
assert_eq!(tree.action_count(tree.find("open").unwrap()), Some(2));
|
||||
assert_eq!(tree.action_count(tree.find("defend").unwrap()), Some(3));
|
||||
assert_eq!(tree.action_count(tree.find("vs_three_bet").unwrap()), Some(3));
|
||||
assert_eq!(tree.action_count(tree.find("vs_jam").unwrap()), Some(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bad_stack_depths_are_faults_not_panics() {
|
||||
let e = env();
|
||||
for depth in [f64::NAN, f64::INFINITY, 0.0, -5.0, 0.5] {
|
||||
assert!(push_fold_tree(&e, Seat::Button, depth).is_err(), "push {depth}");
|
||||
assert!(open_tree(&e, Seat::Button, depth).is_err(), "open {depth}");
|
||||
}
|
||||
// The 3-bet size must fit below the stack, otherwise the 3-bet line is not a raise.
|
||||
assert!(open_tree(&e, Seat::Button, THREE_BET_SIZE).is_err());
|
||||
assert!(open_tree(&e, Seat::Button, OPEN_SIZE).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_rejects_rules_that_are_not_two_card_hold_em() {
|
||||
let equity = pokerfreak::cfr::frozen_equity::frozen_equity();
|
||||
assert!(Environment::new(&rules(Variant::Plo5), equity.clone()).is_err());
|
||||
assert!(Environment::new(&rules(Variant::Nlhe), equity.clone()).is_ok());
|
||||
assert!(Environment::new(&rules(Variant::Aof), equity).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn small_blind_push_fold_identities_are_exact() {
|
||||
let tree = push_fold_tree(&env(), Seat::SmallBlind, 10.0).expect("tree");
|
||||
let strat = |push: usize, call: usize| {
|
||||
Strategy::pure(&tree, |name, _class| if name == "push" { push } else { call })
|
||||
};
|
||||
assert!((game_value(&tree, &strat(0, 0)) + 0.5).abs() < 1e-9, "fold: -0.5");
|
||||
assert!((game_value(&tree, &strat(1, 0)) - 1.0).abs() < 1e-9, "push, they fold: +1");
|
||||
assert!(game_value(&tree, &strat(1, 1)).abs() < 1e-9, "push, they call: fair coin");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn small_blind_open_identities_are_exact() {
|
||||
let tree = open_tree(&env(), Seat::SmallBlind, 40.0).expect("tree");
|
||||
// Actions: open [fold, raise]; defend [fold, call, 3-bet]; vs_three_bet [fold, call, jam];
|
||||
// vs_jam [fold, call].
|
||||
let strat = |open: usize, defend: usize| {
|
||||
Strategy::pure(&tree, |name, _| match name {
|
||||
"open" => open,
|
||||
"defend" => defend,
|
||||
_ => 0,
|
||||
})
|
||||
};
|
||||
assert!((game_value(&tree, &strat(0, 0)) + 0.5).abs() < 1e-9, "fold the small blind");
|
||||
assert!((game_value(&tree, &strat(1, 0)) - 1.0).abs() < 1e-9, "raise, big blind folds");
|
||||
// Raise, big blind 3-bets everything, the opener always folds: loses the open.
|
||||
assert!((game_value(&tree, &strat(1, 2)) + OPEN_SIZE_SB).abs() < 1e-9);
|
||||
}
|
||||
|
||||
const OPEN_SIZE_SB: f64 = pokerfreak::cfr::spot_params::SMALL_BLIND_OPEN_SIZE;
|
||||
|
||||
#[test]
|
||||
fn players_behind_cost_the_opener_money_when_they_wake_up() {
|
||||
// Pushing everything and being folded to is worth the dead money + big blind only if
|
||||
// nobody behind wakes up; the earlier the seat, the more often somebody does.
|
||||
let e = env();
|
||||
let value = |seat: Seat| {
|
||||
let tree = push_fold_tree(&e, seat, 10.0).expect("tree");
|
||||
game_value(&tree, &Strategy::pure(&tree, |name, _| if name == "push" { 1 } else { 0 }))
|
||||
};
|
||||
// Push-all/fold-all values: BTN > CO > MP > EP (more wake-up chances), all below 1.5.
|
||||
assert!(value(Seat::Button) > value(Seat::Cutoff));
|
||||
assert!(value(Seat::Cutoff) > value(Seat::Middle));
|
||||
assert!(value(Seat::Middle) > value(Seat::Early));
|
||||
assert!(value(Seat::Button) < 1.5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wake_range_membership_covers_exactly_the_requested_share_of_combos() {
|
||||
let e = env();
|
||||
let membership = top_membership(&e, WAKE_FRACTION);
|
||||
let combos: f64 = (0..169)
|
||||
.map(|c| membership[c] * pokerfreak::cfr::hand_class::class_combos(c).len() as f64)
|
||||
.sum();
|
||||
assert!((combos / 1326.0 - WAKE_FRACTION).abs() < 1e-9);
|
||||
assert!(membership.iter().all(|m| (0.0..=1.0).contains(m)));
|
||||
assert_eq!(membership[cfr_support::id("AA")], 1.0);
|
||||
assert_eq!(membership[cfr_support::id("72o")], 0.0);
|
||||
assert_eq!(top_membership(&e, 0.0).iter().sum::<f64>(), 0.0);
|
||||
assert!((top_membership(&e, 1.0).iter().sum::<f64>() - 169.0).abs() < 1e-9);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
//! The 169 hold'em classes, their combos and the exact card-removal weights between two classes.
|
||||
//!
|
||||
//! Reference counts: 13 pairs x 6 + 78 suited x 4 + 78 offsuit x 12 = 1326 combos (any textbook);
|
||||
//! ordered disjoint combo pairs of two hands = 1326 x 1225.
|
||||
mod cfr_support;
|
||||
|
||||
use cfr_support::id;
|
||||
use pokerfreak::card::{Card, Rank};
|
||||
use pokerfreak::cfr::chance_table::chance_table;
|
||||
use pokerfreak::cfr::hand_class::{
|
||||
class_combos, class_exists, class_name, class_of, class_parse, classes_in, CLASS_COUNT,
|
||||
};
|
||||
use pokerfreak::variant::DeckRule;
|
||||
use std::collections::HashSet;
|
||||
|
||||
fn card(text: &str) -> Card {
|
||||
Card::parse_short(text).expect("card")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn there_are_169_distinct_classes_named_round_trip() {
|
||||
let names: HashSet<String> = (0..CLASS_COUNT).filter_map(class_name).collect();
|
||||
assert_eq!(names.len(), 169);
|
||||
for c in 0..CLASS_COUNT {
|
||||
let name = class_name(c).expect("name");
|
||||
assert_eq!(class_parse(&name), Some(c), "{name}");
|
||||
}
|
||||
assert_eq!(class_name(CLASS_COUNT), None);
|
||||
assert_eq!(class_parse("AKx"), None);
|
||||
assert_eq!(class_parse("AAs"), None, "pairs carry no suitedness");
|
||||
assert_eq!(class_parse(""), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn combo_counts_are_6_4_12_and_total_1326() {
|
||||
assert_eq!(class_combos(id("AA")).len(), 6);
|
||||
assert_eq!(class_combos(id("AKs")).len(), 4);
|
||||
assert_eq!(class_combos(id("AKo")).len(), 12);
|
||||
let total: usize = (0..CLASS_COUNT).map(|c| class_combos(c).len()).sum();
|
||||
assert_eq!(total, 1326);
|
||||
let mut all: Vec<[Card; 2]> = (0..CLASS_COUNT).flat_map(class_combos).collect();
|
||||
all.iter_mut().for_each(|h| h.sort());
|
||||
let distinct: HashSet<[Card; 2]> = all.into_iter().collect();
|
||||
assert_eq!(distinct.len(), 1326, "classes partition the combos");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn class_of_cards_is_symmetric_and_rejects_duplicates() {
|
||||
let (a, b) = (card("Ah"), card("Kh"));
|
||||
assert_eq!(class_of(a, b), Some(id("AKs")));
|
||||
assert_eq!(class_of(b, a), Some(id("AKs")));
|
||||
assert_eq!(class_of(card("Ah"), card("Kd")), Some(id("AKo")));
|
||||
assert_eq!(class_of(card("7c"), card("7s")), Some(id("77")));
|
||||
assert_eq!(class_of(a, a), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn combos_belong_to_their_class() {
|
||||
for c in 0..CLASS_COUNT {
|
||||
for h in class_combos(c) {
|
||||
assert_eq!(class_of(h[0], h[1]), Some(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn short_deck_has_81_classes_and_630_combos() {
|
||||
let ids = classes_in(DeckRule::SHORT);
|
||||
assert_eq!(ids.len(), 81);
|
||||
assert!(ids.iter().all(|c| class_exists(DeckRule::SHORT, *c)));
|
||||
assert!(!class_exists(DeckRule::SHORT, id("52o")));
|
||||
assert!(class_exists(DeckRule::SHORT, id("A6s")));
|
||||
let combos: usize = ids
|
||||
.iter()
|
||||
.map(|c| class_combos(*c).iter().filter(|h| h.iter().all(|k| k.rank >= Rank::Six)).count())
|
||||
.sum();
|
||||
assert_eq!(combos, 630);
|
||||
assert_eq!(classes_in(DeckRule::FULL).len(), 169);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chance_weights_are_exact_with_card_removal() {
|
||||
let table = chance_table(DeckRule::FULL);
|
||||
// Each ordered disjoint pair of combos counts once: 1326 * 1225 in total.
|
||||
assert_eq!(table.total(), 1326 * 1225);
|
||||
let sum: f64 = (0..CLASS_COUNT)
|
||||
.flat_map(|i| (0..CLASS_COUNT).map(move |j| (i, j)))
|
||||
.map(|(i, j)| table.probability(i, j))
|
||||
.sum();
|
||||
assert!((sum - 1.0).abs() < 1e-12);
|
||||
// AA vs AA: every AA combo has exactly one disjoint partner.
|
||||
assert_eq!(table.disjoint_combos(id("AA"), id("AA")), 6);
|
||||
// AA vs KK: 6 x 6, no shared card.
|
||||
assert_eq!(table.disjoint_combos(id("AA"), id("KK")), 36);
|
||||
// AA vs AKs: AhAs leaves AdKd and AcKc; six AA combos x 2 = 12.
|
||||
assert_eq!(table.disjoint_combos(id("AA"), id("AKs")), 12);
|
||||
for (a, b) in [("AKo", "QQ"), ("T9s", "98s"), ("72o", "AA")] {
|
||||
assert_eq!(table.disjoint_combos(id(a), id(b)), table.disjoint_combos(id(b), id(a)));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn short_deck_chance_weights_total_630_x_561() {
|
||||
let table = chance_table(DeckRule::SHORT);
|
||||
assert_eq!(table.total(), 630 * 561);
|
||||
assert_eq!(table.disjoint_combos(id("52o"), id("AA")), 0, "absent class has no weight");
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
//! The CFR core against a game with a known analytic equilibrium: Kuhn poker.
|
||||
//!
|
||||
//! Kuhn (1950): three cards J < Q < K, one dealt to each player, ante 1, one bet of 1.
|
||||
//! Known solution (Kuhn 1950; Wikipedia "Kuhn poker"): game value for the first player = -1/18;
|
||||
//! the first player bets J with probability a in [0, 1/3], K with 3a, checks Q always, and after
|
||||
//! check-bet calls with Q at 1/3 + a, K always, J never. The second player facing a bet calls
|
||||
//! with K always, Q at 1/3, J never; after a check bets J at 1/3, K always, Q never.
|
||||
use pokerfreak::cfr::exploitability::{best_response_gain, exploitability, game_value};
|
||||
use pokerfreak::cfr::iterate::iterate;
|
||||
use pokerfreak::cfr::solve::solve;
|
||||
use pokerfreak::cfr::solver_state::SolverState;
|
||||
use pokerfreak::cfr::strategy::{average_strategy, Strategy};
|
||||
use pokerfreak::cfr::tree::{Node, Payoff, Tree};
|
||||
use pokerfreak::rng::Rng;
|
||||
|
||||
const J: usize = 0;
|
||||
const Q: usize = 1;
|
||||
const K: usize = 2;
|
||||
|
||||
fn showdown(stake: f64) -> Payoff {
|
||||
let cell = |i: usize, j: usize| if i > j { stake } else { -stake };
|
||||
Payoff::Pair((0..9).map(|k| if k / 3 == k % 3 { 0.0 } else { cell(k / 3, k % 3) }).collect())
|
||||
}
|
||||
|
||||
/// Node ids: 0 first player, 1 second player after check, 2 first player vs bet, 3 second vs bet.
|
||||
fn kuhn() -> Tree {
|
||||
let chance = (0..9).map(|k| if k / 3 == k % 3 { 0.0 } else { 1.0 / 6.0 }).collect();
|
||||
let nodes = vec![
|
||||
Node::Decision { player: 0, name: "p0_open", children: vec![1, 3] },
|
||||
Node::Decision { player: 1, name: "p1_after_check", children: vec![4, 2] },
|
||||
Node::Decision { player: 0, name: "p0_vs_bet", children: vec![5, 6] },
|
||||
Node::Decision { player: 1, name: "p1_vs_bet", children: vec![7, 8] },
|
||||
Node::Terminal(showdown(1.0)), // 4: check-check
|
||||
Node::Terminal(Payoff::Flat(-1.0)), // 5: check-bet-fold
|
||||
Node::Terminal(showdown(2.0)), // 6: check-bet-call
|
||||
Node::Terminal(Payoff::Flat(1.0)), // 7: bet-fold
|
||||
Node::Terminal(showdown(2.0)), // 8: bet-call
|
||||
];
|
||||
Tree { classes: 3, chance, nodes, root: 0 }
|
||||
}
|
||||
|
||||
fn solved(iterations: u32) -> (Tree, Strategy) {
|
||||
let tree = kuhn();
|
||||
let (state, _) = (0..iterations)
|
||||
.fold((SolverState::fresh(&tree), Rng::seeded(1)), |(s, r), _| iterate(&tree, s, r));
|
||||
let strategy = average_strategy(&tree, &state);
|
||||
(tree, strategy)
|
||||
}
|
||||
|
||||
/// Probability of the last action (bet / call) of `class` at the named node.
|
||||
fn last_action(tree: &Tree, strategy: &Strategy, name: &str, class: usize) -> f64 {
|
||||
let node = tree.find(name).expect("node");
|
||||
let actions = tree.action_count(node).expect("decision");
|
||||
strategy.probability(node, class, actions - 1)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn kuhn_value_and_exploitability_converge() {
|
||||
let (tree, strategy) = solved(20_000);
|
||||
assert!((game_value(&tree, &strategy) + 1.0 / 18.0).abs() < 0.002, "value");
|
||||
assert!(exploitability(&tree, &strategy) < 0.002, "exploitability {}", exploitability(&tree, &strategy));
|
||||
assert!(best_response_gain(&tree, &strategy, 0) >= -1e-9);
|
||||
assert!(best_response_gain(&tree, &strategy, 1) >= -1e-9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn kuhn_strategy_has_the_analytic_shape() {
|
||||
let (tree, s) = solved(30_000);
|
||||
let a = last_action(&tree, &s, "p0_open", J);
|
||||
assert!(a < 0.34, "J bluff frequency in [0, 1/3]: {a}");
|
||||
assert!((last_action(&tree, &s, "p0_open", K) - 3.0 * a).abs() < 0.04, "K bets three times J");
|
||||
assert!(last_action(&tree, &s, "p0_open", Q) < 0.03, "Q checks");
|
||||
assert!((last_action(&tree, &s, "p0_vs_bet", Q) - (1.0 / 3.0 + a)).abs() < 0.04);
|
||||
assert!(last_action(&tree, &s, "p0_vs_bet", K) > 0.97);
|
||||
assert!(last_action(&tree, &s, "p0_vs_bet", J) < 0.03);
|
||||
assert!(last_action(&tree, &s, "p1_vs_bet", K) > 0.97);
|
||||
assert!((last_action(&tree, &s, "p1_vs_bet", Q) - 1.0 / 3.0).abs() < 0.03);
|
||||
assert!(last_action(&tree, &s, "p1_vs_bet", J) < 0.03);
|
||||
assert!((last_action(&tree, &s, "p1_after_check", J) - 1.0 / 3.0).abs() < 0.03);
|
||||
assert!(last_action(&tree, &s, "p1_after_check", K) > 0.97);
|
||||
assert!(last_action(&tree, &s, "p1_after_check", Q) < 0.03);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_uniform_strategy_is_clearly_exploitable() {
|
||||
let tree = kuhn();
|
||||
// Uniform strategy: never folds, bets half the time; strictly exploitable.
|
||||
let uniform = average_strategy(&tree, &SolverState::fresh(&tree));
|
||||
assert!(exploitability(&tree, &uniform) > 0.05);
|
||||
// "Always call, always bet": the best response folds / checks accordingly; exploitability > 0.
|
||||
let value = game_value(&tree, &uniform);
|
||||
assert!(value.abs() < 0.5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn iteration_is_a_pure_fold_and_deterministic() {
|
||||
let tree = kuhn();
|
||||
let start = SolverState::fresh(&tree);
|
||||
let (a, ra) = iterate(&tree, start.clone(), Rng::seeded(5));
|
||||
let (b, rb) = iterate(&tree, start.clone(), Rng::seeded(5));
|
||||
assert_eq!(a, b);
|
||||
assert_eq!(ra, rb);
|
||||
// The input value is untouched by the step (it was cloned, but also compare to a fresh one).
|
||||
assert_eq!(start, SolverState::fresh(&tree));
|
||||
assert_eq!(a.iteration(), 1);
|
||||
// Different seeds give the identical result: full-width CFR draws no random numbers.
|
||||
let (c, _) = iterate(&tree, start, Rng::seeded(99));
|
||||
assert_eq!(a, c);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn solve_reports_checkpoints_and_stability() {
|
||||
let tree = kuhn();
|
||||
let solved = solve(&tree, 4_000, Rng::seeded(1));
|
||||
assert_eq!(solved.iterations, 4_000);
|
||||
assert_eq!(solved.checkpoints.last().map(|c| c.0), Some(4_000));
|
||||
let curve: Vec<f64> = solved.checkpoints.iter().map(|c| c.1).collect();
|
||||
assert!(curve.first() > curve.last(), "exploitability falls: {curve:?}");
|
||||
assert!(solved.stable_since <= 4_000);
|
||||
assert!(solved.final_exploitability < 0.01);
|
||||
// solve is the same fold as iterating by hand.
|
||||
let (_, strategy) = solved_by_hand(4_000);
|
||||
assert_eq!(strategy, solved.strategy);
|
||||
}
|
||||
|
||||
fn solved_by_hand(iterations: u32) -> (Tree, Strategy) {
|
||||
solved(iterations)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn degenerate_inputs_do_not_panic() {
|
||||
let empty = Tree { classes: 0, chance: vec![], nodes: vec![], root: 0 };
|
||||
let state = SolverState::fresh(&empty);
|
||||
let (state, _) = iterate(&empty, state, Rng::seeded(1));
|
||||
let strategy = average_strategy(&empty, &state);
|
||||
assert_eq!(exploitability(&empty, &strategy), 0.0);
|
||||
let lonely = Tree {
|
||||
classes: 1,
|
||||
chance: vec![1.0],
|
||||
nodes: vec![Node::Terminal(Payoff::Flat(0.25))],
|
||||
root: 0,
|
||||
};
|
||||
let s = average_strategy(&lonely, &SolverState::fresh(&lonely));
|
||||
assert!((game_value(&lonely, &s) - 0.25).abs() < 1e-12);
|
||||
// A root index outside the tree is a no-op, not a panic.
|
||||
let broken = Tree { classes: 1, chance: vec![1.0], nodes: vec![], root: 7 };
|
||||
let s = average_strategy(&broken, &SolverState::fresh(&broken));
|
||||
assert_eq!(game_value(&broken, &s), 0.0);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
//! Nash test: best responses against the FROZEN (permille-rounded) strategies.
|
||||
//!
|
||||
//! For every decision node and hand class the counterfactual value of each action is computed
|
||||
//! with all other decisions frozen, conditional on reaching the node (normalised by the opponent
|
||||
//! reach mass). Then:
|
||||
//!
|
||||
//! - an action with zero frozen frequency must not beat the frozen mix by more than `EPSILON`;
|
||||
//! - an action played at 5 % or more must not be worse than the mix by more than
|
||||
//! `EPSILON_SUPPORT`;
|
||||
//! - both players' best-response gains sum to the exploitability, below `EXPLOITABILITY_BOUND`.
|
||||
//!
|
||||
//! Only infosets that are actually reached count (own reach x opponent reach >= `REACH_FLOOR`);
|
||||
//! an unreached row is any strategy, because its value is multiplied by zero.
|
||||
//!
|
||||
//! Units: big blinds per deal of the spot (the expected result of the whole spot for the player
|
||||
//! who is first to act, so `0.01` bb is `10` milli-bb per hand dealt).
|
||||
use pokerfreak::cfr::deviation::deviations;
|
||||
use pokerfreak::cfr::environment::Environment;
|
||||
use pokerfreak::cfr::exploitability::exploitability;
|
||||
use pokerfreak::cfr::frozen_strategy::{open_strategy, push_fold_strategy};
|
||||
use pokerfreak::cfr::open_game::open_tree;
|
||||
use pokerfreak::cfr::push_fold_game::push_fold_tree;
|
||||
use pokerfreak::cfr::strategy::Strategy;
|
||||
use pokerfreak::cfr::tree::Tree;
|
||||
use pokerfreak::preflop::generated_charts::{AOF_PUSH_FOLD, OPEN, PUSH_FOLD};
|
||||
|
||||
const EPSILON: f64 = 0.02;
|
||||
const EPSILON_SUPPORT: f64 = 0.05;
|
||||
const REACH_FLOOR: f64 = 1e-3;
|
||||
const EXPLOITABILITY_BOUND: f64 = 0.01;
|
||||
|
||||
fn check(label: &str, tree: &Tree, strategy: &Strategy, recorded_micro_bb: u32) {
|
||||
let exploit = exploitability(tree, strategy);
|
||||
assert!(exploit < EXPLOITABILITY_BOUND, "{label}: exploitability {exploit} bb");
|
||||
let recorded = recorded_micro_bb as f64 * 1e-6;
|
||||
assert!((exploit - recorded).abs() < 2e-6, "{label}: header says {recorded}, got {exploit}");
|
||||
let mut worst: f64 = 0.0;
|
||||
for d in deviations(tree, strategy).iter().filter(|d| d.weight >= REACH_FLOOR) {
|
||||
worst = worst.max(d.zero_frequency_gain());
|
||||
assert!(
|
||||
d.zero_frequency_gain() <= EPSILON,
|
||||
"{label}: {} class {} would gain {} bb by deviating (weight {})",
|
||||
d.node, d.class, d.zero_frequency_gain(), d.weight
|
||||
);
|
||||
assert!(
|
||||
d.support_shortfall() <= EPSILON_SUPPORT,
|
||||
"{label}: {} class {} plays an action that loses {} bb to the mix",
|
||||
d.node, d.class, d.support_shortfall()
|
||||
);
|
||||
}
|
||||
assert!(worst.is_finite());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_frozen_push_fold_spot_is_a_nash_equilibrium_within_epsilon() {
|
||||
let env = Environment::frozen();
|
||||
for spot in PUSH_FOLD.iter() {
|
||||
let tree = push_fold_tree(&env, spot.seat, spot.depth_bb as f64).expect("tree");
|
||||
let strategy = push_fold_strategy(&tree, spot).expect("strategy");
|
||||
let label = format!("push/fold {} {}bb", spot.seat.label(), spot.depth_bb);
|
||||
check(&label, &tree, &strategy, spot.meta.exploitability_micro_bb);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_frozen_open_spot_is_a_nash_equilibrium_within_epsilon() {
|
||||
let env = Environment::frozen();
|
||||
for spot in OPEN.iter() {
|
||||
let tree = open_tree(&env, spot.seat, spot.depth_bb as f64).expect("tree");
|
||||
let strategy = open_strategy(&tree, spot).expect("strategy");
|
||||
let label = format!("open {} {}bb", spot.seat.label(), spot.depth_bb);
|
||||
check(&label, &tree, &strategy, spot.meta.exploitability_micro_bb);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_in_or_fold_variant_uses_the_same_equilibrium() {
|
||||
let env = Environment::frozen();
|
||||
for spot in AOF_PUSH_FOLD.iter() {
|
||||
let tree = push_fold_tree(&env, spot.seat, spot.depth_bb as f64).expect("tree");
|
||||
let strategy = push_fold_strategy(&tree, spot).expect("strategy");
|
||||
assert!(exploitability(&tree, &strategy) < EXPLOITABILITY_BOUND);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_test_can_fail_a_wrong_strategy_shows_profitable_deviations() {
|
||||
// Take the frozen 10 bb cutoff spot and replace the pusher by "push every hand":
|
||||
// folding 72o is then a profitable deviation and the exploitability is far above the bound.
|
||||
let env = Environment::frozen();
|
||||
let spot = PUSH_FOLD
|
||||
.iter()
|
||||
.find(|s| s.depth_bb == 10 && s.seat.label() == "CO")
|
||||
.expect("spot");
|
||||
let tree = push_fold_tree(&env, spot.seat, 10.0).expect("tree");
|
||||
let frozen = push_fold_strategy(&tree, spot).expect("strategy");
|
||||
let reckless = frozen.with_pure(&tree, "push", |_class| 1);
|
||||
assert!(exploitability(&tree, &reckless) > 5.0 * EXPLOITABILITY_BOUND);
|
||||
let worst = deviations(&tree, &reckless)
|
||||
.iter()
|
||||
.filter(|d| d.weight >= REACH_FLOOR)
|
||||
.map(|d| d.zero_frequency_gain())
|
||||
.fold(0.0_f64, f64::max);
|
||||
assert!(worst > 5.0 * EPSILON, "worst deviation {worst}");
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//! Shared helpers for the `cfr_*` and `generated_charts_*` tests.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use pokerfreak::cfr::hand_class::{class_combos, class_parse, CLASS_COUNT};
|
||||
|
||||
/// Class id for a name like `"AKs"`; panics only inside tests.
|
||||
pub fn id(name: &str) -> usize {
|
||||
class_parse(name).unwrap_or_else(|| panic!("class name {name}"))
|
||||
}
|
||||
|
||||
/// Share of all 1326 combos covered by a per-class frequency row (permille).
|
||||
pub fn width(row: &[u16; CLASS_COUNT]) -> f64 {
|
||||
(0..CLASS_COUNT)
|
||||
.map(|c| row[c] as f64 / 1000.0 * class_combos(c).len() as f64)
|
||||
.sum::<f64>()
|
||||
/ 1326.0
|
||||
}
|
||||
|
||||
/// Same for one column of a 3-way node row (`[call, raise]` permille).
|
||||
pub fn width_column(row: &[[u16; 2]; CLASS_COUNT], column: usize) -> f64 {
|
||||
(0..CLASS_COUNT)
|
||||
.map(|c| row[c][column] as f64 / 1000.0 * class_combos(c).len() as f64)
|
||||
.sum::<f64>()
|
||||
/ 1326.0
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
//! Pure lookup over the frozen charts: grid points, interpolation, clamping, refusals.
|
||||
//!
|
||||
//! Depth rule (documented in `generated_lookup.rs`): linear interpolation of the frequencies
|
||||
//! between the two neighbouring grid depths; outside the grid the nearest table is used
|
||||
//! (clamping). Non-finite or non-positive depths are refused (`None`).
|
||||
mod cfr_support;
|
||||
|
||||
use cfr_support::id;
|
||||
use pokerfreak::card::Card;
|
||||
use pokerfreak::cfr::hand_class::{class_of, CLASS_COUNT};
|
||||
use pokerfreak::cfr::seat::Seat;
|
||||
use pokerfreak::preflop::generated_charts::{OPEN, PUSH_FOLD};
|
||||
use pokerfreak::preflop::generated_lookup::{
|
||||
call_vs_push, open_depth_range, open_frequency, push_depth_range, push_frequency, seat_of,
|
||||
vs_jam, vs_open, vs_three_bet, Frequencies,
|
||||
};
|
||||
use pokerfreak::preflop::position::Position;
|
||||
use pokerfreak::variant::Variant;
|
||||
|
||||
fn close(a: f64, b: f64) -> bool {
|
||||
(a - b).abs() < 1e-9
|
||||
}
|
||||
|
||||
fn sums_to_one(f: Frequencies) -> bool {
|
||||
close(f.fold + f.call + f.raise, 1.0)
|
||||
&& [f.fold, f.call, f.raise].iter().all(|x| (0.0..=1.0).contains(x))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grid_depths_return_the_table_entry_exactly() {
|
||||
let spot = PUSH_FOLD.iter().find(|s| s.seat == Seat::Button && s.depth_bb == 10).expect("spot");
|
||||
for c in [id("AA"), id("A5s"), id("72o"), id("98s"), id("QJo")] {
|
||||
let f = push_frequency(Variant::Nlhe, Seat::Button, 10.0, c).expect("lookup");
|
||||
assert!(close(f.raise, spot.push[c] as f64 / 1000.0));
|
||||
assert!(close(f.fold, 1.0 - spot.push[c] as f64 / 1000.0));
|
||||
assert_eq!(f.call, 0.0);
|
||||
let g = call_vs_push(Variant::Nlhe, Seat::Button, 10.0, c).expect("lookup");
|
||||
assert!(close(g.call, spot.call[c] as f64 / 1000.0));
|
||||
assert!(sums_to_one(f) && sums_to_one(g));
|
||||
}
|
||||
let open = OPEN.iter().find(|s| s.seat == Seat::Cutoff && s.depth_bb == 40).expect("spot");
|
||||
let c = id("KJs");
|
||||
let f = open_frequency(Seat::Cutoff, 40.0, c).expect("lookup");
|
||||
assert!(close(f.raise, open.open[c] as f64 / 1000.0));
|
||||
let d = vs_open(Seat::Cutoff, 40.0, c).expect("lookup");
|
||||
assert!(close(d.call, open.defend[c][0] as f64 / 1000.0));
|
||||
assert!(close(d.raise, open.defend[c][1] as f64 / 1000.0));
|
||||
let t = vs_three_bet(Seat::Cutoff, 40.0, c).expect("lookup");
|
||||
assert!(close(t.call, open.vs_three_bet[c][0] as f64 / 1000.0));
|
||||
assert!(close(t.raise, open.vs_three_bet[c][1] as f64 / 1000.0));
|
||||
let j = vs_jam(Seat::Cutoff, 40.0, c).expect("lookup");
|
||||
assert!(close(j.call, open.vs_jam[c] as f64 / 1000.0));
|
||||
assert!([d, t, j].into_iter().all(sums_to_one));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn between_grid_depths_the_frequencies_are_linearly_interpolated() {
|
||||
for c in 0..CLASS_COUNT {
|
||||
let lo = push_frequency(Variant::Nlhe, Seat::Cutoff, 8.0, c).expect("lookup").raise;
|
||||
let hi = push_frequency(Variant::Nlhe, Seat::Cutoff, 10.0, c).expect("lookup").raise;
|
||||
let mid = push_frequency(Variant::Nlhe, Seat::Cutoff, 9.0, c).expect("lookup");
|
||||
assert!(close(mid.raise, (lo + hi) / 2.0), "class {c}");
|
||||
assert!(sums_to_one(mid));
|
||||
let quarter = push_frequency(Variant::Nlhe, Seat::Cutoff, 8.5, c).expect("lookup").raise;
|
||||
assert!(close(quarter, lo * 0.75 + hi * 0.25));
|
||||
}
|
||||
let a = open_frequency(Seat::Button, 20.0, id("K9o")).expect("lookup").raise;
|
||||
let b = open_frequency(Seat::Button, 40.0, id("K9o")).expect("lookup").raise;
|
||||
let m = open_frequency(Seat::Button, 30.0, id("K9o")).expect("lookup").raise;
|
||||
assert!(close(m, (a + b) / 2.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outside_the_grid_the_nearest_table_is_used() {
|
||||
let (lo, hi) = push_depth_range();
|
||||
assert_eq!((lo, hi), (5.0, 25.0));
|
||||
for c in [id("A2o"), id("T8s"), id("54s")] {
|
||||
let at_lo = push_frequency(Variant::Nlhe, Seat::Early, lo, c).expect("lookup");
|
||||
let below = push_frequency(Variant::Nlhe, Seat::Early, 1.0, c).expect("lookup");
|
||||
let at_hi = push_frequency(Variant::Nlhe, Seat::Early, hi, c).expect("lookup");
|
||||
let above = push_frequency(Variant::Nlhe, Seat::Early, 80.0, c).expect("lookup");
|
||||
assert_eq!(at_lo, below);
|
||||
assert_eq!(at_hi, above);
|
||||
}
|
||||
assert_eq!(open_depth_range(), (20.0, 100.0));
|
||||
assert_eq!(
|
||||
open_frequency(Seat::Early, 500.0, id("JTs")),
|
||||
open_frequency(Seat::Early, 100.0, id("JTs"))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nonsense_inputs_are_refused_not_panicked_on() {
|
||||
for depth in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY, 0.0, -3.0] {
|
||||
assert!(push_frequency(Variant::Nlhe, Seat::Button, depth, 0).is_none(), "{depth}");
|
||||
assert!(call_vs_push(Variant::Nlhe, Seat::Button, depth, 0).is_none());
|
||||
assert!(open_frequency(Seat::Button, depth, 0).is_none());
|
||||
assert!(vs_open(Seat::Button, depth, 0).is_none());
|
||||
assert!(vs_three_bet(Seat::Button, depth, 0).is_none());
|
||||
assert!(vs_jam(Seat::Button, depth, 0).is_none());
|
||||
}
|
||||
assert!(push_frequency(Variant::Nlhe, Seat::Button, 10.0, CLASS_COUNT).is_none());
|
||||
assert!(open_frequency(Seat::Button, 40.0, usize::MAX).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsupported_variants_have_no_chart() {
|
||||
for v in [Variant::Plo5, Variant::KPoker, Variant::ShortDeck] {
|
||||
assert!(push_frequency(v, Seat::Button, 10.0, 0).is_none(), "{v:?}");
|
||||
assert!(call_vs_push(v, Seat::Button, 10.0, 0).is_none());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_in_or_fold_answers_exactly_like_push_fold() {
|
||||
for c in 0..CLASS_COUNT {
|
||||
for depth in [5.0, 9.3, 17.0, 25.0] {
|
||||
assert_eq!(
|
||||
push_frequency(Variant::Aof, Seat::SmallBlind, depth, c),
|
||||
push_frequency(Variant::Nlhe, Seat::SmallBlind, depth, c)
|
||||
);
|
||||
assert_eq!(
|
||||
call_vs_push(Variant::Aof, Seat::Early, depth, c),
|
||||
call_vs_push(Variant::Nlhe, Seat::Early, depth, c)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn positions_map_to_chart_seats() {
|
||||
assert_eq!(seat_of(Position::Early), Some(Seat::Early));
|
||||
assert_eq!(seat_of(Position::Middle), Some(Seat::Middle));
|
||||
assert_eq!(seat_of(Position::Cutoff), Some(Seat::Cutoff));
|
||||
assert_eq!(seat_of(Position::Button), Some(Seat::Button));
|
||||
assert_eq!(seat_of(Position::SmallBlind), Some(Seat::SmallBlind));
|
||||
assert_eq!(seat_of(Position::HeadsUpButton), Some(Seat::SmallBlind), "heads-up button is the small blind");
|
||||
assert_eq!(seat_of(Position::Unknown), Some(Seat::Early), "unknown position uses the tightest row");
|
||||
assert_eq!(seat_of(Position::BigBlind), None, "the big blind never opens or jams first");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn classes_come_from_cards() {
|
||||
let ace = Card::parse_short("Ah").expect("card");
|
||||
let king = Card::parse_short("Kh").expect("card");
|
||||
let c = class_of(ace, king).expect("class");
|
||||
let f = push_frequency(Variant::Nlhe, Seat::Button, 8.0, c).expect("lookup");
|
||||
assert!(f.raise > 0.9, "AKs jams the button at 8 bb");
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
//! Plausibility of the frozen charts: they must look like poker, not just solve the abstraction.
|
||||
//!
|
||||
//! Widths are shares of the 1326 combos. Frequencies are permille in the tables.
|
||||
//!
|
||||
//! Direction of the properties (model facts, not assumptions about real play):
|
||||
//! - push/fold: shorter stack => wider jamming AND wider calling; later seat => wider jamming.
|
||||
//! - open/call/3-bet: later seat => wider opening (EP <= MP <= CO <= BTN). With stack depth the
|
||||
//! opening range does NOT widen monotonically in this model: the postflop payoff is a fixed
|
||||
//! share of a pot that does not grow with the stacks, and only the jam line (rarer and less
|
||||
//! attractive the deeper the stacks) depends on depth, so the width is nearly flat (observed
|
||||
//! spread 0.04 between the 20 / 40 / 100 bb tables of one seat, peak at 40 bb). The test pins
|
||||
//! what holds: the width changes by less than `DEPTH_DRIFT`.
|
||||
//!
|
||||
//! Observed on the frozen tables (the slacks below are several times looser): per-class
|
||||
//! violations of the position order 0.0 (exact subsets) and width violations 0.0.
|
||||
mod cfr_support;
|
||||
|
||||
use cfr_support::{id, width, width_column};
|
||||
use pokerfreak::cfr::hand_class::CLASS_COUNT;
|
||||
use pokerfreak::cfr::seat::Seat;
|
||||
use pokerfreak::preflop::generated_charts::{
|
||||
AOF_PUSH_FOLD, OPEN, OPEN_DEPTHS, PUSH_FOLD, PUSH_FOLD_DEPTHS,
|
||||
};
|
||||
|
||||
/// Per-class slack when comparing mixed frequencies across spots (mixing at range borders).
|
||||
const SLACK: f64 = 0.05;
|
||||
/// Width slack between neighbouring spots.
|
||||
const WIDTH_SLACK: f64 = 0.01;
|
||||
const DEPTH_DRIFT: f64 = 0.06;
|
||||
|
||||
fn push_spot(seat: Seat, depth: u8) -> &'static pokerfreak::cfr::frozen_spot::PushFoldSpot {
|
||||
PUSH_FOLD.iter().find(|s| s.seat == seat && s.depth_bb == depth).expect("push spot")
|
||||
}
|
||||
|
||||
fn open_spot(seat: Seat, depth: u8) -> &'static pokerfreak::cfr::frozen_spot::OpenSpot {
|
||||
OPEN.iter().find(|s| s.seat == seat && s.depth_bb == depth).expect("open spot")
|
||||
}
|
||||
|
||||
fn fraction(row: &[u16; CLASS_COUNT], class: usize) -> f64 {
|
||||
row[class] as f64 / 1000.0
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tables_cover_every_seat_and_depth_exactly_once() {
|
||||
assert_eq!(PUSH_FOLD.len(), 5 * PUSH_FOLD_DEPTHS.len());
|
||||
assert_eq!(OPEN.len(), 4 * OPEN_DEPTHS.len() + OPEN_DEPTHS.len());
|
||||
for seat in Seat::ALL {
|
||||
for depth in PUSH_FOLD_DEPTHS {
|
||||
assert_eq!(PUSH_FOLD.iter().filter(|s| s.seat == seat && s.depth_bb == depth).count(), 1);
|
||||
}
|
||||
for depth in OPEN_DEPTHS {
|
||||
assert_eq!(OPEN.iter().filter(|s| s.seat == seat && s.depth_bb == depth).count(), 1);
|
||||
}
|
||||
}
|
||||
assert_eq!(PUSH_FOLD_DEPTHS, [5, 8, 10, 12, 15, 20, 25]);
|
||||
assert_eq!(OPEN_DEPTHS, [20, 40, 100]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn permille_rows_are_well_formed() {
|
||||
for s in PUSH_FOLD.iter() {
|
||||
assert!(s.push.iter().chain(s.call.iter()).all(|f| *f <= 1000));
|
||||
}
|
||||
for s in OPEN.iter() {
|
||||
assert!(s.open.iter().all(|f| *f <= 1000));
|
||||
assert!(s.vs_jam.iter().all(|f| *f <= 1000));
|
||||
for row in [&s.defend, &s.vs_three_bet] {
|
||||
assert!(row.iter().all(|[call, raise]| call + raise <= 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn aces_always_raise_or_jam_and_never_fold() {
|
||||
let aa = id("AA");
|
||||
for s in PUSH_FOLD.iter() {
|
||||
assert_eq!(s.push[aa], 1000, "AA pushes at {} {}bb", s.seat.label(), s.depth_bb);
|
||||
assert_eq!(s.call[aa], 1000, "AA calls a push at {} {}bb", s.seat.label(), s.depth_bb);
|
||||
}
|
||||
for s in AOF_PUSH_FOLD.iter() {
|
||||
assert_eq!((s.push[aa], s.call[aa]), (1000, 1000));
|
||||
}
|
||||
for s in OPEN.iter() {
|
||||
let tag = format!("{} {}bb", s.seat.label(), s.depth_bb);
|
||||
assert_eq!(s.open[aa], 1000, "AA opens at {tag}");
|
||||
let [call, three_bet] = s.defend[aa];
|
||||
assert_eq!(call + three_bet, 1000, "AA never folds to an open at {tag}");
|
||||
assert!(three_bet >= 900, "AA 3-bets at {tag}: {three_bet}");
|
||||
let [call, jam] = s.vs_three_bet[aa];
|
||||
assert_eq!(call + jam, 1000, "AA never folds to a 3-bet at {tag}");
|
||||
assert!(jam >= 900, "AA jams over a 3-bet at {tag}: {jam}");
|
||||
assert_eq!(s.vs_jam[aa], 1000, "AA calls a jam at {tag}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn push_ranges_widen_with_position_as_subsets() {
|
||||
for depth in PUSH_FOLD_DEPTHS {
|
||||
let order = [Seat::Early, Seat::Middle, Seat::Cutoff, Seat::Button, Seat::SmallBlind];
|
||||
for pair in order.windows(2) {
|
||||
let (early, late) = (push_spot(pair[0], depth), push_spot(pair[1], depth));
|
||||
assert!(
|
||||
width(&early.push) <= width(&late.push) + WIDTH_SLACK,
|
||||
"{} -> {} at {depth}bb: {} vs {}",
|
||||
pair[0].label(), pair[1].label(), width(&early.push), width(&late.push)
|
||||
);
|
||||
for c in 0..CLASS_COUNT {
|
||||
assert!(
|
||||
fraction(&early.push, c) <= fraction(&late.push, c) + SLACK,
|
||||
"class {c} {} -> {} at {depth}bb", pair[0].label(), pair[1].label()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shorter_stacks_jam_and_call_wider() {
|
||||
for seat in Seat::ALL {
|
||||
for pair in PUSH_FOLD_DEPTHS.windows(2) {
|
||||
let (short, deep) = (push_spot(seat, pair[0]), push_spot(seat, pair[1]));
|
||||
assert!(
|
||||
width(&short.push) >= width(&deep.push) - WIDTH_SLACK,
|
||||
"push {} {}bb vs {}bb", seat.label(), pair[0], pair[1]
|
||||
);
|
||||
assert!(
|
||||
width(&short.call) >= width(&deep.call) - WIDTH_SLACK,
|
||||
"call {} {}bb vs {}bb", seat.label(), pair[0], pair[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_big_blind_calls_wider_against_wider_pushing_seats() {
|
||||
for depth in PUSH_FOLD_DEPTHS {
|
||||
let order = [Seat::Early, Seat::Middle, Seat::Cutoff, Seat::Button, Seat::SmallBlind];
|
||||
for pair in order.windows(2) {
|
||||
assert!(
|
||||
width(&push_spot(pair[0], depth).call) <= width(&push_spot(pair[1], depth).call) + WIDTH_SLACK,
|
||||
"call vs {} -> {} at {depth}bb", pair[0].label(), pair[1].label()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_ranges_widen_with_position_as_subsets() {
|
||||
for depth in OPEN_DEPTHS {
|
||||
let order = [Seat::Early, Seat::Middle, Seat::Cutoff, Seat::Button];
|
||||
for pair in order.windows(2) {
|
||||
let (early, late) = (open_spot(pair[0], depth), open_spot(pair[1], depth));
|
||||
assert!(
|
||||
width(&early.open) <= width(&late.open) + WIDTH_SLACK,
|
||||
"{} -> {} at {depth}bb: {} vs {}",
|
||||
pair[0].label(), pair[1].label(), width(&early.open), width(&late.open)
|
||||
);
|
||||
for c in 0..CLASS_COUNT {
|
||||
assert!(
|
||||
fraction(&early.open, c) <= fraction(&late.open, c) + SLACK,
|
||||
"class {c} {} -> {} at {depth}bb", pair[0].label(), pair[1].label()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_width_is_roughly_stable_across_depth_and_never_degenerate() {
|
||||
for seat in Seat::ALL {
|
||||
let widths: Vec<f64> = OPEN_DEPTHS.iter().map(|d| width(&open_spot(seat, *d).open)).collect();
|
||||
let (lo, hi) = widths.iter().fold((1.0_f64, 0.0_f64), |(l, h), w| (l.min(*w), h.max(*w)));
|
||||
assert!(hi - lo <= DEPTH_DRIFT, "{} widths {widths:?}", seat.label());
|
||||
assert!(lo > 0.04 && hi < 0.95, "{} widths {widths:?}", seat.label());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stronger_hands_are_never_played_less_than_clearly_weaker_ones() {
|
||||
// Same ranks, suited >= offsuit; a bigger pair >= a smaller pair.
|
||||
for s in PUSH_FOLD.iter() {
|
||||
for (suited, offsuit) in [("AKs", "AKo"), ("T9s", "T9o"), ("A5s", "A5o"), ("KQs", "KQo")] {
|
||||
assert!(fraction(&s.push, id(suited)) + 0.05 >= fraction(&s.push, id(offsuit)));
|
||||
}
|
||||
for (big, small) in [("AA", "KK"), ("KK", "99"), ("99", "55"), ("55", "22")] {
|
||||
assert!(fraction(&s.push, id(big)) + 0.05 >= fraction(&s.push, id(small)));
|
||||
assert!(fraction(&s.call, id(big)) + 0.05 >= fraction(&s.call, id(small)));
|
||||
}
|
||||
assert!(fraction(&s.push, id("72o")) <= fraction(&s.push, id("A2o")) + 0.05);
|
||||
}
|
||||
for s in OPEN.iter() {
|
||||
for (big, small) in [("AA", "KK"), ("KK", "99"), ("99", "55")] {
|
||||
assert!(fraction(&s.open, id(big)) + 0.05 >= fraction(&s.open, id(small)));
|
||||
}
|
||||
assert!(fraction(&s.open, id("32o")) <= 0.05, "{} {}bb opens 32o", s.seat.label(), s.depth_bb);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn heads_up_small_blind_matches_published_push_fold_nash() {
|
||||
// Reference: heads-up push/fold Nash equilibrium at 10 effective big blinds (blinds 0.5/1):
|
||||
// the small blind jams roughly the top 55-60 % of hands and the big blind calls roughly the
|
||||
// top 35-42 % (Miller / Sklansky-Chubukov style charts, HoldemResources Nash calculator and
|
||||
// ICMIZER heads-up charts all agree within a few points). Tolerance reflects that spread
|
||||
// plus the Monte-Carlo noise of the equity table. Values quoted from memory of those
|
||||
// published charts, not re-derived here.
|
||||
let spot = push_spot(Seat::SmallBlind, 10);
|
||||
let push = width(&spot.push);
|
||||
let call = width(&spot.call);
|
||||
assert!((0.52..=0.64).contains(&push), "SB 10bb push {push}");
|
||||
assert!((0.32..=0.45).contains(&call), "BB 10bb call {call}");
|
||||
// Classic anchors of that chart: any ace and any pair pushes; 72o folds; 32o folds.
|
||||
assert!(spot.push[id("A2o")] >= 900 && spot.push[id("22")] == 1000);
|
||||
assert_eq!(spot.push[id("32o")], 0);
|
||||
// At 5 bb the small blind jams clearly wider (about 70 %): the big blind must call ~60 % to
|
||||
// keep him honest, and 72o still loses to folding (EV -0.7 vs -0.5), so 100 % is not Nash.
|
||||
let five = width(&push_spot(Seat::SmallBlind, 5).push);
|
||||
assert!(five > push + 0.08 && five < 0.9, "SB 5bb push {five}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_in_or_fold_tables_are_the_push_fold_tables() {
|
||||
assert_eq!(AOF_PUSH_FOLD.len(), PUSH_FOLD.len());
|
||||
for (a, b) in AOF_PUSH_FOLD.iter().zip(PUSH_FOLD.iter()) {
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convergence_metadata_is_consistent() {
|
||||
for s in PUSH_FOLD.iter() {
|
||||
let m = &s.meta;
|
||||
assert!(m.iterations >= 1_000, "{} {}bb", s.seat.label(), s.depth_bb);
|
||||
assert!(m.stable_since >= 1 && m.stable_since <= m.iterations);
|
||||
assert_eq!(m.checkpoints[m.checkpoints.len() - 1].0, m.iterations);
|
||||
// Exploitability falls along the curve (allow tiny wobble) and ends below the bound.
|
||||
let first = m.checkpoints[0].1;
|
||||
let last = m.checkpoints[m.checkpoints.len() - 1].1;
|
||||
assert!(last <= first, "{} {}bb curve", s.seat.label(), s.depth_bb);
|
||||
assert!(m.exploitability_micro_bb < 10_000, "below 0.01 bb");
|
||||
}
|
||||
for s in OPEN.iter() {
|
||||
let m = &s.meta;
|
||||
assert!(m.iterations >= 1_000);
|
||||
assert!(m.stable_since >= 1 && m.stable_since <= m.iterations);
|
||||
assert!(m.checkpoints[m.checkpoints.len() - 1].1 <= m.checkpoints[0].1);
|
||||
assert!(m.exploitability_micro_bb < 10_000);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tight_seats_defend_less_than_they_open_wide_and_big_blind_defends_widest_against_the_button() {
|
||||
// Against a later (wider) opener the big blind continues with a wider range.
|
||||
for depth in OPEN_DEPTHS {
|
||||
let vs_ep = open_spot(Seat::Early, depth);
|
||||
let vs_btn = open_spot(Seat::Button, depth);
|
||||
let cont = |s: &pokerfreak::cfr::frozen_spot::OpenSpot| {
|
||||
width_column(&s.defend, 0) + width_column(&s.defend, 1)
|
||||
};
|
||||
assert!(cont(vs_ep) <= cont(vs_btn) + WIDTH_SLACK, "{depth}bb");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
//! The generator reproduces the frozen tables; the recorded convergence iteration is real.
|
||||
//!
|
||||
//! Full reproduction (same seed, same iteration count => identical permille tables and
|
||||
//! metadata) is checked for a few representative spots, because every spot costs thousands of
|
||||
//! full-width CFR iterations. For the remaining spots the claim "the argmax chart is final from
|
||||
//! `stable_since` on" is checked by re-running only to that iteration, on a seeded sample of
|
||||
//! spots (`SAMPLE`).
|
||||
use pokerfreak::cfr::chart_signature::signature;
|
||||
use pokerfreak::cfr::environment::Environment;
|
||||
use pokerfreak::cfr::frozen_strategy::{open_strategy, push_fold_strategy};
|
||||
use pokerfreak::cfr::open_game::open_tree;
|
||||
use pokerfreak::cfr::push_fold_game::push_fold_tree;
|
||||
use pokerfreak::cfr::render_charts::render_charts;
|
||||
use pokerfreak::cfr::run_plan::{CFR_SEED, OPEN_ITERATIONS, PUSH_FOLD_ITERATIONS};
|
||||
use pokerfreak::cfr::seat::Seat;
|
||||
use pokerfreak::cfr::solve::solve;
|
||||
use pokerfreak::cfr::spot_solver::{solve_open_spot, solve_push_fold_spot};
|
||||
use pokerfreak::preflop::generated_charts::{AOF_PUSH_FOLD, OPEN, PUSH_FOLD};
|
||||
use pokerfreak::rng::Rng;
|
||||
use pokerfreak::variant::{rules, Variant};
|
||||
|
||||
/// How many spots of each kind are re-run up to `stable_since`.
|
||||
const SAMPLE: u64 = 4;
|
||||
|
||||
#[test]
|
||||
fn iteration_counts_in_the_tables_are_the_plan() {
|
||||
assert!(PUSH_FOLD.iter().all(|s| s.meta.iterations == PUSH_FOLD_ITERATIONS));
|
||||
assert!(OPEN.iter().all(|s| s.meta.iterations == OPEN_ITERATIONS));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_push_fold_spot_is_reproduced_bit_for_bit() {
|
||||
let env = Environment::frozen();
|
||||
for (seat, depth) in [(Seat::Button, 10u8), (Seat::SmallBlind, 5)] {
|
||||
let frozen = PUSH_FOLD.iter().find(|s| s.seat == seat && s.depth_bb == depth).expect("spot");
|
||||
let again = solve_push_fold_spot(&env, seat, depth).expect("spot");
|
||||
assert_eq!(&again, frozen, "{} {depth}bb", seat.label());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_open_spot_is_reproduced_bit_for_bit() {
|
||||
let env = Environment::frozen();
|
||||
let frozen = OPEN.iter().find(|s| s.seat == Seat::Cutoff && s.depth_bb == 40).expect("spot");
|
||||
let again = solve_open_spot(&env, Seat::Cutoff, 40).expect("spot");
|
||||
assert_eq!(&again, frozen);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_all_in_or_fold_rules_generate_the_same_push_fold_tables() {
|
||||
// Generic over rules: the AOF rule set (binary action shape) yields the identical spot.
|
||||
let nlhe = Environment::frozen();
|
||||
let aof = Environment::new(&rules(Variant::Aof), pokerfreak::cfr::frozen_equity::frozen_equity())
|
||||
.expect("environment");
|
||||
let a = solve_push_fold_spot(&aof, Seat::Middle, 12).expect("spot");
|
||||
let b = solve_push_fold_spot(&nlhe, Seat::Middle, 12).expect("spot");
|
||||
assert_eq!(a, b);
|
||||
assert_eq!(&a, AOF_PUSH_FOLD.iter().find(|s| s.seat == Seat::Middle && s.depth_bb == 12).expect("spot"));
|
||||
}
|
||||
|
||||
fn sample_indices(len: usize, count: u64, seed: u64) -> Vec<usize> {
|
||||
let (picks, _) = (0..count).fold((Vec::new(), Rng::seeded(seed)), |(mut picks, rng), _| {
|
||||
let (k, rng) = rng.below(len as u64);
|
||||
picks.push(k as usize);
|
||||
(picks, rng)
|
||||
});
|
||||
picks
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_argmax_chart_is_final_from_the_recorded_iteration_on_sampled_push_fold_spots() {
|
||||
let env = Environment::frozen();
|
||||
for k in sample_indices(PUSH_FOLD.len(), SAMPLE, 3) {
|
||||
let spot = &PUSH_FOLD[k];
|
||||
let tree = push_fold_tree(&env, spot.seat, spot.depth_bb as f64).expect("tree");
|
||||
let frozen = signature(&push_fold_strategy(&tree, spot).expect("strategy"));
|
||||
let early = solve(&tree, spot.meta.stable_since, Rng::seeded(CFR_SEED));
|
||||
assert_eq!(signature(&early.strategy), frozen, "{} {}bb", spot.seat.label(), spot.depth_bb);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_argmax_chart_is_final_from_the_recorded_iteration_on_sampled_open_spots() {
|
||||
let env = Environment::frozen();
|
||||
for k in sample_indices(OPEN.len(), SAMPLE, 5) {
|
||||
let spot = &OPEN[k];
|
||||
let tree = open_tree(&env, spot.seat, spot.depth_bb as f64).expect("tree");
|
||||
let frozen = signature(&open_strategy(&tree, spot).expect("strategy"));
|
||||
let early = solve(&tree, spot.meta.stable_since, Rng::seeded(CFR_SEED));
|
||||
assert_eq!(signature(&early.strategy), frozen, "{} {}bb", spot.seat.label(), spot.depth_bb);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rendering_is_pure_and_describes_every_spot() {
|
||||
let text = render_charts(&PUSH_FOLD[..2], &OPEN[..1]);
|
||||
assert_eq!(text, render_charts(&PUSH_FOLD[..2], &OPEN[..1]));
|
||||
assert!(text.contains("PushFoldSpot {"));
|
||||
assert!(text.contains("OpenSpot {"));
|
||||
assert!(text.contains("cargo run --release --bin chartgen"));
|
||||
assert!(text.contains(&format!("{}", PUSH_FOLD[0].meta.iterations)));
|
||||
}
|
||||
|
||||
fn unix(text: &str) -> String {
|
||||
text.replace("\r\n", "\n")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_frozen_chart_file_is_exactly_what_the_generator_prints() {
|
||||
// `chartgen charts` renders its spots with `render_charts`; rendering the frozen spots back
|
||||
// must give the committed file, byte for byte (header, convergence table and data).
|
||||
let committed = unix(include_str!("../src/preflop/generated_charts.rs"));
|
||||
assert!(committed == render_charts(&PUSH_FOLD, &OPEN), "generated_charts.rs differs from the renderer output");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_frozen_equity_file_is_exactly_what_the_generator_prints() {
|
||||
use pokerfreak::cfr::generated_equity as frozen;
|
||||
use pokerfreak::cfr::render_equity::render_equity;
|
||||
let committed = unix(include_str!("../src/cfr/generated_equity.rs"));
|
||||
assert!(
|
||||
committed == render_equity(frozen::SEED, frozen::SAMPLES, &frozen::TRIANGLE),
|
||||
"generated_equity.rs differs from the renderer output"
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user