# Dice roller statistics

I wouldn’t be surprised if this hasn’t been requested before, but I thought I’d put this in and see what’s what. In the ASL module, there is a function that allows players to see the statistics on the dice that have been rolled in a given game (I believe the number of dice rolled, and the average result). Would it be possible to replicate that as a core feature of Vassal?

I think you could make a global variable and keep adding to die results to it. BUT tracking who rolled the die, what the die was rolled for, weather its 2d6 or 1 d6 would be a nightmare of coding.

1 Like

The dice statistics function in ASL seems to work fine. It tracks per player, covering all the 2d6 rolls made. In fact, the ASL function tracks based on type of roll made (IFT, MC, etc…), which would be unnecessary.

Thanks! I really appreciate that. We’re thinking along the same lines. In terms of posting my recommendation, I placed my initial post in the Feature Request thread. Is there a better category I should post this?

My 2 cents, I’m not sure how to add this logic, but if you can flag the die/dice rolls with some kind of qualifiers describing to the logic eg. the die or dice rolled, what type of dice, for what event, etc…) you can then parse, compute and output several statistics from it. Being a core function, considering the many type of games, that surely is a challenge, unless it is not a core function but some sort of plug in maybe for game categories, just to reduce that complexity.
In the past I did something similar from a (no vassal engine) game log file using ‘regular expressions’ to parse the data I was after.

An ideal die roller analyser would track the whole die-roll distribution. It could build a distribution via counting how many times the individual outcomes have been rolled (for a 1d6, how many ones, twos, …, and sixes) in a frequency table. Then, offline, one could judge if the empirical mass distribution matches the probability mass distribution. E.g., is it reasonable that a given set of 1d6 die rolls are from a uniform distribution, 2d6 from a triangular distribution, and so on.

Means (or first moment) of a sample is often not very telling - for the statistical enclined, look up Anscombs Quartet - you often need at least the second moment (the variance) too - and often that’s not enough either, to say anything remotely sensible about the underlying probability mass function.

The point is, to use the samples in a sensible fashion, you kinda need to know something about probability and statistics (“lies, damned lies, and statistics”). Humans, including those trained in statistics, often have very poor intuitions about probability and statistics (“I haven’t rolled snake-eyes for a while now, it is bound to come up soon”-fallacy). If you know what a probability mass function is, then it may be reasonable to dive more into this - otherwise, I would recommend reading up on probability and statistics.

That said, you can define your own die-roll component (a custom class derived from `VASSAL.build.module.DiceButton` or `VASSAL.build.module.SpecialDiceButton`, overriding the `DR` method) which then outputs die-rolls to a file - say `die_rolls.csv`, which can then be analysed off-line. You can then replace the standard `DiceButton` or `SpecialDiceButton` elements in your favorite module with your custom class. The output file could contain lines a la

`````` dice-name,n-dice,die1,die2,...
``````

Yours,
Christian

1 Like