Module poker::evaluate [−][src]
Anything and everything about evaluating poker hands.
Given the specific format in which Card
instances are coded, the key is
figuring out how to leverage that data representation to quickly evaluate
poker hands. (See [the card
module] for more information).
The key is the Evaluator
structure, which dynamically generates some
internal HashMap
s that it can use to quickly
look up poker hands by a hand’s unique key, which is a product of prime
numbers that each Card
instance codes.
Because the Evaluator
must dynamically generate its lookup tables at
runtime, and the tables are decently sized, it is recommended that:
If there’s going to be a performance bottleneck associated with this crate,
it will be making an Evaluator
from scratch. Even so, in optimized
benching, Evaluator::new
only takes about 300 - 400 microseconds
(there are 1 million microseconds in 1 second). Still, it is preferable
to be conservative here. All Evaluator
methods borrow Self
immutably,
so pass it around as you see fit.
Modules
static_lookup | This module is available under the non-default |
Structs
Eval | The result of a successful poker hand evaluation. When printed in
|
Evaluator | This structure does all the heavy lifting of evaluating poker hands. |
Enums
EvalClass | A utility enumeration type for pattern matching against the result of
|