A script to simulate Archero 2 Island Treasure Hunt. This is mainly used to determine the best multipliers to apply to each of the tiles.
- python3
def simulation(sim_details: list[SimulationDetails], board: list[Tile], num_rounds: int, num_dices: list[int], points_to_meet: int, csv: bool = False, save_history: bool = False):
"""Run simulations to get the average PPID using a specified number of starting dice. A single run will only end after all starting dice and free dice received in the run are used.
Args:
sim_details (list[SimulationDetails]): List of multipliers to run
board (list[Tile]): The board
num_rounds (int): The number of times to run simulation
num_dices (list[int]): List of the number of dice to start each simulation with
points_to_meet (int): Number of points to aim for. The sim will stop if we reach this threshold even if we didn't use all starting dice.
output_csv (bool): Whether we should output the runs in a CSV
save_history (bool): Whether we should save the state of run after every single roll. Will slow down sim.
"""- In terminal, run
python -i simulate.py - You will see
>>>which means you can now run the functions available in the script. - Example function usage:
>>> simulation(sims, board, 100_000, [400], 100_000)- This will run 100,000 rounds starting with 400 dice until we hit 100,000 points or run out of dice.
- You can set
num_dices=[math.inf]to... have infinite dice! This will only stop once we hitpoints_to_meet.- This is useful for when you want to calculate average PPID of a multiplier map without concern over if you can meet highest multiplier.
- You can set
points_to_meet=math.infto... not have a points limit. This will only stop once we run out of dice.- This is useful for when you want to draw up a risk tolerance table for each '# of starting dice' benchmark. You can easily group the rows with the same amount of starting dice and count how many passed the points breakpoint you were aiming for.
We have calculated what we consider the best multipliers and it is saved in sims so check them out in simulate.py.
You can look at calc_best_multipliers to see how we did this math.
To create a new one, you can:
- When making your list of multipliers, make sure the order matches up with what we have in
board. - You will be setting a different multiplier map for each of 2x, 3x, 5x, 10x. (You can use the same map for each multiplier if you would like)
- Run
>>> new_sim = SimulationDetails(filename, { 2: [multipliers (must be a list of 24 integers)], 3: [multipliers (must be a list of 24 integers)], 5: [multipliers (must be a list of 24 integers)], 10: [multipliers (must be a list of 24 integers)], })- If you want to use the same multiplier map for every single one, you can use
create_sim_details_same_mult(filename, multipliers: list[int]).
- If you want to use the same multiplier map for every single one, you can use
- Run
>>> simulation([new_sim], board, 10_000, [500], 100_000)