x = c("jamie", "wai man", "max", "howard", "katie", "ryan", "celestine", "matthew", "rachel", "guru", "felix", "julie", "morad", "kunal", "andrew", "john", "aaron", "karl", "brett", "josie") n = length(x) runif(1) name1 = c("a","b","c","d","e","f","g","h","i", "j") teams = function(){ y = x[sample(n)] for(i in 1:10){ cat("\n", name1[i], y[(2*i-1):(2*i)]) } } teams() # alien felix morad # breezwagon andrew aaron # crazychris karl jamie # d julie matthew mike # eliminator ryan howard # foker max john # gameboy kunal celestine # hatchet rachel brett # ice guru josie # joker wai man katie # Due by 5pm by email on Tuesday Nov 28, to frederic@stat.ucla.edu. xena = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ ## if any pair, suited anything, or if the smaller card is at least 9, then all in a1 = 0 if((crds1[1,1] == crds1[2,1]) || (crds1[1,2] == crds1[2,2]) || (crds1[2,1] > 8.5)) a1 = mychips1 a1 } ## end of xena yolanda = function(numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ ## if pair of 9s or better, then all in a1 = 0 if((crds1[1,1] == crds1[2,1]) && (crds1[2,1] > 8.5)) a1 = mychips1 a1 } ## end of yolanda zorro = 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 zorro whale = 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 whale