tommy: A sample function that goes all in or folds

Description Usage Arguments Details Value References Examples

View source: R/tommy.R

Description

Goes all in with any pocket pair

Usage

1
2
tommy(numattable1, crds1, board1, round1, currentbet, mychips1, 
pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft)

Arguments

numattable1

(integer) number of players at the table

crds1

(2x2 matrix) your hole cards. cards1[1,1] = the number of card 1 (between 2 and 14). cards[1,2] = suit of card 1 (between 1 and 4). cards1[2,1] = the number (2-14) of card 2. cards[2,2] = suit of card 2 (1-4).

board1

(5x2 matrix) the board cards. board1[1,1] = number of first card (2-14). board1[1,2] = suit (1-4) of first card. Both are zero if the card hasn't been seen yet. For instance, if bettinground1 < 3, then board[4,1] = board1[4,2] = 0.

round1

(integer) which betting round it is. 1 = preflop, 2 = after flop, 3 = after turn, 4 = after river.

currentbet

(integer) how much more it is to you to stay in, right now.

mychips1

(integer) how many chips you have left at the moment.

pot1

(integer) how much is in the pot at the moment.

roundbets

(numattable1 x 4 matrix) matrix of all past bets during this hand. roundbets[i,j] = total amount the player in seat i put in, in betting round j.

blinds1

(integer) big blind amount.

chips1

(vector of length numattable1) list of how many chips everyone has. chips1[i] = how many chips the player in seat i has left.

ind1

(integer) which seat you're in. (So, mychips1 = chips1[ind1]).

dealer1

(integer) which seat the dealer is in.

tablesleft

(integer) how many tables are left in the tournament (including yours).

Details

When this function is called from tourn1(), cards1[2,1] is always less than or equal to cards1[1,1]. If the player in the big blind seat does not have enough chips to pay the big blind, then blinds1 is still the amount that the big blind would have been. If only 2 players are left, then tourn1() uses the convention that the "dealer" is the big blind in determining dealer1.

Value

integer indicating the number of chips you are betting. 0 means fold.

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
##---- 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(numattable1, crds1, board1,  round1, currentbet, mychips1, 
    pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){
    ## all in with any pair.
    a1 = 0
    if(crds1[1,1] == crds1[2,1]) a1 = mychips1
    a1
  } ## end of tommy

Example output

function (numattable1, crds1, board1, round1, currentbet, mychips1, 
    pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft) 
{
    a1 = 0
    if (crds1[1, 1] == crds1[2, 1]) 
        a1 = mychips1
    a1
}

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