I want to create a probability calculator for an RPG. I am not a professional programmer and definitely not a mathematician ;) I just want to challenge myself.
How do I go about the logic? The roll I want to make the calculator for uses a number of D6 dice and D12 dice, and the sum of dice in a roll must exceed the "target number". For example, I might roll 3D6 + D12, and the total must be at least 15.
Do I need to write a function that:
- makes all the possible rolls for a combination of D12s and D6s
- counts how many of these achieved the required result
- divides the number of successful rolls by the number of all rolls, and the result converted to percentage is the probability?
If I want to treat a 12 on the D12 as an automatic success regardless of the other dice, where does that fit into this logic?
I know of anydice.com, but want to see if I can handle such a hobby project.