Giter Site home page Giter Site logo

terpypy / d4-monte-carlo Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.7 MB

Monte Carlo simulation to try and estimate the probability of reaching Masterwork level 12 given n number of max attempts. The simulation starts at level 4 since tiers 1-4 have 100% chance to upgrade.

Python 5.50% Jupyter Notebook 94.50%
data-science diablo-4 monte-carlo-simulation multiprocessing probability python

d4-monte-carlo's Introduction

Monte Carlo Simulations for Masterwork Tier Upgrades

This script simulates the process of upgrading masterwork tiers in D4 using Monte Carlo simulations. It includes a function for running the simulation, a helper function for running the simulations in parallel using multiprocessing, and a main function that parses command line arguments and runs the appropriate simulation.

Functions

  • upgrade_mw_tier(max_up_attempts=15): Simulates the process of upgrading masterwork tiers in D4. Returns the final masterwork level achieved.

  • Sim: A class that wraps the simulation functions. It has two methods for running simulations with and without keyword arguments.

  • save_results(results, filename): Saves the results of a simulation to a file.

  • pooled_simulation(sim, n, **kargs): A helper function that prepares and runs simulations in parallel using multiprocessing.

Usage

To run the script, use the following command:

python mw_rollout.py <simulation_name>

where <simulation_name> is the name of the simulation you want to runs the name of the simulation you want to run. The available simulations are upgrade_mw_tier and run_mw_batch.

For example, to run the upgrade_mw_tier simulation, use the following command:

python mw_rollout.py upgrade_mw_tier

Output

The script prints the probability of reaching tier 12 and the total run time. It also saves the results of the simulation as pickle files in form results_<num_max_attempts>.pkl.

Requirements

  • Python 3.9+
  • numpy
  • multiprocessing

for notebook:

  • matplotlib
  • re
  • pandas

d4-monte-carlo's People

Contributors

terpypy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.