[Community Puzzle] Risk odds calculator

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @June1664,validated by @nicolasD,@Arglanir and @Drunkey.
If you have any issues, feel free to ping them.

What is the math behind the odds calculator? For example the input is 1, below another 1 and the output is 41.67%. Could you give me the mathematics please. From CodeDragon. :slightly_smiling_face:

Each of Attacker and Defender rolls 1 dice:

             Attacker's roll =
              1  2  3  4  5  6
Defender's
roll =     1  L  W  W  W  W  W
           2  L  L  W  W  W  W
           3  L  L  L  W  W  W
           4  L  L  L  L  W  W
           5  L  L  L  L  L  W
           6  L  L  L  L  L  L

L = Attacker Loses, W = Attacker Wins in the table above.

There are 15 possible outcomes out of 36 where the Attacker can win. Hence the answer is 41.67%.