## MAKE TEAMS: x = c("") n = length(x) # name1 = as.character(1:floor(n/2)) name1 = rep("0",n/2) for(i in 1:(n/2)) name1[i] = intToUtf8(96+i) teams = function(){ y = x[sample(n)] for(i in 1:length(name1)){ cat("\n", "team", name1[i], y[(2*i-1)], ". ", y[(2*i)], ". ") } } teams() ## EXAMPLES:, install.packages("holdem") library(holdem) tommy ursula vera william xena Iveybruin = function (numattable, cards, board, round, currentbet, mychips, pot, roundbets, blinds, chips, ind, dealer, tablesleft) { ## all in with any 9 pair or higher, or if lower card is 10 or higher, ## or if I have less than 3 times the big blind a = 0 if ((cards[1, 1] == cards[2, 1]) && (cards[1, 1] >= 9)) a = mychips if (cards[2,1] > 9.5) a = mychips if(mychips < 3*blinds) a = mychips a } ## end of Iveybruin allinSAK = function (numattable, cards, board, round, currentbet, mychips, pot, roundbets, blinds, chips, ind, dealer, tablesleft) { #all in with any pair, lower card 10 or higher, or have an A #all in if chips less than 3 times the blind a=0 if (cards[1, 1] == cards[2, 1]) a = mychips if (cards[2, 1] > 9.5) a = mychips if (cards[1,1] == 14) a = mychips if(mychips < 3*blinds) a = mychips a } INPUTS. numattable (ignore). Number of players at your table. cards. 2 x 2 matrix indicating your cards. cards[1,1] = number of your higher card, as an integer from 2-14. cards[2,1] = number of your lower card. cards[1,2] = an integer 1-4 indicating the suit of your higher card. cards[2,2] = integer 1-4 indicating the suit of your lower card. board (ignore). Vector of board cards. round (ignore). Index indicating betting round. currentbet. The largest amount bet so far this betting round of this hand. mychips. The number of chips you have. pot. The number of chips in the pot. roundbets (ignore). A list indicating all previous bets in previous betting rounds and current betting round. blinds. The amount of the big blind. chips. A vector indicating how many chips each player has at your table. ind. The index, 1-10, of which seat you are in. dealer. The index, 1-10, of which seat is the dealer. tablesleft (ignore). The number of tables remaining in the tournament. poker = function(numattable, cards, board, round, currentbet, mychips, pot, roundbets, blinds, chips, ind, dealer, tablesleft){ a = 0 # all in with pocket pair of Jacks, Queens, Kings, or Aces, or AK of any suits if((cards[1,1] == cards[2,1]) && (cards[1,1] >= 11)) a = mychips if((cards[1,1] == 14) && (cards[2,1] == 13)) a = mychips # all in with AQ, AJ, KQ if same suit and no one else is all in yet if(currentbet <= blinds){ if((cards[1,1] == 14) && (cards[2,1] >= 11) && (cards[1,2] == cards[2,2])) a = mychips if((cards[1,1] == 13) && (cards[2,1] == 12) && (cards[1,2] == cards[2,2])) a = mychips } # all in with any pocket pair if only 1-2 players left to play and nobody is all in yet big.blind = dealer + 2 if(big.blind > numattable) big.blind <- big.blind - numattable players.left = big.blind - ind if(players.left < 0) players.left = players.left + numattable ## the 4 lines above make it so players.left = how many players haven't acted yet. if(currentbet <= blinds){ if((players.left <= 2) && (cards[1,1] == cards[2,1])) a = mychips } a }