## Projects are due by email ## to frederic@stat.ucla.edu . ## Rules: ## a) We will run several tournaments. ## Each will have 3 winners, with payouts of 13,8, and 5. ## b) Start with 1000 chips each, and blinds of 10 and 20. ## c) Small blind = 1/2 big blind (rounded to nearest integer). ## d) Blinds last 10 hands, then increase by 50 percent. (rounded) ## 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 } ## end of tommy ursula = 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] >= 9)) a1 = mychips1 a1 } ## end of ursula william = function (numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft) { 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)) { u = runif(1) if (u < 0.4) a1 = mychips1 if (u >= 0.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 } vegetablesharpener = function (numattable1, crds1, board1, round1, currentbet, mychips1, pot1, roundbets, blinds1, chips1, ind1, dealer1, tablesleft){ a1 = 0 difference = crds1[1,1] - crds1[2,1] if (crds1[1, 1] == crds1[2, 1]) a1 = mychips1 if (crds1[1,1] >= 11) a1 = mychips1 if (crds1[1, 2] == crds1[2, 2] && crds1[1,1] > 10 && difference == 1) a1 = mychips1 if (crds1[1, 2] == crds1[2, 2] && difference == 1 && runif(1) > 0.5) a1 = mychips1 if (crds1[1, 2] == crds1[2, 2] && runif(1) > 0.7) a1 = mychips1 if (runif(1) > 0.80) a1 = mychips1 if(mychips1 >= 2 * blinds1) { if ((crds1[1, 2] == crds1[2,2]) && (difference == 1) && (runif(1)>0.2)) a1 = mychips1 if (crds1[1, 2] == crds1[2, 2] && runif(1) > 0.8) a1 = mychips1 if (crds1[1,1] >= 11 && runif(1) > 0.2) a1 = mychips1 if (crds1[1,1] >= 13) a1 = mychips1 if (runif(1) > 0.9) a1 = mychips1 } a1 } ## MAKE TEAMS: x = c("chung", "louis", "youssouf", "timothy", "logan", "emily", "arjun", "james", "jongin", "riley", "jason", "jack", "liam", "jacob", "chad", "victoria", "susan") n = length(x) teams = function(){ y = x[sample(n)] for(i in 1:(n/2)){ cat("\n", i, y[(2*i-1):(2*i)]," ") } cat(y[n]) } teams() 1 youssouf emily 2 logan timothy 3 chung liam 4 jack riley 5 victoria arjun 6 james jason 7 louis jacob 8 chad susan jongin install.packages("holdem") library(holdem) name1 = c("gravity","tommy","ursula","timemachine","vera","william","xena") decision1 = list(gravity, tommy, ursula, timemachine, vera, william, xena) tourn1(name1, decision1, myfast1 = 2) ## run quickly name1 = c("gravity","tommy","ursula","vera") decision1 = list(gravity, tommy, ursula,vera) tourn1(name1, decision1, myfast1 = 0) ## run slowly