I made a web page where you can simulate a complex dice roll sequence with conditionals (e.g. re-roll when roll is a 1) using a Python-like syntax. (Click the “Toggle Syntax” button to view examples)

It needs a second to load because it has to load a Python interpreter in the background (I’m not good at web development) but once that’s done, it works really well.

It’s still very barebones and I still have to work out some problems.

Maybe some of you could use it, though.

There’s also just the Python version available to run locally here

Everything is GPLv3, enjoy!

  • AnExerciseInFalling
    link
    fedilink
    arrow-up
    5
    ·
    22 hours ago

    This is super cool!

    Does it support things like max/min to simulate advantage/disadvantage?

    It would be really cool to mathematically compare different kinds of rolls, like the cascading dice damage post from a couple weeks ago (even if its not built into the notation, just writing out the logic by hand)

    • illectrility@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      4
      ·
      22 hours ago

      No, there is no advantage or disadvantage functionality. I made it purely for balancing, so finding out the average damage a character would do. In that case I would just write out all the different rolls the character would do when attacking and have the program calculate using that. It’s pretty barebones

  • Pennomi@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    23 hours ago

    Extremely impressive! I wrote a dice probability calculator myself recently, but abandoned perfect calculations in favor of a million roll simulation. What you have done is really quite lovely.

    • illectrility@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      8
      ·
      23 hours ago

      Thank you very much. I, too, initially used a sampling approach but that was obviously inefficient and inaccurate. Getting this to work was a HUGE pain so it’s nice to read some kind words about it, thank you

  • jcr@jlai.lu
    link
    fedilink
    Français
    arrow-up
    1
    ·
    19 hours ago

    I am working on a dice expression evaluator on my side, and I will certainly reuse your code if I can ! Thanks for giving the example, as a GNU enthusiast, it is very nice ! Great job making it work !

  • Kitathalla@lemy.lol
    link
    fedilink
    English
    arrow-up
    1
    ·
    23 hours ago

    Cool. I used to have an app that would do this and it was great to play with for various scenarios. Nice to see a website version.