Description Details Author(s) References Examples
This package can be used to simulate hands of Texas Holdem and can run Texas Holdem tournaments.
Package: | holdem |
Type: | Package |
Version: | 1.0 |
Date: | 2011-06-15 |
License: | What license is it under? |
LazyLoad: | yes |
The most important functions are tourn1(), many1(), deal1(), and handeval(). tourn1() playes a Texas Hold'em tournament between different functions which can bet arbitrary amounts depending on their cards, chips, blinds, etc. many1() plays multiple tournaments and stores the payouts for each player. deal1() deals an individual hand of Texas Hold'em. handeval() figures out who won the hand, when more than one player remains and all the cards are shown.
Frederic Paik Schoenberg
Maintainer: Frederic Paik Schoenberg <frederic@stat.ucla.edu>
Schoenberg, F. (2011). An Introduction to Probability with Texas Holdem Examples. Taylor and Francis, New York.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## out of 1000 hands with 2 players, see how many times
## both players get at least a straight, if neither ever folds.
n = 1000
result = rep(0,n)
for(i in 1:n){
x1 = deal1(2)
b1 = handeval(c(x1$plnum1[1,],x1$brdnum1), c(x1$plsuit1[1,],x1$brdsuit1))
b2 = handeval(c(x1$plnum1[2,],x1$brdnum1), c(x1$plsuit1[2,],x1$brdsuit1))
if(min(b1,b2) > 4000000) result[i] = 1
}
sum(result>.5)
## run a Texas Hold'em tournament between
## 4 players with different strategies, where
## each always goes all in or folds.
name1 = c("gravity","tommy","ursula","vera")
decision1 = list(gravity, tommy, ursula, vera)
tourn1(name1, decision1, myfast1 = 2) ## run quickly
tourn1(name1, decision1, myfast1 = 0) ## run slowly, showing key hands
|
[1] 21
Big blind is 20
1234
Big blind is 30
1234
Big blind is 45
1234
Big blind is 68
1234
Big blind is 102
12
Eliminated: 4 ..... 3 players remaining.
34
Big blind is 153
1234
Big blind is 230
1234
Big blind is 345
1234
Big blind is 518
1234
Big blind is 777
1234
Big blind is 1166
1234
Big blind is 1749
12
Eliminated: 3 ..... 2 players remaining.
34
Big blind is 2624
1
Eliminated: 2 ..... 1 players remaining.
[1] 1 2 3
Big blind is 20
1234
Big blind is 30
1234
Big blind is 45
1234
Big blind is 68
1234
Big blind is 102
1
Eliminated: 4 ..... 3 players remaining.
234
Big blind is 153
1234
Big blind is 230
1234
Big blind is 345
1234
Big blind is 518
1234
Big blind is 777
1234
Big blind is 1166
12
Eliminated: 3 ..... 2 players remaining.
34
Big blind is 1749
12
Eliminated: 1 ..... 1 players remaining.
[1] 2 1 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.