Pokers
A poker library written in rust.
- Multithreaded range vs range equity calculation
- Fast hand evaluation
- Efficient hand indexing
- Individual hand and combo results
Installation
Add this to your Cargo.toml
:
[dependencies]
pokers = "0.1.0"
Hand Evaluator
Evaluates the strength of any poker hand using up to 7 cards.
Usage
use ;
// cards are indexed 0->51 where index is 4 * rank + suit
let hand = empty + CARDS + CARDS;
let score = hand.evaluate;
println!;
Equity Calculator
Calculates the range vs range equities for up to 6 different ranges specified by equilab-like range strings. Supports monte-carlo simulations and exact equity calculations
Usage
use ;
use ;
use approx_equity;
let ranges = from_strings;
let board_mask = get_card_mask;
let dead_mask = get_card_mask;
let cancel_token = new;
let callback = ;
let std_dev_target = 0.01;
let n_threads = 4;
let result = approx_equity.unwrap;
let equities = result.equities;
println!;
Credit
This library is a fork of Kyle Murphy's rust rewrite (rust_poker) of zekyll's C++ equity calculator, OMPEval. Differences with the original repo:
- Fixes an issue that's been in the library for years without update. Impacts exact_equity()
- It stores the results for the individual hands and then aggregates them into combos at the end of the simulation.
- Only 1 dependency (rand).
- Uses hardcoded arrays for lookups, so no need to read and write from files, use vectors, or lazy_static. This speeds up compilation significantly.
- Adds a cancel token to the simulator to stop it at any time from another thread.
- Uses a callback that takes the progress of the simulation.
License
This project is MIT Licensed
Copyright (c) 2020 Kyle Murphy
Copyright (c) 2024 Eduardo Mata Ewy