Problem 1301. RISK Calculator - Large Armies, High Accuracy, Fast
This Challenge is to quickly provide the high precision probability of legal RISK battles up to 100 vs 100. [ Attack >= 2 and Defense >=1 ].
Related to Cody 1260 RISK Board Game Battle Simulation
Simplified explanation of the dice play:
Attacker with 2 armies will throw one die. Attacker with 3 armies will throw two die. Attacker with 4 or more armies will throw three die.
Defense with 1 army will use one die. Defense with 2 or more armies will throw 2 die.
The attacker High is compared to the Defender High. If Attacker High > Defender High then defender loses 1 army otherwise Attacker loses 1 army. Tie goes to defender. If the Defender threw two die and the Attacker threw 2 or more die then the Second Highest of each is compared. If Attack > Defense then Defense loses an army otherwise Attack loses an army. Attack continues until No defenders remain (Win) or Attack is reduced to 1 army (Lose).
Input: a,d where a is number of attacking armies and d is number defending
Output: pwin, the probability of the Attacker Winning
Accuracy: Accurate to +/- 1e-6
Scoring: Time (msec) to solve 10 Battle Scenarios
Solution Stats
Problem Comments
Solution Comments
Show commentsGroup

Strings II
- 21 Problems
- 41 Finishers
- Eliminate Polysyllabics: Long live short words!
- Alternately upper-lower case
- Morse Code Generator! Try it!
- Is the paranthesis sequence balanced ?
- Simple Decoder Ring
- Join Strings with Multiple Different Delimiters
- Is the paranthesis sequence balanced ?
- Count letters occurence in text, specific to words with a given length.
- Convert Two Character String into a Binary Vector
- Kryptos - CIA Cypher Sculpture: Vigenere Encryption
- Kryptos - CIA Cypher Sculpture: Vignere Decryption
- Mean and standard deviation of times in string
- How many digits are there?
- ABBREVIATION
- Make a list string
- Generate a melodic contour string matrix
- Morse Code Generator! Try it!
- NO _________ ALLOWED....
- Backslang, odds are you used it at some point in time...
- Simple Caesar Cypher - shift encrypt a message given an index number
- Split a given string from the first instance of a given character
- Concatenate strings
- most frequent character
- Alternately upper-lower case
Problem Recent Solvers24
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!