DnD_5e.simulation package
Module contents
- class DnD_5e.simulation.Simulation(**kwargs)[source]
Bases:
objectA class to run an Encounter multiple times and display the result
- collect_stats()[source]
Collect the stats from one run of the Encounter and update self._stats accordingly :return:
- update_stats(stats: dict)[source]
Collect stats from the given dictionary and update self._stats accordingly :param stats: results from one run of the Encounter :return:
- calculate_aggregate_stats(n=10000)[source]
Calculate the final stats (i.e., take the average of all the runs by dividing by n. Also calculate some other aggregate statistics such as proportion_end_hp. Store the final stats in aggregate_stats.
- Returns:
- print_aggregate_stats()[source]
Print the aggregate stats calculated in :py:meth:calculate_aggregate_stats :return:
- process_run(num)[source]
The method given to an individual process to do work
- Parameters:
num – which iteration of the loop am I
- Returns:
- mp_run(n=1000, num_procs=None)[source]
Run the Encounter n times (using multiprocessing), then print the results :param n: number of times to run the encounter :param num_procs: number of processes to use. If None, use max number of processes :return: aggregate stats