Title: | Best Hand Analysis for Poker Variants Including Wildcards |
---|---|
Description: | Provides insight into how the best hand for a poker game changes based on the game dealt, players who stay in until the showdown and wildcards added to the base game. At this time the package does not support player tactics, so draw poker variants are not included. |
Authors: | Bradley Shanrock-Solberg |
Maintainer: | Bradley Shanrock-Solberg <[email protected]> |
License: | GPL-3 |
Version: | 1.1 |
Built: | 2024-12-19 06:43:59 UTC |
Source: | CRAN |
Provides insight into how the best hand for a poker game changes based on the game dealt, players who stay in until the showdown and wildcards added to the base game. At this time the package does not support player tactics, so draw poker variants are not included. This package is provides insight into how the best hand for a poker game changes based on the following variables:
Game Variant (which may include rules to split pot, wildcards that emerge in play, various dealing options)
Player Number (a good hand changes significantly as more players are added to the game)
Wildcards Added (additional wildcards incorporated beyond the basic game variant)
All hands are dealt completely and all players are assumed to stay in. Therefore the package makes no assumptions about betting strategy and largely because of this fact, poker variants involving drawing, discarding, passing or bidding on cards are not included at this time.
The DESCRIPTION file:
Package: | wildpoker |
Title: | Best Hand Analysis for Poker Variants Including Wildcards |
Version: | 1.1 |
Date: | 2016-01-25 |
Author: | Bradley Shanrock-Solberg |
Maintainer: | Bradley Shanrock-Solberg <[email protected]> |
Description: | Provides insight into how the best hand for a poker game changes based on the game dealt, players who stay in until the showdown and wildcards added to the base game. At this time the package does not support player tactics, so draw poker variants are not included. |
License: | GPL-3 |
Depends: | R (>= 3.2), grDevices, graphics, utils |
NeedsCompilation: | no |
Packaged: | 2016-01-29 21:25:21 UTC; Brad |
Repository: | CRAN |
Date/Publication: | 2016-01-30 00:32:45 |
Index of help topics:
wildpoker-package Best Hand Analysis for Poker Variants Including Wildcards wpgame Play a Wild Poker Variant Game wpgraphs Wild Poker Graphs for Best Hand Analysis wpnotsupported Poker Games not supported by the wildpoker package wprules Display Wild Poker Variant Game Rules wpstats Deal Many Hands of a Wild Poker Variant Game wpsupportedgames Poker Games Supported by the wildpoker package
This package is organized into three specfic functions and two data elements
wpgame
- Play a poker variant, see who won, game-level stats
wprules
- Display rules of a poker variant
wpstats
- Deal many games of a poker variant, capture statistics
wpgraphs
- Plot data from wpstats output into useful graphs
wpsupportedgames
- lists all supported games & basic description of each
wpnotsupported
- lists unsupported games & reason they are not yet included
For most purposes calling wpgraphs is sufficient - results have been precalculated for each supported game with from zero to 8 additional wildcards and from 2 to 8 players (or less, if a 52 card deck can not deal 8 hands), using 1000 hands dealt and a random number seed of 52.
Bradley Shanrock-Solberg Maintainer: Bradley Shanrock-Solberg [email protected]
Shanrock-Solberg, B (2015) Monte Carlo Methods for Decision Support (or Winning More at Dealer's Choice Poker)
This function will play a single game of a wildpoker variant, and return a visual display of the hands dealt to each player and/or community cards, a showdown matrix with the best hands chosen by each player, their score and pot percent won, as well as some game-level statistics.
wpgame(ngame, players, wcards = NULL)
wpgame(ngame, players, wcards = NULL)
ngame |
This is any supported game, such as "Seven Card Stud" or "Baseball". See
|
players |
An integer value, must be at least 2 and is limited by the number of cards that can be physically dealt. (eg, Seven Card Stud has a max of 7 players) |
wcards |
A vector of string values which are either supported wildcard aliases or individual cards. These cards are in addition to any wildcards that are a natural part of the poker game variant chosen with "ngame". The table below shows the supported aliases and their individual card vector equivalents:
|
This program shuffles a deck, deals the cards and uses the cards allowed to each player to evaluate the best poker hand for both the main hand and (if the variant includes a split hand) the alternate hand, then presents the results in a list form, suitable to just display to a user, or pass along to another program
A "pgame" list with the following structure:
$ntable |
A list of cards showing the deal visually, divided into $Extra, $Community and $Players. Extra cards are not used in hands, but affect gameplay. Community cards are shared by all players. Player cards are used only by individual players, and may include hole cards (prefixed with a #). Wildcards are suffixed by a "w". |
$showdown |
A data frame with one row per player (rowname), $maintype and $splittype represent the type of hand used by the player, eg 3-Kind or 7-High. $mainhand and $splithand show the cards used in the hand, using the same format as $ntable. $mainscore and $splitscore are calculated using the value of the cards in the hand, including "kickers", which allows two-pair Aces and 8s with Queen kicker to beat two-pair Aces and 8s with Jack kicker. The $potpct column shows how much of the pot the individual player won. The sum of all $potpct will be 1 if anybody won, but it is possible in some games for nobody to win, and nobody wins, all $potpct will equal zero. |
$summary |
A character vector with basic information $game and $wild capture the ngame and wcard parameters, $mwtype and $swtype capture the winning hands in the game |
$detail |
A numeric vector with other statistics, $mwscore and $ssscore capture the winning scores,
$msscore and ssscore capture the number of players whose hand score matched the winning hand, $mstype and
$sstype capture the number of players whose hand type matched the winning hand, $wdeck is the number of wildcards
in the deck before the deal, $wcdeal is the number of wildcards in play after the deal, pnum captures the
players parameter, and $mppct, $sppct and $bppct are used by |
This function is intended to give a sense of how an individual game plays, as well as a way to test that the underlying model is correctly dealing the cards and assigning the best hands to the showdown for each player.
Maintainer: Bradley Shanrock-Solberg [email protected]
poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.
set.seed(52) wpgame("Iron Cross Last Wild", 6, "Deuces") wpgame("Seven Stud Hi-Lo", 4, c("6C", "Suicide King")) wpgame("Low Chicago", 4)
set.seed(52) wpgame("Iron Cross Last Wild", 6, "Deuces") wpgame("Seven Stud Hi-Lo", 4, c("6C", "Suicide King")) wpgame("Low Chicago", 4)
This function presents an array of graphs which indicate how hand types compare for a given wild poker variant.
wpgraphs(gstat, ngame=NULL, players=NULL, wcnum=NULL, stats=FALSE, gtype="Default", split="Vertical")
wpgraphs(gstat, ngame=NULL, players=NULL, wcnum=NULL, stats=FALSE, gtype="Default", split="Vertical")
gstat |
a gstat (graph stats) object generated by the |
ngame |
This is any supported game, such as "Seven Card Stud" or "Baseball". See
|
players |
An integer value, must be at least 2 and is limited by the number of cards that can be physically dealt. (eg, Seven Card Stud has a max of 7 players) |
wcnum |
A standardized set of wildcard combinations, valid values are 0:7.
unlike the wcard parameter in
|
stats |
if TRUE, return the gstat list instead of generating graphs |
gtype |
Controls which graphs are generated:
|
split |
For gtype = "Confidence" or "Hands", controls how split hand graphs behave:
|
This function either accepts input from wpstats
or more typically matches game variant
details (ngame, players, wcnum) to pre-calculated gstat lists. All supported game combinations with
0-7 wildcards and 2-8 players (or less if 8 players aren't possible) have been precalculated.
Precisely what is graphed depends on whether the game has split hands or not, and the graphic device needs a sufficiently large window to show a 4x4 array of graphs with reasonable detail.
if stats = TRUE, prints the gstat list - either gstat parameter, or the precalculated gstat object queried by the ngame, player and wcnum combination.
if stats = FALSE, generates a 4x4 graph array.
Example1 |
Precalculated variant with emergent wildcards and main hand only:
|
Example2 |
Just the Confidence graphs for Example 1:
|
Example3 |
Custom variant with split hand and nonstandard win conditions:
|
Example4 |
Just the Hands Won graph for example 3:
|
This function is the primary point of the wildpoker package, intended to allow a user to rapidly evaluate the way hands change in value as wildcards, players or game variants change.
Maintainer: Bradley Shanrock-Solberg [email protected]
poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.
# These examples show the gstat output option. For the graphs of these examples, # see \bold{value} section, above. # # example of normal wpgraphs use. wpgraphs(ngame = "Follow the Queen", players = 6, wcnum = 1, stats = TRUE) # example of using wpstats to generate a nonstandard combination # note that if a gstat object is provided (by wpstats), the ngame, players, wcnum aren't used wpgraphs(wpstats("High Chicago", 4, "Dr Pepper", numdeal = 10, seed = 100), stats = TRUE)
# These examples show the gstat output option. For the graphs of these examples, # see \bold{value} section, above. # # example of normal wpgraphs use. wpgraphs(ngame = "Follow the Queen", players = 6, wcnum = 1, stats = TRUE) # example of using wpstats to generate a nonstandard combination # note that if a gstat object is provided (by wpstats), the ngame, players, wcnum aren't used wpgraphs(wpstats("High Chicago", 4, "Dr Pepper", numdeal = 10, seed = 100), stats = TRUE)
This data set shows games not supported and brief indications of the enhancements required to add them. Anything involving modeling human behavior (drawing, discarding, bidding, passing) will be much more difficult to add in future than purely rules based variants (like extra hands dealt, win conditions, etc)
wpnotsupported
wpnotsupported
A data frame with rownames describing the game and 2 variables:
rowname = name of the game (ngame parameter, eg, "Pineapple")
[,1] | Issue | chr | Brief description of the issue type |
[,2] | Notes | chr | Brief rules notes touching on game differences |
Issue codes, in rough order of difficulty to add to existing logic
strip = Need to discard cards from deck before dealing
wild logic = additional wildcard logic required
graphs = change scale of grouping logic for graphs
win = Nonstandard Win conditions
fold logic = Fold player hands under some conditions
card steal = steal the best visible card from another player
card bid = choose visible vs no card or blind card logic
discards = introduce discard-only logic
Draw Round = introduce discard and draw logic
card pass = choose card to pass rather than discard
This data set assembled manually based on poker rules
poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.
This function will Print the rules of a single Wild Poker game variant
wprules(ngame)
wprules(ngame)
ngame |
This is any supported game, such as "Seven Card Stud" or "Baseball". See
|
This program displays values from the wpsupportedgames
data frame with formatting
Prints the following output. Note that max players is capped at 8, even if a deck can support more.
GAME : |
ngame parameter (game type and max players in parentheses) |
DEAL : |
cards dealt expressed as hole card, up card or community card - eg Seven Card Stud is "2 hole 4 up 1 hole" |
BETS : |
who leads, ante vs blind bid, betting rounds by card number - eg Seven Card Stud is "ante & high up leads - cards 3 4 5 6 7" |
WILD : |
any wildcards intrinsic to the game - eg Baseball is "3s and 9s" indicating that all 3 and 9 cards are wild |
MAIN : |
Victory conditions for main hand - eg "High - Pair or better to win" |
SPLIT: |
Victory conditions for split hand - eg "None" for no split hand, can be quite odd like "Sum of Spots in 7 card hand" |
NOTES: |
NOTES: any other information about the game or common variants - eg in Baseball you sometimes have to pay for 3s, 4s and 9s |
Maintainer: Bradley Shanrock-Solberg [email protected]
poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.
set.seed(52) wprules("Iron Cross Last Wild") wprules("Seven Stud Hi-Lo") wprules("Low Chicago")
set.seed(52) wprules("Iron Cross Last Wild") wprules("Seven Stud Hi-Lo") wprules("Low Chicago")
This function deals a large number of hands of poker and captures
the game statistics as observations in a "raw" data frame, then summarizes the
results into a "gstat" list, suitable for graphing with the wpgraphs
function.
wpstats(ngame, players, wcards = NULL, numdeal = 1000, seed = 52, raw = FALSE)
wpstats(ngame, players, wcards = NULL, numdeal = 1000, seed = 52, raw = FALSE)
ngame |
This is any supported game, such as "Seven Card Stud" or "Baseball". See
|
players |
An integer value, must be at least 2 and is limited by the number of cards that can be physically dealt. (eg, Seven Card Stud has a max of 7 players) |
wcards |
A vector of string values which are either supported wildcard aliases or individual cards. These cards are in addition to any wildcards that are a natural part of the poker game variant chosen with "ngame". The table below shows the supported aliases and their individual card vector equivalnets:
|
numdeal |
Number of hands to deal, must be positive integer |
seed |
random number seed set at beginning, must be positive integer |
raw |
If TRUE the full "raw" data frame is returned instead of the gstat list |
This program calls the wpgame
function numdeal
times,
generating a raw data frame. This data frame is then consolidated into
a gstat list, whose format depends on ngame
.
if raw is TRUE, returns a rawstat data frame, # of rows = numdeal
[,1] | game | chr | pname parameter |
[,2] | pnum | numeric | players parameter |
[,3] | wild | chr | wcard parameter |
[,4] | mwtype | chr | Winning hand type of Main hand |
[,5] | swtype | chr | Winning hand type of Split hand |
[,6] | mwscore | numeric | score of winning main hand |
[,7] | msscore | numeric | Num players score = winning Main score |
[,8] | mstype | numeric | Num players type = winning Main type |
[,9] | swscore | numeric | score of winning Split hand |
[,10] | ssscore | numeric | Num players score = winning Split score |
[,11] | sstype | numeric | Num players type = winning Split type |
[,12] | mppct | numeric | percent won if Main hand is won |
[,13] | sppct | numeric | percent won if Split hand is won |
[,14] | bppct | numeric | percent won if Both hands are won |
[,15] | wcdeck | numeric | wildcards in deck before the deal |
[,16] | wcdeal | numeric | wildcards in deck after the deal |
if raw is FALSE, returns a gstat list
$game |
a vector of the pname, players and wcards parameters |
$stats |
a vector of the numdeal & seed parameters, and the number of wildcards added to the deck by the wcards parameter |
$pmain |
a table used for graphing win percentage chance of Main hand type by number of players |
$cmain |
a table used for graphing count of winnning Main hand types by number of players |
$wmain |
a table used for graphing count of winning Main hand types by wildcard count |
$psplit |
a table used for graphing win percentage chance of Split hand type by number of players |
$csplit |
a table used for graphing count of winnning Split hand types by number of players |
$wsplit |
a table used for graphing count of winning Split hand types by wildcard count |
$potpct |
a table used for graphing count of percentage of pot won if a hand wins |
This function is intended to allow exposing the raw data behind the pre-calculated results normally used by wpgraphs or to allow running for different random number seeds, number of hands dealt, nonstandard additional wildcards or (when games allow) more than eight players.
It takes about .005 seconds to evaluate each hand - 6 players takes 3 times as long as 2 players, a split hand variant takes twice as long as a variant that has only a main hand. Dealing 1000 rounds of most variants takes a minute or two, but Omaha and Courcheval build hands out of subsets of the player hands, requiring up to 70 separate hand evaluations for each player. This means that 1000 hands of those variants can take a couple of hours to generate.
For this reason, gstat values for all supported game variants have already been calculated for
2-8 players and 0-7 additional wildcards - if interested in any of these standard combinations,
there is no need to call the wpstats
function, wpgraphs
has the required gstat list
already.
Maintainer: Bradley Shanrock-Solberg [email protected]
poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.
# example of the wpstats run to generate raw statistics rawstat <- wpstats("Iron Cross Last Wild", 6, "Deuces", numdeal = 10, raw = TRUE) head(rawstat) # example of wpstats run to generate a gstat object, used by wpgraphs wpstats("Seven Stud Hi-Lo", 4, numdeal = 10, seed = 100)
# example of the wpstats run to generate raw statistics rawstat <- wpstats("Iron Cross Last Wild", 6, "Deuces", numdeal = 10, raw = TRUE) head(rawstat) # example of wpstats run to generate a gstat object, used by wpgraphs wpstats("Seven Stud Hi-Lo", 4, numdeal = 10, seed = 100)
This data set shows all supported games (in the rownames) and a brief description of each game.
For a better formated description of an individual game, use wprules
wpsupportedgames
wpsupportedgames
A data frame with rownames describing the game and 10 variables:
rowname = name of the game(ngame parameter eg, "Seven Stud Hi-Lo")
[,1] | Type | chr | "Community" games have community cards, "Stud" games do not |
[,2] | Main.Hand | chr | Victory Conditions for Main Hand (see below) |
[,3] | Split.Hand | chr | Victory Conditions for Split Hand |
[,4] | Wildcards | chr | Wildcards generated by the game variant |
[,5] | Deal1 | chr | cards dealt in first round (5h1c = 5 hole, 1 community) |
[,6] | Deal2 | chr | cards dealt in second round (1u = 1 upcard, 3c = 3 community) |
[,7] | Deal3 | chr | cards dealt in third round (NA = no such round in this game) |
[,8] | Deal4 | chr | cards dealt in third round (NA = no such round in this game) |
[,9] | Deal5 | chr | cards dealt in third round (NA = no such round in this game) |
[,10] | Misc | chr | notes about the game. A game listed in parentheses is statistically the same. |
Win codes:
HI = High hand wins, no restrictions
HI - Pair = High hand wins if it is at least a pair
HI - Flop1 = There are two sets of community cards. Build with 1st
HI - Flop2 = There are two sets of community cards. Build with 2nd
LO - A-5 = Low hand wins, Ace is low, straights/flushes ignored
LO - A-5 8- = As A-5, but need 8-High or lower to win (usually Hi-Lo)
LO - A-6 = Ace is low, straights/flushes count. Homegame variant.
LO - 2-7 = Ace is high, straights/flushes count
LO - 2-7 9- = As 2-7, but need 8-High or lower to win (usually Hi-Lo)
Poker Hand Value: High Card < Pair < 2-Pair < 3-Kind < Straight < Flush < FullHouse < 4-Kind < StrFlush < 5-Kind
Ace can normally be either high or low, and wildcards substitute for any suit or value unless otherwise specified by the poker variant
Wildcards added by the game are in addition to those added using the wcard parameter in the wpgame or wpstats functions.
Minor variants can be created by adding wildcards. As an example my group used to play "Dangerous Queens" which was Follow the Queen with Suicide King and One Eyed Jacks wild (the idea being that the wilcards already followed the queens earlier and were wild, but damaged by the experience)
Dangerous Queens would be specified in wpgame or wpstats as:
ngame = "Follow the Queen", wcards = c("Suicide King", "One Eyed Jacks") or alternately wcards = c("KH", "JH", "JS")
If using wpgraphs directly, Dangerous Queens would use the number of added wildcards instead of specifying the wildcards:
ngame = "Follow the Queen", wcards =3
This data set assembled manually from poker rules
poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.