Little Sorry
A Rust library for regret minimization algorithms (Counterfactual Regret Minimization) used to find Nash equilibrium strategies in imperfect-information games.
Features
- 6 CFR variants via the
RegretMinimizertrait:- CFR+ — regret clipping at zero
- Discounted CFR (DCFR) — time-based discounting with configurable parameters
- DCFR+ — combines DCFR discounting with CFR+ clipping
- Linear CFR — linear time-weighted regrets
- Predictive CFR+ (PCFR+) — uses future regret predictions
- Predictive DCFR+ (PDCFR+) — combines DCFR+ discounting with predictive updates
- Zero-allocation hot path — no heap allocations during
update_regret - Minimal dependencies (
randonly) - Rock-Paper-Scissors example game (feature-gated behind
rps)
Getting Started
Add this to your Cargo.toml:
[]
= "3.0.0"
Quick Example
use ;
let mut matcher = new;
// Run many iterations of regret updates
for _ in 0..1000
// Get the Nash equilibrium approximation
let strategy = matcher.best_weight;
All variants implement the RegretMinimizer trait, so you can swap algorithms generically:
use ;
Building and Testing
This project uses mise to manage tooling and tasks.
# Run all checks (formatting, linting, tests, TOML validation)
# Run tests
# Run benchmarks
# Run the RPS example
License
Licensed under the Apache License, Version 2.0.