Probability in RISK: The Game of Global Domination

An Analysis by Simulation

Benjamin Kusin  benjaminkusin@gmail.com   713-829-7616

RISK is a popular board game we have all enjoyed. Various battle-related probabilities for this game have been studied using rather simple matrices and Markov chains (see Blatt in references at the end of this file). This project is an attempt to replicate those results by using simulation. This project ignores the game's cards and assumes the maximum allowable number of dice for every roll.
After viewing this file, if you are already a decent RISK general, you will have an unfair advantage!

This file is broken down into Roll Probabilities, Battle Probabilities, and Special Cases. In the first section, I simulate the various cases for one die roll and the probability of the attacker or defender winning the roll (opponent loses two armies) or both losing one army. In the second section I look at the probabilities involved in actually taking a territory (roll until one army is defeated - either attacker has one army left or defender has zero). In the last section I look at what happens when the attacker and defender have the same number of armies, and what happens when the attacker has a 3:2 or 2:1 numerical advantage. The function definitions are all at the beginning of the file.

Sum and NestWhile may be unusual functions to some. Sum evaluates a summation (series). NestWhile is similar to While except it takes a function as an additional parameter and repeatedly applies it to an expression until the test condition yields False. For functions dealing with roll percentages I use a very high number (100,000) of trials because I need great accuracy for the percentages. This is very slow for large armies. A 50 vs. 50 battle can take 10 minutes to compute that many trials for! For expected losses, I use only 100 trials because deviation is not as much of a concern because armies are discrete. In other words, there's not much practical difference between a result of 6.1 armies remaining on average and 6.98.

(*This is code from Professor Hanusa. *)

(*DieRoll simulates rolling three dice for the attacker and two dice for the defender (although you can change this easily).The results are sorted.*)
DieRoll={Sort[RandomInteger[{1,6},3],Greater],Sort[RandomInteger[{1,6},2],Greater]}
(*CompareDie compares the two lists generated by DieRoll---it pairs the best of each list of dice,the second best,etc.*)
CompareDie=Table[{DieRoll[[1,i]],DieRoll[[2,i]]},{i,Min[Length[DieRoll[[1]]],Length[DieRoll[[2]]]]}]
(*The next two functions take the pairs of CompareDie and determine who wins each pair.Afterwards,the number of winning rolls for each are computed.*)
AttackWin=Select[CompareDie,#[[1]]>#[[2]]&]
DefendWin=Select[CompareDie,#[[1]]≤#[[2]]&]
{Length[AttackWin],Length[DefendWin]}
(* end of his code *)

DieRollx[x_,y_]:= {Sort[RandomInteger[{1,6},x],Greater],Sort[RandomInteger[{1,6},y],Greater]} (* a generalized version of Prof. Hanusa's DieRoll allowing the input of he number of dice*)

Fight[{x_,y_}]:= (If[x≥4 && y≥2,DieRollx[3,2], (*Fight selects the appropriate die combination. x and y are army sizes*)
 If[x≥4 && y==1,DieRollx[3,1],
 If[x==3 && y≥2,DieRollx[2,2],
 If[x==3 && y==1,DieRollx[2,1],
 If[x==2&& y≥2,DieRollx[1,2],
 If[x==2 && y==1,DieRollx[1,1]]]]]]])

Casualties[{x_,y_}]:= Module[{},
CompareDie=Table[{x[[i]],y[[i]]},{i,Min[Length[x],Length[y]]}];
AttackWin=Select[CompareDie,#[[1]]>#[[2]]&];
DefendWin=Select[CompareDie,#[[1]]≤#[[2]]&];
{Length[DefendWin],Length[AttackWin]}]

NewBattle[{x_,y_}]:=Module[{u,v}, (*Only gives remaining armies after one roll. Use for die cases.*)
Casualties[Fight[{x,y}]];
u=x-Length[DefendWin];
v=y-Length[AttackWin];
{u,v}]

BattleToDeath[{x_,y_}]:=NestWhile[NewBattle,{x,y},(#[[1]]>1&&#[[2]]>0)&] (*Rolls until one army is defeated (war) *)

AttackerWin[{x_, y_}] := 
 N[Length[Select[
     Table[BattleToDeath[{x, y}], {i, 1, 100000}], #[[2]] == 0 &]]/100000]

AverageArmiesLeft[a_,d_,n_]:=N[Sum[BattleToDeath[{a,d}][[1]],{i,1,n}]/n] (*the most general version. Allows input of both attacker and defender army sizes and number of runs of that war.*)

AverageLosses[x_,y_,n_]:= x-AverageArmiesLeft[x,y,n]

LossPercentage[x_,y_,n_]:= AverageLosses[x,y,n]/x

Dice Roll Probabilities

This section shows the six die roll cases and the chance of the attacker winning and expected attacker losses.

There are six different combinations of die rolls. (A = attacker, D = defender.) They are: 
Case I     1A, 1D
Case II    2A, 1D
Case III   3A, 1D
Case IV    1A, 2D
Case V     2A, 2D
Case VI   3A,2D

The attacker must roll one die less than the number of armies he has. Thus, if he has only one army he cannot attack. The defender can roll the same number of dice as armies, up to two. In the game, players can decide how many dice they want to roll for every roll but this project always assumes the maximum allowable number of dice rolled (which you should do anyway as far as your chance of winning the roll goes)

(*x and y in the folowing functions represent the number of armies for attacker and defender, not the number of dice! This is a consequence of my Fight function, which determines the appropriate number of dice to roll based on army sizes. Thus (3,1) represents attacker rolling 2 dice and (4,1) is attacker rolling 3 dice and defender rolling one. *)
(*the following functions print win percentages.  Each group has Awin, Dwin, and draw (where applicable) function*)

CaseVandVIA[{x_,y_}]:=N[Length[Select[Table[NewBattle[{x,y}],{i,1,100000}],#[[2]]==(y-2)&]]/100000] (*gives number of attacker wins (defender loses 2) for cases V and VI *)

CaseVandVID[{x_,y_}]:=N[Length[Select[Table[NewBattle[{x,y}],{i,1,100000}],#[[1]]==(x-2)&]]/100000] (*gives defender wins*)

CaseVandVIDraw[{x_,y_}]:=N[Length[Select[Table[NewBattle[{x,y}],{i,1,100000}],(#[[1]]==(x-1)&;#[[2]]==(y-1))&]]/100000]

CaseIthruIVA[{x_,y_}]:=N[Length[Select[Table[NewBattle[{x,y}],{i,1,100000}],#[[2]]==(y-1)&]]/100000]

CaseIthruIVD[{x_,y_}]:=N[Length[Select[Table[NewBattle[{x,y}],{i,1,100000}],#[[1]]==(x-1)&]]/100000]

(*This group covers cases I through IV. Draw is impossible *)

(*that's it for the functions, now for the calculations. Lists are Attacker Win %, Defender Win %, Draw % (if applicable)*)

(*Case I*)
{"Attacker Win %"CaseIthruIVA[{2,1}],"Defender Win %"CaseIthruIVD[{2,1}]}

(*Case II*)
{"Attacker Win %"CaseIthruIVA[{3,1}],"Defender Win %"CaseIthruIVD[{3,1}]}

(*Case III*)
{"Attacker Win %"CaseIthruIVA[{4,1}],"Defender Win %"CaseIthruIVD[{4,1}]}

(*Case IV*)
{"Attacker Win %"CaseIthruIVA[{2,2}],"Defender Win %"CaseIthruIVD[{2,2}]}

(*Case V*)
{"Attacker Win %"CaseVandVIA[{3,2}],"Defender Win %"CaseVandVID[{3,2}],"Draw %"CaseVandVIDraw[{3,2}]}

(*Case VI*)
{"Attacker Win %"CaseVandVIA[{4,2}],"Defender Win %"CaseVandVID[{4,2}],"Draw %"CaseVandVIDraw[{4,2}]}

(* How about that! All results match Blatt's! *)

War Probabilites

Here we look at the probability of winning a war, a sequence of dice rolls that continues until the attacker has one army or the defender has no armies.
Again investigating attacker chance of victory and expected attacker losses.

(*for now, I am only doing this one example because it is one that Blatt offers. My result is the same. This function is extremely slow so I will not be doing more examples. Instead I will focus on expected losses in the next section*)

AttackerWin[{4,3}]

Special Cases - Common
What happens when attacker has 3:2 advantage, 2:1 advantage,  and same size army as defender. Only when starting dice are 3 for attacker and 2 for defender.

AttackerWin[{15,10}] (*3:2 advantage. *)

AttackerWin[{20,10}] (*2:1 advantage*)

AttackerWin[{12,12}](*same army sizes. For size 20, result was 58%. For size 50, result=70.732% at lab. Took 10 minutes!! Matches Osborne's result. 70.552% is my result. 31.715 results from 4 armies,.507 results from 12 *)

(* following are graphs of remaining armies and percentage losses for the attacker for the special cases. These graphs use increments of 10 rather than smaller ones because this better approximates the line of best fit.*)

(*plots number of surviving attackers for same-sized armies up to 100*)
ListLinePlot[Table[{i,AverageArmiesLeft[i,i,100]},{i,10,100,10}]]

ListLinePlot[Table[{i,LossPercentage[i,i,1000]},{i,10,100,10}]] (*expected losses as a percent for matching armies *)

(*plots number of surviving attackers for army sizes up to 100 where attacker has 3:2 advantage*)
ListLinePlot[Table[{i,AverageArmiesLeft[Floor[1.5*i],i,100]},{i,10,100,10}]]

ListLinePlot[Table[{i,LossPercentage[Floor[1.5*i],i,1000]},{i,10,100,10}]] (*percentage losses for 3:2 advantage*)

(*plots number of surviving attackers for army sizes up to 100 where attacker has 2:1 advantage*)
ListLinePlot[Table[{i,AverageArmiesLeft[2*i,i,100]},{i,10,100,10}]]

ListLinePlot[Table[{i,LossPercentage[Floor[2*i],i,1000]},{i,10,100,10}]] (*percentage losses for 2:1 advantage*)

(*multiple runs of the percentage functions (not shown) give very different lines each time. But the ranges for each situation stay remarkably constant. So we can draw valid conclusions from the percent graphs ie that a 
2:1 advantage should expect losses in the range of 40-45 percent no matter the army size.*)

Special Cases - Uncommon. 
The same special cases as above but this time for other starting dice combinations.

(*This section is just left for future work. Not part of my project due to time constraints.*)

Conclusions

By using simulation, I have succesfully replicated the results of Blatt's work, shown below. Since the percentage graphs vary wildly in their lines but not their ranges, we can estimate expected losses based on the starting state of the battle. When attacking a matching army, expect extreme losses : approximately 70 - 85 percent. For a 3 : 2 advantage, expect losses between 55 and 60 percent. For 2 : 1 advantages expect losses between 40 - 45 percent. Of course, you should assume the upper bound case. The attacker's chances of winning against a matching army are less than 50% for army sizes under approximately twelve. Past that point, the win percentage increases to a limit of about 70. For 3:2 and 2:1 advantage situations, I only calculated the cases of A15,D10 and A20,D10 respectively because time did not permit further work (the AttackerWin function is extremely slow due to the precision involved) and anyway I don't expect the results to change significantly based on army size the way win percentage against a matching army does. For the first case, the win percentage is 83 and for the second it is 96.5. 
Many players will try to attack only with a 3:2 advantage. This is a good rule to follow since it is a common situation with a high chance of victory. Holding out for a larger advantage is both unrealistic and unnecessary.

Blatt's Probabilities

Here is a (crude) table of Blatt's probabilities. States are attacker/defender army sizes. These probabilities are for one roll. When attacker or defender are rolling the maximum number of dice, army sizes are represented as variables. Wikipedia's version of this table is at the end of this file. 

                  Dice             From State         To State            Probability
Case I       1A,1D          (2,1)                     (2,0)                  .4166
					     (0,1)	      .5834	

Case II     2A.1D          (3,1)                    (3,0)                    .5787
					   (2,1)                    .4213

Case III    3A,1D          (a,1)                   (a,0)                     .6597
					  (a-1,1)	      .3403
					  
Case IV    1A,2D           (2,d)		 (2,d-1)                   .2546
					(1,d)                       .7454
					
Case V      2A,2D         (3,d)                  (3,d-2)                   .2276
					 (1,d)                      .4483
					 (2,d-1)                   .3241
					 
CaseVI    3A,2D          (a,d)                 (a,d-2)                     .3717
                                                            (a-2,d)                     .2926
                                                            (a-1,d-1)                 .3357

Notes:
 Many functions are ultimately aggregated in the ones I use. This would have been a nightmare to code without abtraction, if even possible at all! To quote David Wheeler, any problem in computer science can be solved with another layer of indirection (the 1st Law of Computing).

References:
Blatt, Sharon. RISKy Business: An In-Depth Look at the Game RISK. Hyperlink: http://www.rose-hulman.edu/mathjournal/archives/2002/vol3-n2/paper3/v3n2-3pd.pdf
Osborne, Jason. Markov Chains for the RISK Board Game Revisited.  Mathematics Magazine 76 (2003) 129-135.  Author's Hyperlink: http://www4.stat.ncsu.edu/~jaosborn/research/RISK.pdf
Risk (Game) Wiikipedia http://en.wikipedia.org/wiki/Risk_(game)

The Wikipedia version of Blatt's table.

Probabilities of winning a dice roll in Risk
(various die combinations) 	Attacker
                                one die 	         two dice          three dice
Defender one die
 Attacker wins 	41.67% 	57.87% 	65.97%
 Defender wins 	58.33% 	42.13% 	34.03%

Defender two dice
 Attacker wins 	25.46% 	22.76% 	37.17%
 Defender wins 	74.54% 	44.83% 	29.26%
 Both win one   	n/a 	           32.41% 	33.58%
 
 Thanks to Prof. Hanusa for his help with some code