Skip to main content
6 events
when toggle format what by license comment
Oct 2, 2021 at 21:08 comment added enkryptor Thank you for guiding through the function. Despite my familiarity with a few programming languages, the AnyDice script remains inconvenient and very counter-intuitive.
Oct 2, 2021 at 21:05 vote accept enkryptor
Oct 1, 2021 at 19:14 comment added Ilmari Karonen (Um, wait, let me amend my comment above: COUNT > 1 isn't strictly redundant in your code, since you start MAX at 0. However, the only effect of including it is that the result for non-empty dice pools with all rolls distinct will be 0 instead of 1. While there is in fact an argument to be made that such rolls don't have any "matching results", I'd still consider 1 a more logical result than 0 in that case. In any case, the plots produced by your code and mine look the same: the only difference is whether the lowest bar is labelled 0 or 1.)
Oct 1, 2021 at 19:05 comment added Ilmari Karonen … Which one's faster will depend on the number of dice rolled and the number of sides on them; mine will in general be faster for small numbers of dice with many sides, while yours will be faster for large numbers of dice with few sides. For something like 5d6, they should be pretty close.
Oct 1, 2021 at 19:04 comment added Ilmari Karonen You could optimize your code slightly by starting the range at (#DICE)@DICE and dropping the redundant COUNT > 1 condition (which will always be true if COUNT > MAX anyway). With those optimizations, the main difference between our answers is that I'm looping over all the numbers actually rolled (even if some are duplicates) whereas you're looping over all numbers from the lowest roll (or 1, in your current code) up to the highest roll, even if some don't appear on any die.
Oct 1, 2021 at 18:59 history answered Carcer CC BY-SA 4.0