tower
EmptyTowerError
Bases: Exception
Used when actions are taken on a tower where no dice remain.
RollDistribution
dataclass
An object that references the number of dice rolled and dict representing the counts for each possible result.
RollResult
dataclass
An object that contains the overall result of a tower roll: rolled vs lost.
Tower
dataclass
A given instance of the dice tower.
Attributes:
| Name | Type | Description |
|---|---|---|
roll_distributions |
list[dict[int, int]]
|
A list of the previous roll results and their counts. |
possible_values |
list[int]
|
A list of the possible die values based on size. |
Source code in src/wretched_tower/tower.py
_get_possible_die_values
Get a list of all the possible values based on the dice size.
Returns:
| Type | Description |
|---|---|
list[int]
|
list[int]: The possible values based on the die size. |
Source code in src/wretched_tower/tower.py
get_dice_left
Get the dice remaining to be rolled.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The dice remaining. |
get_result_dict_template
Get a dictionary of possible dice values and zeroed counts.
roll_tower
Using the dice remaining, roll them and then remove any that are ones, recording the results.
Returns:
| Name | Type | Description |
|---|---|---|
RollResult |
RollResult
|
The results of the roll as a RollResult object. |
Source code in src/wretched_tower/tower.py
set_dice_left
Allows you to set the dice left value with some validations applied. Allowed values must be between 0 and 100.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dice_left
|
int
|
The dice remaining. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the dice amount exceeds 100 or is less than 0. |