## Projects are due by email to me, on Friday, Feb 27, 11:00pm. ## Rules. ## a) We will run several tournaments. ## Each will have 3 winners, with payouts of 13,8, and 5. ## b) Start with 1500 chips each, and blinds of 50 and 100. ## c) Small blind = 1/2 big blind (rounded to nearest integer). ## d) Blinds last 10 hands, then increase by 50 percent. (rounded) ## e) Prizes include deck of cards, cookies, highlighter. ## Highest finisher gets first choice, 2nd gets 2nd choice, etc. ## Examples: tommy = 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 } ## tommy ursula = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ ## if AA, then all in. ## if you only have less than 3 times the big blind, then all in. ## if nobody's gone all in yet and you have less than 10 big blinds, then go all in. ## if a pair of 8s or higher, and less than 6 players at table, then all in. ## if suited cards, then all in with 25% prob. a1 = 0 if(crds1[2,1] == 14) a1 = mychips1 if(mychips1 < 3*blinds1) a1 = mychips1 if((currentbet == blinds1) && (mychips1 < 10*blinds1)) a1 = mychips1 if((crds1[1,1] == crds1[2,1]) && (crds1[1,1] > 7.5) && (numattable1<6)) a1 = mychips1 if((crds1[1,2] == crds1[2,2]) && (runif(1) < 0.25)) a1 = mychips1 a1 } ## end of ursula ## MAKE TEAMS: x = c("azsa","cannon","diana","dimitra", "edwin","ian","jamesB","jamesE", "kevin", "lillian","marco","matan", "neal","ryanJ","ryanT","ryanandre", "stephanie","steven","van") n = length(x) name1 = c("a","b","c","d","e","f","g","h","i") teams = function(){ y = x[sample(n)] for(i in 1:(n/2)){ cat("\n", name1[i], y[(2*i-1):(2*i)]) } cat(" ",y[n]) } teams() a kevin ian b diana stephanie c dimitra van d jamesE ryanandre e jamesB steven f marco ryanT g cannon edwin h ryanJ matan i azsa neal lillian ## More examples: william = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ ## if you only have less than 3 times the big blind, then all in. ## if AA, then all in. ## if T9, then all in with 40% prob. ## if nobody's gone all in yet, then go all in. ## if KK or QQ, and less than 10 players at table, then all in. a1 = 0 if(mychips1 < 3*blinds1) a1 = mychips1 if((crds1[1,1] == 14) && (crds1[2,1] == 14)) a1 = mychips1 if((crds1[1,1] == 10) && (crds1[2,1] == 9)){ u1 = runif(1) if(u1 < .4) a1 = mychips1 if(u1 > .4) a1 = 0 } if(currentbet == blinds1) a1 = mychips1 if((crds1[1,1] == crds1[2,1]) && (crds1[1,1] > 11.5) && (numattable1<10)) a1 = mychips1 a1 } ## end of william xena = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ ## if pair of 10s or higher, all in for sure, no matter what. ## if AK or AQ, all in with probability 75%. ## if pair of 7s or higher and there are 6 or fewer players ## at your table (including you), then all in. ## if your chip count is less than twice the big blind, go all in with any cards. ## if nobody's raised yet: ## ... and if there are 3 or fewer players left behind you, ## then go all in with any pair or any ace. ## ... and there's only 1 or 2 players behind you, ## then go all in with any cards. a1 = 0 x = runif(1) ## x is a random number between 0 and 1. y = max(roundbets[,1]) ## y is the maximum bet so far. big1 = dealer1 + 2 if(big1 > numattable1) big1 = big1 - numattable1 z = big1 - ind1 if(z<0) z = z + numattable1 ## the previous 4 lines make it so z is the number of players left to act behind you. if((crds1[1,1] == crds1[2,1]) && (crds1[2,1] > 9.5)) a1 = mychips1 if((crds1[1,1] == 14) && (crds1[1,2]>11.5) && (x<.75)) a1 = mychips1 if((crds1[1,1] == crds1[2,1]) && (crds1[2,1] > 6.5) && (numattable1 < 6.5)) a1 = mychips1 if(mychips1 < 2*blinds1) a1 = mychips1 if(y <= blinds1){ if((z < 3.5) && ((crds1[1,1] == crds1[2,1]) || (crds1[1,1] == 14))) a1 = mychips1 if(z < 2.5) a1 = mychips1 } a1 } ## end of xena