#resources

ckc-rs

Poker hand evaluation library

15 releases

0.1.15 Mar 23, 2024
0.1.14 Mar 11, 2023
0.1.13 May 12, 2022
0.1.11 Apr 26, 2022
0.1.2 Jan 31, 2022

#148 in Game dev

Download history 77/week @ 2024-12-16 45/week @ 2024-12-23 69/week @ 2024-12-30 119/week @ 2025-01-06 112/week @ 2025-01-13 71/week @ 2025-01-20 44/week @ 2025-01-27 119/week @ 2025-02-03 122/week @ 2025-02-10 249/week @ 2025-02-17 108/week @ 2025-02-24 244/week @ 2025-03-03 75/week @ 2025-03-10 99/week @ 2025-03-17 125/week @ 2025-03-24

558 downloads per month
Used in 2 crates

Apache-2.0

380KB
6.5K SLoC

ckc-rs

License: Apache 2.0 Build and Test Crates.io Version Rustdocs

Implementation of a modified Cactus Kev's Poker Hand Evaluator library in Rust. Code inspired and lookup tables borrowed from Vladislav Supalov's pokereval-rs library, which in turn was inspired by Cactus Kev's work in C.

The primary entity in the library is a PokerCard. PokerCard is a u32 variant of Cactus Kev's binary representation of a poker card. The variation being that the Suit bits order is inverted for easier sorting by other libraries:

+--------+--------+--------+--------+
|xxxbbbbb|bbbbbbbb|SHDCrrrr|xxpppppp|
+--------+--------+--------+--------+

p = prime number of rank (deuce=2,trey=3,four=5,...,ace=41)
r = rank of card (deuce=0,trey=1,four=2,five=3,...,ace=12)
SHDC = suit of card (bit turned on based on suit of card)
b = bit turned on depending on rank of card

This library contains only the bare bones implementation of the library, and is no-std to maintain maximum utility with embedded and wasm Rust.

Possible Dependencies (if needed)

Resources

Dependencies

~0.4–1MB
~22K SLoC