TecKnow / STADiceRoller

Dice roller and probability visualizer compatible with the Star Trek Adventures TTRPG.
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Develop an explicit function for computing dice pool stats. #5

Closed TecKnow closed 1 year ago

TecKnow commented 1 year ago

At the moment the Java Script page doesn't do any statistical calculation of its own. Instead, it reads static data files with frequency table information encoded in JSON. Those static data files are generated by a Python script, also in this repository, that uses Pandas and NumPy to simply enumerate and count every possible roll in every dice pool. In Pandas this takes about 30 seconds. In JavaScript it would take much longer. The static data files are also not particularly large, much to my surprise. However, they do limit flexibility since they could easily balloon in size, and changing them requires changing both the Python and JS programs.

This will make it harder to add functionality like assists, that add a sixth die to the pool with different target numbers than the other 5.

Enumerating every possible die roll is the most straightforward, but also least efficient way to gather the information the app needs. Develop an explicit JS function for computing the tables instead. This will increase flexibility. Hopefully the change in performance will be minimal.