Dicechancis API¶
- ttstatistics.dicechanics.d(obj)¶
The default way of creating a Die
- Parameters:
obj (int | Iterable | str) –
A python obj that is that is taken an transformed into a Die.
When an Int it defines the die through dice syntax eg. d(42) is a d42.
When an iterable it counts the repeated faces eg. d([1,1,1,3]) becomes a die with 3 sides as 1.
When a string it follows a specific syntax “<start>..<end>:<repeat>, <new statement>”
- Returns:
out – The dice representing the input
- Return type:
- ttstatistics.dicechanics.pool(input)¶
The default function for creating a pool. Matmult on dice is recommended over this.
- Parameters:
input (dict[Die]) – A dict of dice. The values are the amount of said die in the pool.
Returns – out: Pool
- ttstatistics.dicechanics.sum(pool)¶
Function that sums the pool outcomes.
- ttstatistics.dicechanics.mult(pool)¶
Function that multiplies the pool outcomes.
- ttstatistics.dicechanics.max(pool)¶
Function that takes the max of the pool outcomes.
- ttstatistics.dicechanics.min(pool)¶
Function that takes the min of the pool outcomes.
- ttstatistics.dicechanics.perform(pool, function)¶
- Parameters:
pool (Pool)
- Return type:
Die
Operations Submodule (ops)¶
Submodule that defines standard functions to use with perform.
- ttstatistics.dicechanics.ops.add(a, b, /)¶
Same as a + b.
- ttstatistics.dicechanics.ops.ceil(x, /)¶
Return the ceiling of x as an Integral.
This is the smallest integer >= x.
- ttstatistics.dicechanics.ops.div(a, b, /)¶
Same as a / b.
- ttstatistics.dicechanics.ops.floor(x, /)¶
Return the floor of x as an Integral.
This is the largest integer <= x.
- ttstatistics.dicechanics.ops.floorDiv(a, b, /)¶
Same as a // b.
- ttstatistics.dicechanics.ops.mod(a, b, /)¶
Same as a % b.
- ttstatistics.dicechanics.ops.mul(a, b, /)¶
Same as a * b.
- ttstatistics.dicechanics.ops.sub(a, b, /)¶
Same as a - b.