The functionality of the other modules is tested by its purposes.The functionality of the evaluators is tested by comparing with the JSON files generated by the original C++ evaluator.The pre-calculated tables ( phevaluator.tables) are tested by comparing them with the tables generated by test codes.Usage examples can be seen in examples.py. The function can take both numbers and card strings (with a format like: 'Ah' or '2C'). from phevaluator import evaluate_cards p1 = evaluate_cards ( '9c', '4c', '4s', '9d', '4h', 'Qc', '6c' ) p2 = evaluate_cards ( '9c', '4c', '4s', '9d', '4h', '2c', '9h' ) # Player 2 has a stronger hand print ( f 'The rank of the hand in player 1 is ' ) # 236 The main function is the evaluate_cards function. Modification, the same algorithm can be also applied to evaluating Omaha
The combinations, it uses a perfect hash algorithm to get the hand strengthįrom a pre-computed hash table, which only costs very few CPU cycles andĬonsiderably small memory (~100kb for the 7 card evaluation). PH Evaluator Python package (phevaluator)įor evaluating poker hands with more than 5 cards.