Poker Hand Evaluator Lookup Table

  1. Poker Hand Evaluator Lookup Table Examples
  2. Poker Hand Evaluator Lookup Table Example
  3. Poker Hand Evaluator Lookup Tablet
  4. Poker Hand Evaluator Lookup Tables

Poker hand evaluator. Poker-eval is a C library to evaluate poker hands. The result of the evalution for a given hand is a number. The general idea is that if the evalution of your hand is lower than the evaluation of the hand of your opponent, you lose. Many poker variants are supported (draw, holdem, omaha, etc.) and more can be added. Cactus Kev's Poker Hand Evaluator A while ago, I decided to take a shot at writing a poker hand evaluator in the programming language 'C'. There are already numerous evaluators out there, but I had an idea for an algorithm that might be faster than anything already out there.

A pure Python poker hand evaluation library

Installation

Implementation notes

Deuces, originally written for the MIT Pokerbots Competition, is lightweight and fast. All lookups are done with bit arithmetic and dictionary lookups. That said, Deuces won't beat a C implemenation (~250k eval/s) but it is useful for situations where Python is required or where bots are allocated reasonable thinking time (human time scale).

Deuces handles 5, 6, and 7 card hand lookups. The 6 and 7 card lookups are done by combinatorially evaluating the 5 card choices, but later releases may have dedicated and faster algorithms for these.

I also have lookup tables for 2 card rollouts, which is particularly handy in evaluating Texas Hold'em preflop pot equity, but they are forthcoming as well.

See my blog for an explanation of how the library works and how the lookup table generation is done:http://willdrevo.com/ (haven't posted yet)

Usage

Deuces is easy to set up and use.

Card objects are represented as integers to keep Deuces performant and lightweight.

Now let's create the board and an example Texas Hold'em hand:

Poker Hand Evaluator Lookup Table Examples

Pretty print card integers to the terminal:

If you have termacolor installed, they will be colored as well.

Otherwise move straight to evaluating your hand strength:

Hand strength is valued on a scale of 1 to 7462, where 1 is a Royal Flush and 7462 is unsuited 7-5-4-3-2, as there are only 7642 distinctly ranked hands in poker. Once again, refer to my blog post for a more mathematically complete explanation of why this is so.

If you want to deal out cards randomly from a deck, you can also do that with Deuces:

and print them:

Let's evaluate both hands strength, and then bin them into classes, one for each hand type (High Card, Pair, etc)

or get a human-friendly string to describe the score,

or, coolest of all, get a blow-by-blow analysis of the stages of the game with relation to hand strength:

And that's Deuces, yo.

Poker Hand Evaluator Lookup Table Example

Performance

Just how fast is Deuces? Check out performance folder for a couple of tests comparing Deuces to other pure Python hand evaluators.

Here are the results evaluating 10,000 random 5, 6, and 7 card boards:

Compared to pokerhand-eval, Deuces is 2400x faster on 5 card evaluation, and drops to 300x faster on 7 card evaluation.

Lookup

However, SpecialKEval reigns supreme, with an impressive nearly 400k evals / sec (a factor of ~1.7 improvement over Deuces) for 5 cards, and an impressive 140k /sec on 7 cards (factor of 10).

For poker hand evaluation in Python, if you desire a cleaner user interface and more readable and adaptable code, I recommend Deuces, because if you really need speed, you should be using C anyway. The extra 10x on 7 cards with SpecialK won't get you much more in terms of Monte Carlo simulations, and SpecialK's 5 card evals are within a factor of 2 of Deuces's evals/s.

For C/C++, I'd recommand pokerstove, as its hyperoptimized C++ Boost routines can do 10+ million evals/s.

License

Copyright (c) 2013 Will Drevo

Poker Hand Evaluator Lookup Tablet

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the 'Software'), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.

Poker hand evaluator using the Two Plus Two alogorithm and lookup table.The lookup table HandRanks.dat is included in the module.

It is capable of evaluating 7, 6, 5, and 3 card hands. The highest hand possible in a 3 card hand is 3 of a kind, straights & flushes do not apply to 3 cards.

Hands can be evaluated by comparing the handType then the handRank to determine the better hand.

This can evaluate about 22MM hands per second on a quad-core 2.7GHz Macbook Pro. Run the speedtest.js file under /test to try it.

Poker Hand Evaluator Lookup Tables

to install:

Evaluator

npm install poker-evaluator

Usage: