Skip to contents

Evaluate the rank category of a five card poker hand using PH Evaluator.

Usage

eval_hand_phe(hand)

Arguments

hand

a hand of cards (an integer vector of length 5).

Value

string hand rank.

Details

Implemented following Rcpp-libraries, PH Evaluator cpp_example.cc, and RcppAnnoy, with help from R-Bloggers Rcpp and Roxygen2, usethis::use_rcpp(), roxygen2 instructions on Rcpp, Rcpp for everyone, the rxylib Makefile and Stack Overflow.

eval_hand_phe returns one of the rank categories "Straight Flush", "Four of a Kind", "Full House", "Flush", "Straight", "Three of a Kind", "Two Pair", "One Pair", or "High Card".

"Royal Flush" and "Jacks or Better" are not currently supported.

Examples

hand <- deal_hand(new_deck())
print_hand(hand)
#> [1] "7C QS TD 3D 2S"
eval_hand_phe(hand)
#> [1] "High Card"