## what can they use? ## 1) number of players at table ## 2) their cards ## 3) board ## 4) betting round ## 5) current bet (amount to them) ## 6) chips they have left at the moment ## 7) pot ## 8) history of total betting for each player in each round ## 9) big blind ## 10) tablechips ## 11) which seat they're in ## 12) who's the dealer ## 13) how many tables are left in the tournament ## 1) numattable1. integer. ## number of players at the table ## ## 2) cards1. 2x2 matrix. ## cards1[1,1] = the number of card 1 (between 2 and 14). cards[1,2] = suit of card 1 (a number between 1 and 4). ## cards1[2,1] = the number (2-14) of card 2. cards[2,2] = suit of card 2 (1-4). Ace = 14. ## ## 3) board1. 5x2 matrix. ## 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. ## ## 4) round1. integer. ## 1 = preflop, 2 = after flop, 3 = after turn, 4 = after river. ## ## 5) currentbet. integer. ## how much MORE it is to you to stay in, right now. ## ## 6) mychips1. integer. ## how many chips you have left at the moment. ## ## 7) pot1. integer. ## how much is in the pot at the moment. ## ## 8) roundbets. numattable1 x 4 matrix. ## roundbets[i,j] = total amount the player in seat i put in, in betting round j. ## ## 9) blinds1. integer. ## big blind amount. (regardless of whether the player in the big blind can afford it). ## ## 10) chips1. vector of length numattable1. ## chips1[i] = how many chips the player in seat i has left. ## ## 11) ind1. integer. ## Which seat you're in. (So, mychips1 = chips1[ind1]). ## ## 12) dealer1. integer. ## Which seat the dealer is in. ## (If only 2 players are left, then I use the convention that the "dealer" is the big blind.) ## ## 13) tablesleft. integer. ## How many tables are left in the tournament (including yours). yosef = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ ## if pair of at least 9, then all in ## if nobody's bet (or raised the blinds) yet, then bet (or raise the blinds) the minimum amount possible. ## note: if you're big blind, or if you've already called, then ## those cases have to be handled separately, since for instance if ## someone's raised you exactly one more big blind, then you should fold, but it will look like ## nobody's raised yet since it'll again be one big blind to you. a1 = 0 bigb = dealer1 + 2 if(bigb > numattable1) bigb = bigb - numattable1 if(round1 == 1){ if((roundbets[ind1,1] < blinds1 - .5) && (currentbet < blinds1+.5)){ a1 = min(2*blinds1, mychips1) } else if ((ind1 == bigb) && (currentbet < blinds1 - .5)) a1 = min(blinds1, mychips1) } if((round1 > 1.5) && (currentbet < .5)) a1 = min(blinds1, mychips1) if((crds1[1,1] == crds1[2,1]) && (crds1[2,1] > 8.5)) a1 = mychips1 a1 } ## end of yosef zelda = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ a1 = 0 ## how much I'm gonna end up betting. Note that the default is zero. a2 = min(mychips1, currentbet) ## how much it costs to call if(round1 == 1){ ## pre-flop: ## AK: Make a big raise if nobody has yet. Otherwise call. ## AQ: call a small raise, or make one if nobody has yet. ## AJ, AT, KQ, KJ, QJ: call a tiny raise. ## A9, KT, K9, QT, JT, T9: call a tiny raise if in late position (within 2 of the dealer). ## Suited A2-AJ: call a small raise. ## 22-99: call a small raise. ## TT-KK: make a huge raise. If someone's raised huge already, then go all in. ## AA: make a small raise. If there's been a raise already, then double how much it is to you. a3 = 2*blinds1+1 ## how much a tiny raise would be a4 = 4*blinds1+1 ## how much a small raise would be a5 = max(8*blinds1,mychips1/4)+1 ## how much a big raise would be a6 = max(12*blinds1,mychips1/2)+1 ## how much a huge raise would be a7 = dealer1 - ind1 if(a7 < -.5) a7 = a7 + numattable1 ## your position: a7 = how many hands til you're dealer if((crds1[1,1] == 14) && (crds1[2,1] == 13)){ a1 = max(a2,a5) } if((crds1[1,1] == 14) && (crds1[2,1] == 12)){ if(a2 < a4){ a1 = a4 } else if(a2 > a5){ a1 = 0 } else a1 = a2 } if(((crds1[1,1] == 14) && ((crds1[2,1] < 11.5) && (crds1[2,1] > 9.5))) || ((crds1[1,1] == 13) && (crds1[2,1] > 10.5)) || ((crds1[1,1] == 12) && (crds1[2,1] == 11))){ if(a2 < a3) a1 = a2 } if(((crds1[1,1] == 14) && (crds1[2,1] == 9)) || ((crds1[1,1] == 13) && ((crds1[2,1] == 10) || (crds1[2,1] == 9))) || ((crds1[1,1] == 12) && (crds1[2,1] == 10)) || ((crds1[1,1] == 11) && (crds1[2,1] == 10)) || ((crds1[1,1] == 10) && (crds1[2,2] == 9))){ if((a2 < a3) && (a7<2.5)) a1 = a2 } if((crds1[1,2] == crds1[2,2]) && (crds1[1,1] == 14) && (crds1[2,1] < 11.5)){ if(a2 1000000) && (x < 3000000)){ if(a2 < a6) a1 = a2 } else if((x1 > 3000000) && (x < 6000000)){ if(a2 < a6) a1 = a2 } else if(x > 1000000 + 15^3*topcard1){ a1 = max(a5,a2) } else if((a2 < a6) && ((a7 < .20) || ((a7 < .50) && (a11>1)))){ a1 = a6 } if((y == 4) || (z == 4)) a1 = max(a6, a2) if(x > 4000000) a1 = a2 } if(round1 == 3){ ## after turn: ## If there's a pair on the board and you don't have a set, then check/call up to small bet. ## Same thing if there's 3-of-a-kind on the board and you don't have a full house or more. ## Otherwise, if you have top pair or better, go all in. ## If you had top pair or overpair but now don't, then check/call a medium bet but fold to more. ## If you have an inside straight draw or flush draw then check/call a medium bet as well. ## Otherwise check/fold. a6 = min(1/3*sum(roundbets[,1:2]),mychips1) ## small bet (1/3 of prev round's pot size) a5 = min(.75*sum(roundbets[,1:2]),mychips1) ## medium bet (3/4 of prev round's pot size) x = handeval(c(crds1[1:2,1], board1[1:4,1]), c(crds1[1:2,2], board1[1:4,2])) ## what you have x1 = handeval(c(board1[1:4,1]),c(board1[1:4,2])) ## what's on the board y = straightdraw1(c(crds1[1:2,1], board1[1:4,1])) z = flushdraw1(c(crds1[1:2,2], board1[1:4,2])) topcard1 = max(board1[1:4,1]) oldtopcard1 = max(board1[1:3,1]) if((x1 > 1000000) && (x < 3000000)){ if(a2 < a6) a1 = a2 } else if((x1 > 3000000) && (x < 6000000)){ if(a2 < a6) a1 = a2 } else if(x > 1000000 + 15^3*topcard1){ a1 = mychips1 } else if(x > 1000000 + 15^3*oldtopcard1){ if(a2 < a5) a1 = a2 } else if((y == 4) || (z == 4)){ if(a2 < a5) a1 = a2 } } if(round1 == 4){ ## after river: ## If there's a pair on the board and you don't have a set, then check/call up to small bet. ## Same thing if there's 3-of-a-kind on the board and you don't have a full house or more. ## Otherwise, if you have two pairs or better, go all in. ## If you have one pair, then check/call a small bet. ## With nothing, go all-in with probability 10%; otherwise check/fold. a6 = .45+runif(1)/10 ## random number between .45 and .55 a5 = min(a6*sum(roundbets[,1:3]),mychips1) ## small bet: around 1/2 of pot size; VARIES RANDOMLY x = handeval(c(crds1[1:2,1], board1[1:5,1]), c(crds1[1:2,2], board1[1:5,2])) x1 = handeval(c(board1[1:5,1]),c(board1[1:5,2])) ## what's on the board if((x1 > 1000000) && (x < 3000000)){ if(a2 < a5) a1 = a2 } else if((x1 > 3000000) && (x < 6000000)){ if(a2 < a5) a1 = a2 } else if(x > 2000000){ a1 = mychips1 } else if(x > 1000000){ if(a2 < a5) a1 = a2 } else if(runif(1)<.10){ a1 = mychips1 } } round(a1) } ## end of zelda CallingStation = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ a1 = 0 ## how much I'm going to end up betting. Note that the default is zero. a2 = min(mychips1, currentbet) ## how much it costs to call if(round1 == 1){ ## pre-flop: ## AK: Make a big raise if nobody has yet. Call any raise. ## AQ, AJ: call a small raise, or make one if nobody has yet. ## AT, KQ, KJ, QJ, KT, QT, JT: make big raise if in late position (within 3 of dealer). Otherwise fold ## A9, K9, K8, Q9, J9, T9, 98, 87: call a tiny raise if in late position (within 3 of the dealer). ## Suited A2-AJ: call a small raise. ## 22-99: call a small raise, if in late position (within 2 of dealer then go all in). ## TT-KK: make a huge raise. If someone's raised huge already, then go all in. ## AA: make a big raise. If there's been a raise already, then go all in. a3 = 2*blinds1+1 ## how much a tiny raise would be a4 = 4*blinds1+1 ## how much a small raise would be a5 = max(8*blinds1,mychips1/4)+1 ## how much a big raise would be a6 = max(12*blinds1,mychips1/2)+1 ## how much a huge raise would be a7 = dealer1 - ind1 if(a7 < -.5) a7 = a7 + numattable1 ## your position: a7 = how many hands til you're dealer if((crds1[1,1] == 14) && (crds1[2,1] == 13)){ a1 = max(a2,a5) } if(((crds1[1,1] == 14) && (crds1[2,1] > 10.5)) && (crds1[2,1] < 12.5)){ if(a2 < a4){ a1 = a4 } else if(a2 > a5){ a1 = 0 } else a1 = a2 } if(((crds1[1,1] == 14) && (crds1[2,1] == 10)) || ((crds1[1,1] == 13) && (crds1[2,1] == 12) && (crds1[2,1] == 11)) || ((crds1[1,1] == 12) && (crds1[2,1] == 11) && (crds1[2,1] == 10)) || ((crds1[1,1] == 11) && (crds1[2,1] == 10))){ if(a2 < a3) a1 = a2 } if(((crds1[1,1] == 14) && (crds1[2,1] == 9))|| ((crds1[1,1] == 13) && ((crds1[2,1] == 9) || (crds1[2,1] == 8)))|| ((crds1[1,1] == 12) && (crds1[2,1] == 9)) || ((crds1[1,1] == 11) && (crds1[2,1] == 9)) || ((crds1[1,1] == 10) && (crds1[2,1] == 9))|| ((crds1[1,1] == 9) && (crds1[2,1] == 8)) || ((crds1[1,1] == 8) && (crds1[2,1] == 7))){ if((a2 < a3) && (a7<3.5)) a1 = max(a2,a5) } if((crds1[1,2] == crds1[2,2]) && (crds1[1,1] == 14) && (crds1[2,1] < 11.5)){ if(a2 13.5){ if(a2 1000000) && (x < 3000000)){ if(a2 < a5) a1 = a2 } else if((x1 > 3000000) && (x < 6000000)){ if(a2 < a6) a1 = a6 } else if(x > 1000000 + 15^3*topcard1){ if(a2 < 0.5) a1 = 0 if(a2 > 0.5) a1 = mychips1 } else if((a2 < a6) && ((a7 < .33) || ((a7 < .67) && (a11>1)))){ a1 = a6 } if((y == 4) || (z == 4)) a1 = mychips1 if(x > 4000000) a1 = 2*a2 } if(round1 == 3){ ## after turn: ## If there's a pair on the board and you don't have a set, then make medium bet. ## All in if there's 3-of-a-kind on the board and you don't have a full house or more. ## Otherwise, if you have top pair or better, medium bet. ## If you had top pair or overpair but now don't, then check/call a small bet but fold to more. ## If you have an inside straight draw or flush draw then check/call a medium bet as well. ## Otherwise check/fold. a6 = min(1/3*sum(roundbets[,1:2]),mychips1) ## small bet (1/3 of prev round's pot size) a5 = min(.75*sum(roundbets[,1:2]),mychips1) ## medium bet (3/4 of prev round's pot size) x = handeval(c(crds1[1:2,1], board1[1:4,1]), c(crds1[1:2,2], board1[1:4,2])) ## what you have x1 = handeval(c(board1[1:4,1]),c(board1[1:4,2])) ## what's on the board y = straightdraw1(c(crds1[1:2,1], board1[1:4,1])) z = flushdraw1(c(crds1[1:2,2], board1[1:4,2])) topcard1 = max(board1[1:4,1]) oldtopcard1 = max(board1[1:3,1]) if((x1 > 1000000) && (x < 3000000)){ if(a2 < a6) a1 = a5 } else if((x1 > 3000000) && (x < 6000000)){ a1 = mychips1 } else if(x > 1000000 + 15^3*topcard1){ a1 = a5 } else if(x > 1000000 + 15^3*oldtopcard1){ if(a2 < a6) a1 = a2 } else if((y == 4) || (z == 4)){ if(a2 < a5) a1 = a2 } } if(round1 == 4){ ## after river: ## If there's a pair on the board and you don't have a set, then check/call up to small bet. ## Bet medium if there's 3-of-a-kind on the board and you don't have a full house or more. ## Otherwise, if you have two pairs or better, go all in. ## If you have one pair, then check/call medium bet. ## With nothing, go all-in with probability 7.5%; otherwise check/fold. a6 = .45+runif(1)/10 ## random number between .45 and .55 a5 = min(a6*sum(roundbets[,1:3]),mychips1) ## small bet: around 1/2 of pot size; VARIES RANDOMLY x = handeval(c(crds1[1:2,1], board1[1:5,1]), c(crds1[1:2,2], board1[1:5,2])) x1 = handeval(c(board1[1:5,1]),c(board1[1:5,2])) ## what's on the board if((x1 > 1000000) && (x < 3000000)){ if(a2 < a5) a1 = a2 } else if((x1 > 3000000) && (x < 6000000)){ if(a2 < a5) a1 = a5 } else if(x > 2000000){ a1 = mychips1 } else if(x > 1000000){ if(a2 < mychips1) a1 = a2 } else if(runif(1)<.075){ a1 = mychips1 } } round(a1) } ## end CallingStation