I get a different result when I try to reproduce your described calculation using dyce
¹:
from dyce import H, P
d10 = H(10)
def mechanic(nd10_roll):
outcome_max = max(nd10_roll)
# We are faithfully reproducing the approach here of (max * count). As alluded to
# in the original question, we could have just as easily written something like:
# max_sum = sum(outcome for outcome in nd10_roll if outcome == outcome_max)
count_max = sum(1 for outcome in nd10_roll if outcome == outcome_max)
max_sum = outcome_max * count_max
# Rounding is optional. We do it here solely for display readability.
return round(max_sum / len(nd10_roll), 2)
results = {
n: P.foreach(mechanic, nd10_roll=n@P(d10))
for n in range(2, 7)
}
# ... see graph/binder for visualization of results
I've attached the anydyce
² graphs below. You can see my attempt (and play around with it) in your browser: [sourcesource]
That configuration of JupyterLite uses in-memory browser storage, so download any work you want to save.
There's a reasonable possibility the difference could be explained by:
- My not understanding your sentiment;
- My not getting my math right;
- AnyDice not doing what you think it's doing or want it to do; or
- Some combination of 1, 2, and 3.
That being said, my results look similar to @Ilmari Karonen's scaled up result from his answer. There are more efficient (and less readable) ways for dyce
to arrive at those results, but you should be able to drive that implementation up to 10d10 (and possibly beyond) without too much of an issue. If you want to go higher, I can explore alternatives.
¹ dyce
is my Python dice probability library.
² anydyce
is my visualization layer for dyce
meant as a rough stand-in for AnyDice.