#cards #poker

rs_poker

A library to help with any Rust code dealing with poker. This includes card values, suits, hands, hand ranks, 5 card hand strength calculation, 7 card hand strength calulcation, and monte carlo game simulation helpers.

13 releases

✓ Uses Rust 2018 edition

0.6.0 Nov 3, 2019
0.5.2 Jan 8, 2019
0.4.1 Dec 24, 2017
0.4.0 Apr 26, 2017
0.1.3 Apr 6, 2017

#16 in Games

Download history 10/week @ 2019-07-19 6/week @ 2019-07-26 6/week @ 2019-08-02 17/week @ 2019-08-09 1/week @ 2019-08-16 237/week @ 2019-08-23 15/week @ 2019-08-30 41/week @ 2019-09-06 18/week @ 2019-09-13 73/week @ 2019-09-20 15/week @ 2019-09-27 12/week @ 2019-10-04 25/week @ 2019-10-18 15/week @ 2019-10-25

158 downloads per month

Apache-2.0

82KB
1.5K SLoC

rs-poker

Crates.io

RS Poker is a rust library aimed at being a good starting place for lots of poker rust code. Correctness and performance are the two main goals.

Documentation is uploaded here The crates.io page is here

Core

The Core module contains code that is not specific to different types of poker games. It contains:

  • Suit type
  • Value type
  • Card type
  • Deck
  • Hand iteration
  • Poker hand rank type
  • Poker hand evaluation for five card hands.
  • Poker hand evaluation for seven card hands.

The poker hand (5 card) evaluation will rank a hand in ~20 nanoseconds per hand. That means that 50 Million hands per second can be ranked. The seven card hand evaluation will rank a hand in < 25 ns.

The hand evaluation is is fully accurate, it does not rely on just single kicker. This allows for breaking ties on hands that are closer.

Holdem

The holdem module contains code that is specific to holdem. It currently contains:

  • Starting hand enumeration
  • Hand range parsing
  • Monte Carlo game simulation helpers.

Testing

The code is pretty well tested and benchmarked. If you find something that looks like a bug please submit a pr with test code.

5 Card + Hand iteration has been used in conjunction with fuzzing to validate the seven card hand evaluation.

Dependencies

~505KB