minmax_dice

package
v0.0.0-...-1048ca3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateMaxProbabilities

func CalculateMaxProbabilities(params probabilities.DiceRollParameters) (probabilities.Probabilities, error)

CalculateMaxProbabilities returns probabilities of max for dice rolls.

For example for 2d6 rolls probability of 1 (1+1) is 1/36, probability of 2 (1+2, 2+1, 2+2) is 3/36, etc.

For rolls of n m-sided dices consider n-dimensional cube with side of m. That cube consists of smaller m^n cubes with side of 1. Each small cube defines one specific roll.

Subcube with side of 1 contains all small cubes for max of 1. Subcube with side of 2 without previous subcube contains all small cubes for max of 2. Etc.

func CalculateMinProbabilities

func CalculateMinProbabilities(params probabilities.DiceRollParameters) (probabilities.Probabilities, error)

CalculateMinProbabilities returns probabilities of min for dice rolls.

For example for 2d6 rolls probability of 6 (6+6) is 1/36, probability of 5 (5+6, 6+5, 5+5) is 3/36, etc.

For rolls of n m-sided dices consider n-dimensional cube with side of m. That cube consists of smaller m^n cubes with side of 1. Each small cube defines one specific roll.

The idea with subcube is the same with that of "max" case except that subcubes grow from the other side of big cube.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL