Learn R Programming

wildpoker (version 1.1)

wpstats: Deal Many Hands of a Wild Poker Variant Game

Description

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.

Usage

wpstats(ngame, players, wcards = NULL, numdeal = 1000, seed = 52, raw = FALSE)

Arguments

ngame
This is any supported game, such as "Seven Card Stud" or "Baseball". See wpsupportedgames.
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:
  • "Suicide King" or "KH"
  • "One Eyed Jacks" or c("JH", "JS")
  • "Deuces" or c("2H", "2C", "2D", "2S")
  • "Heinz 57" or c("5H", "5C", "5D", "5S", "7H", "7C", "7D", "7S")
  • "Pregnant Threes" or c("3H", "3C", "3D", "3S", "6H", "6C", "6D", "6S", "9H", "9C", "9D", "9S")
  • "Dr Pepper" or c("2H", "2C", "2D", "2S", "4H", "4C", "4D", "4S", "10H", "10C", "10D", "10S")
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

Value

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 [,1] game
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

Details

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.

References

poker.com has an excellent reference on game variants which was the primary source for games rules not encountered in my own play.

See Also

wpgame, wpgraphs

Examples

Run this code
# 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)


Run the code above in your browser using DataLab