Skip to main content

Rust poker library

Project description

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

Developing Bindings

Use virtual env virtualenv .venv.

Enable the envirnmoent source .venv/bin/activate

Run maturin develop to create ptyhon lib with bindings, it will automatically put it inside the python packages dir.

To test out point the ipynb notebooks kernel to virtualenv and then just run the package.

To install pytohn packages pip install poetry && poetry install --no-root

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrust_poker-0.1.15.tar.gz (55.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrust_poker-0.1.15-cp312-cp312-manylinux_2_34_x86_64.whl (243.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file pyrust_poker-0.1.15.tar.gz.

File metadata

  • Download URL: pyrust_poker-0.1.15.tar.gz
  • Upload date:
  • Size: 55.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.8

File hashes

Hashes for pyrust_poker-0.1.15.tar.gz
Algorithm Hash digest
SHA256 acce4ab2cbdab2f7fccb7fe86e2c9ced3fd8f589fd10d6d72878b070b49b9b7f
MD5 526e791ff94c21d0b3fbebbde35a236e
BLAKE2b-256 1ced4eb3da215fac14ed53569eded9d137bd580fd344a6cc403d90bf55bebe80

See more details on using hashes here.

File details

Details for the file pyrust_poker-0.1.15-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pyrust_poker-0.1.15-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6c377328e29fdad47055dbac77ed12654393fa3fbb109e120f3906a0b7940d2d
MD5 49e1016297bbd3bc8b8e2a78ad0f8ade
BLAKE2b-256 e3b9a1f29fbc44f0845a6c89343f24379450f2eac0adaef4a35cb84eb690d466

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page