# deal1: Deals the cards. In holdem: Texas Holdem Simulator

## Description

Deals cards to the different players, and also deals the board to come. Used by tourn1().

## Usage

 `1` ```deal1(numpl) ```

## Arguments

 `numpl` number of players at the table.

## Details

Each player's cards will be *ordered*, so that the number of your 1st card is at least as big as the number of your 2nd card.

## Value

 `plnum1 ` vector of numbers (2=2, 3=3, ..., 13 = king, 14 = ace) of the players' cards. `plsuit1` vector of suits (1-4) of the players' cards. `brdnum1 ` vector of numbers (2-14) of the 5 board cards. `brdsuit1` vector of suits (1-4) of the board cards.

## Author(s)

Frederic Paik Schoenberg

## References

Schoenberg, F. (2011). An Introduction to Probability with Texas Holdem Examples. Taylor and Francis, New York.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42``` ```## 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) ##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function(numpl){ ## numpl is the number of players at the table numcards = 2*numpl+5 crds1 = order(runif(52))[1:numcards] crds2 = switch2(crds1) num1 = crds2\$num suit1 = crds2\$st brdnum1 = num1[(numcards-4):numcards] brdsuit1 = suit1[(numcards-4):numcards] plnum1 = matrix(num1[1:(2*numpl)],ncol=2) plsuit1 = matrix(suit1[1:(2*numpl)],ncol=2) ## order them for(i in c(1:numpl)){ if(plnum1[i,1]

holdem documentation built on May 2, 2019, 9:21 a.m.