1.Create a simulation in R replicating a single Risk battle to the death using the below playing styles (defined in the next section); do not consider a combination of playing styles.
•Standard•Annoying (my brother’s)•Why do that (also my brother’s)2.Conduct multiple simulation runs varying the starting force level for each player to assess sensitivity.3.Choose a perspective (attacker or defender) and analyze the results to recommend:•The best playing style, i.e. most likely to win, for that player.•The playing style that the player prefers the opponent to use.4.Support your results with visualization.5.Submit a two-page maximum EXSUM (requirements below).
https://drive.google.com/drive/u/0/folders/1OyO7SWbBrB8muLPvXAcu7xxQWgUrtJ5l
Risk Project Risk Project 30 points Risk Simulation My brother and I play the board game Risk all the time. Recently he’s decided to use a very annoying playing technique and refuses to listen when I tell him its a bad idea. Help me correct this behavior with some quantitative data, defensible analysis, and a pretty picture even his non-math brain can understand. Assignment 1. Create a simulation in R replicating a single Risk battle to the death using the below playing styles (defined in the next section); do not consider a combination of playing styles. • Standard • Annoying (my brother’s) • Why do that (also my brother’s) 2. Conduct multiple simulation runs varying the starting force level for each player to assess sensitivity. 3. Choose a perspective (attacker or defender) and analyze the results to recommend: • The best playing style, i.e. most likely to win, for that player. • The playing style that player prefers the opponent to use. 4. Support your results with a visualization. 5. Submit a two-page maximum EXSUM (requirements below). Basics of Risk Risk is a strategy board game of conflict and conquest, typically played on a board depicting a map divided into territories. Turns rotate among players who control armies of playing pieces with which they attempt to capture territories from other players through battle. Risk uses dice rolls to determine the battle’s results. The goal of the game is to occupy every territory on the board and, in doing so, eliminate the other players. There’s more too it than that, but this sufficiently describes the portion of the game relevant to the assignment. A battle to the death The attacking player initiates confilct with an adjoining territory. That player continues to attack until either the defending player is defeated or the attacking player’s forces are reduced to a single army (insufficient forces to continue attacking). Battle mechanics Once a battle is initiated each player (attacker and defender) decides how many dice to roll. The attacking player may roll up to min{3, forces−1} dice but may choose to roll fewer than the maximum. The defending player may roll up to min{2, forces} dice but may also choose to roll fewer than the maximum. The attacking player can terminate the battle at any time, however the defender has no surrender option. Your simulation is a battle to the death, the attacker will not terminate early. 1 Each engagement in a battle consists of the players rolling all of their dice. The dice values are compared using the following process to determine the outcome (see Figure 1 for a graphic example of the process). 1. Compare the highest value die for each player. • If the attacker’s die value is strictly greater than the defender’s: – The attacker wins. – The defender looses one army. • Else: – The defender wins – The attacker looses one army. • There are no ties. 2. If the attacker and defender each roll more than one die then compare the second-highest value die for each player and follow the same rules as above. 3. If the defender or attacker only rolls one die then the engagement is over. • If the defender has no armies the attacker wins, end battle. • Else if the attacker only has a single army the defender wins, end battle. • Else begin a new engagement. Figure 1: Risk dice comparison example graphic. For more information go to the official website. 2 https://www.ultraboardgames.com/risk/game-rules.php Playing styles to analyze 1. Standard: Each player rolls the maximum number of dice at every opportunity. 2. Annoying: • The defending player only rolls a single die, every time. • The attacking player uses the Standard style 3. Why do that: • The attacking player only rolls a single die, every time. • The defending player uses the Standard style. Recommendation Use a Monte Carlo simulation, similar to Assignment 1, to calculate the probability of victory (for attacker or defender, you choose the perspective) for a particular starting condition (called a design point). Treat each battle to the death as a Bernoulli Trial with win = 1 and loss = 0. To estimate P (win) using a Monte Carlo simulation: 1. Conduct n runs for a particular design point. 2. Record the total number of wins, x, out the the n runs. 3. P (win) = xn for that design point. Submission requirements Due NLT 2359 EST on 21JUN2021 • Submit an EXSUM (Executive Summary) and associated R script(s) via MS-Teams. • Your EXSUM must, at a minimum: – Describe how the data were developed (the algorithm) – Present the findings – Make a recommendation supported by the analysis – Make good use of at least one visualization (EXSUM text should talk about what the visualization depicts, what it means, and why the reader should care) • Ensure the team’s script(s) contain sufficient comments to describe the thought process for each step. Scoring • EXSUM text (10 pts) • Script(s) (15 pts) • Visualization (5 pts) • Extra Credit (up to 5 pts each) – Include a process flow chart as an annex to the EXSUM (separate from the two-page max). – Submit a well-formatted RMarkdown report in place of an EXSUM. ∗ pdf format. ∗ Must contain the required EXSUM information. ∗ Page limit does not apply due to the extra space required for code blocks. ∗ Submit both the pdf and Rmd file. 3 Risk Simulation Assignment Basics of Risk A battle to the death Battle mechanics Playing styles to analyze Recommendation Submission requirements Scoring # many random number generators built into R # Uniform runif(25, -5, 7) # Normal rnorm(25, mean=3, sd=2) # Chi-Square rchisq(25, df=10) # Exponential rexp(25, 0.5) # Not only can you generate random numbers # you can get information about the distribution # Each distribution has a family of functions # p for probability (get a p-value) # q for quantile (get a critical value) # d for density (get the value from the pdf) ?rnorm() pnorm(1.96, mean=0, sd=1) qnorm(0.05, mean=0, sd=1) # Note the lower.tail = TRUE argument # R assumes left-sided values # or P(X < x)="" #="" so="" if="" you="" want="" a="" right="" handed="" value="" #="" set="" lower.tail="FALSE" #="" or="" do="" 1-="" qnorm(0.05,="" mean="0," sd="1," lower.tail="FALSE)" pnorm(1.96,="" mean="0," sd="1," lower.tail="FALSE)" #="" other="" packages="" also="" have="" functions="" you="" can="" use="" #="" for="" some="" reason="" r="" doesn't="" have="" the="" triangular="" require(triangle)="" rtriangle()="" #="" you="" can="" make="" your="" own="" if="" you="" want="" #="" making="" a="" random="" number="" with="" a="" specific="" distribution="" is="" easy="" #="" generate="" a="" random="" uniform="" u~[0,1]="" #="" transform="" it="" with="" a="" function="" lamb=""><- 0.5="" rexpon="">-><- (-1/lamb)*log(1-runif(1))="" #="" check="" it="" against="" the="" expected="" result="" using="" a="" quantile="" plot="" rexpon="">-><- (-1/lamb)*log(1-runif(10000))="" qqplot(rexp(10000,="" 0.5),="" rexpon)="" #="" one="" to="" focus="" on,="" very="" important="" for="" your="" next="" project="" #="" sample="" #="" sample="" randomly="" samples="" items="" from="" an="" r="" object="" #="" you="" can="" set="" the="" sample="" size="" (number="" of="" things)="" #="" do="" with/without="" replacement="" (default="" is="" without)="" #="" and="" modify="" the="" probabilities="" #="" the="" default="" probability="" is="" uniform,="" all="" equally="" likely="" #="" what's="" neat="" is="" your="" can="" sample="" from="" any="" vector/list="" object="" sample(letters,="" 10)="" #="" get="" 10="" random="" letters="" sample(letters,="" 30)="" #="" oops,="" only="" 26="" letters="" sample(letters,="" 30,="" replace="TRUE)" #="" if="" we="" sample="" from="" a="" data="" frame="" we're="" sampling="" columns="" sample(usarrests,="" 10)="" #="" only="" 4="" columns,="" error="" sample(usarrests,="" 10,="" replace="TRUE)" #="" only="" 4="" columns,="" error="" #="" i="" we="" want="" to="" sample="" data="" frame="" rows="" use="" indicies="" i="">-><- sample(1:nrow(usarrests),="" 10)="" usarrests[i,]="" #="" modify="" the="" probs="" and="" sample="" from="" a="" discrete="" distribution="" #="" probs="" must="" sum="" to="" one="" #="" if="" they="" don't="" r="" with="" rescale="" i="">-><- sample(1:4,="" 10000,="" replace="T," prob="c(0.1," 0.2,="" 0.5,="" 0.3))="" hist(i)="" table(i)/10000="" #="" probs="" must="" sum="" to="" one="" #="" if="" they="" don't="" r="" will="" rescale="" i="">-><- sample(1:4,="" 10000,="" replace="T," prob="c(1," 2,="" 5,="" 12))="" hist(i)="" table(i)/10000="" #="" provide="" enough="" probs="" i="">-><- sample(1:4, 10000, replace=t, prob=c(0.2, 0.4, 0.4)) hist(i) table(i)/10000 #### exercise # use sample to simulate a roll of 3 dice # simulate 1000 rolls of 3 dice # capture the sum of each roll # make a histogram of the sums # is it what you expected? sample(1:4,="" 10000,="" replace="T," prob="c(0.2," 0.4,="" 0.4))="" hist(i)="" table(i)/10000="" ####="" exercise="" #="" use="" sample="" to="" simulate="" a="" roll="" of="" 3="" dice="" #="" simulate="" 1000="" rolls="" of="" 3="" dice="" #="" capture="" the="" sum="" of="" each="" roll="" #="" make="" a="" histogram="" of="" the="" sums="" #="" is="" it="" what="" you="">- sample(1:4, 10000, replace=t, prob=c(0.2, 0.4, 0.4)) hist(i) table(i)/10000 #### exercise # use sample to simulate a roll of 3 dice # simulate 1000 rolls of 3 dice # capture the sum of each roll # make a histogram of the sums # is it what you expected?>