# switch2: Finds the cards corresponding to numbers between 1 and 52. In holdem: Texas Holdem Simulator

## Description

Takes each integer between 1 and 52 and turns it into a card. Used in deal1() and tourn1().

## Usage

 `1` ```switch2(x) ```

## Arguments

 `x` a vector of integers between 1 and 52.

## Value

 `num ` numbers (2-14) of the cards `st ` suits (1-4) of the cards

## Author(s)

Frederic Paik Schoenberg

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```##---- 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(x){ ## takes a number 1-52, and turns it into a card: ## returns a list, where the 1st is the number (2-14), and 2nd is suit (1-4). n = length(x) y = list(num=x, st=rep(1,n)) for(i in c(1:n)){ a = 1 while(a>0){ if(y\$num[i]<14) a = -1 else{y\$st[i] = y\$st[i]+1 y\$num[i] = y\$num[i]-13 } } } y\$num = y\$num+1 y } ## end of switch2 ```

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