# basketball shots per game # 72% free throw shooter, 8 shots per game # 45% 2 point shooter, 15 per game # 34% 3 point shooter, 7 per game games <- 24 # number of games i <- 0; gametot <- 0 # initialize counters while (i <= games) { free <- c(rbinom(8, size=1, prob=.72)) two <- c(rbinom(15, size=1, prob=.45)) three <- c(rbinom(7, size=1, prob=.34)) gametot <- gametot + sum(free)*1 + sum(two)*2 + sum(three)*3 i <- i + 1 } print("Below is sample points of the last game simulation") cat("freethrows =", free, "twopoints =", two, "threepoints =", three, "\n") cat(gametot/games, "points per game made on average", "\n")