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.

  1. When an Int it defines the die through dice syntax eg. d(42) is a d42.

  2. When an iterable it counts the repeated faces eg. d([1,1,1,3]) becomes a die with 3 sides as 1.

  3. When a string it follows a specific syntax “<start>..<end>:<repeat>, <new statement>”

Returns:

out – The dice representing the input

Return type:

Die

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.

Parameters:

pool (Pool)

Returns:

out

Return type:

Die

ttstatistics.dicechanics.mult(pool)

Function that multiplies the pool outcomes.

Parameters:

pool (Pool)

Returns:

out

Return type:

Die

ttstatistics.dicechanics.max(pool)

Function that takes the max of the pool outcomes.

Parameters:

pool (Pool)

Returns:

out

Return type:

Die

ttstatistics.dicechanics.min(pool)

Function that takes the min of the pool outcomes.

Parameters:

pool (Pool)

Returns:

out

Return type:

Die

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.

Class methods and operations

class ttstatistics.dicechanics.die.Die
__init__(data=<ttstatistics.dicechanics.statisticals.scalar.ScalarStatistical object>)
Parameters:

data (Statistical[Unit])

classmethod __new__(*args, **kwargs)
class ttstatistics.dicechanics.pool.Pool
__init__(data={})
Parameters:

data (dict[Die, int])

classmethod __new__(*args, **kwargs)