#poker

nightly rust_poker

Rust poker library

14 releases

0.1.14 Mar 4, 2021
0.1.13 Feb 24, 2021
0.1.10 Nov 12, 2020
0.1.9 Oct 17, 2020
0.1.5 Jul 23, 2020

#7 in #poker

Download history 115/week @ 2022-06-02 5/week @ 2022-06-09 6/week @ 2022-06-16 8/week @ 2022-06-23 20/week @ 2022-06-30 15/week @ 2022-07-07 3/week @ 2022-07-14 59/week @ 2022-07-21 8/week @ 2022-07-28 6/week @ 2022-08-04 6/week @ 2022-08-11 4/week @ 2022-08-18 33/week @ 2022-08-25 5/week @ 2022-09-01 31/week @ 2022-09-08 10/week @ 2022-09-15

79 downloads per month

MIT license

80KB
2K SLoC

RustPoker

Build Status docs.rs crates.io

A poker library written in rust.

  • Multithreaded range vs range equity calculation
  • Fast hand evaluation
  • Efficient hand indexing

Installation

Add this to your Cargo.toml:

[dependencies]
rust_poker = "0.1.13"

Note: The first build of an application using rust_poker will take extra time to generate the hand evaluation table

Hand Evaluator

Evaluates the strength of any poker hand using up to 7 cards.

Usage

use rust_poker::hand_evaluator::{Hand, CARDS, evaluate};
// cards are indexed 0->51 where index is 4 * rank + suit
let hand = Hand::empty() + CARDS[0] + CARDS[1];
let score = evaluate(&hand);
println!("score: {}", score);

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 rust_poker::hand_range::{HandRange, get_card_mask};
use rust_poker::equity_calculator::approx_equity;
let ranges = HandRange::from_strings(["AK,22+".to_string(), "random".to_string()].to_vec());
let public_cards = get_card_mask("2h3d4c".to_string());
let stdev_target = 0.01;
let n_threads = 4;
let equities = approx_equity(&ranges, public_cards, n_threads, stdev_target);
println!("player 1 equity: {}", equities[0]);

Credit

The hand evaluator and equity calculator library is a rust rewrite of zekyll's C++ equity calculator, OMPEval

License

This project is MIT Licensed

Copyright (c) 2020 Kyle Murphy

Dependencies

~1.4–2.3MB
~45K SLoC