Open brentleyjones opened 9 years ago
I've been thinking more about this and here are my thoughts:
Int.min..<16
), or multiple ranges (less than 3 or greater than or equal to 12 = [(Int.min..<3), (12...Int.max)]
)This would mean the meat of the work is determining a probability mass function for a given expression. I don't know how to do that, but I hope there is a way :smile:.
CC: @yammada
I have an idea about how we can implement this. Also support advantage/disadvantage in 5e. I'll talk to you later.
Awesome. I assume for advantage/disadvantage it will simply be2d20k-H
or 2d20k-L
(I'm probably messing up the notation, but pick high or pick low: #28)
Probability of success on disadvantage is the probability of success twice in a row= Psuccess ^2. Probability of failure on advantage is probability of failure twice = (1-Psuccess^ 2) or 2Psuccess - Psuccess ^ 2 or something like that. The probability of success on a single die roll is easy, but I haven't thought about how to generalize it to a expression.
The issue isn't success, but chances of each value to be hit. Success can mean different things depending on the context (thus the need to support multiple ranges: some games have ranges of success, odd vs even for success, etc).
Also an expression can be more than just 2d20+4
, it can include multiplication before or after the fact as well, exploding dice, min/max/dropping. I think the key is to be able to calculate a probability mass function in a general sense for an expression (see #26 for how general I've made them).
I love that you are thinking about this though. You actually took a probability class (or multiple, I forget), while I only skimmed the internet for the ideas when I need them :smile:.
Oh! I think I'm missing some context from trying to keep up on my phone. I misunderstood your question but yes I think we can find a general probability mass / distribution function. I made some notes on it a while back but I don't think my solution then is as general as what you are looking for now.
Boy do I love playgrounds. I believe I have the basis of the implementation for this. I'll be working on it and I should be able to get it in the next day or so.
@TabletopAssistant/dicekit do we feel this is needed for release 0.2?
It's very common in TTRPGs that you need to meet a goal with a dice roll (less than or equal to X, greater than Y, etc.). Expressions (see #3) should support a way to determine how likely it is that it will meet a given goal. To be extensible the goal checking should probably be closure based.
CC: @LoganJohnson