Giter VIP home page Giter VIP logo

dpsbin's Introduction

dpsbin

Computes the probability mass function for an extended negative binomial distribution essential for accurate DPS calculations in a variety of turn/tick-based games.

Description

Common methods for estimating how long it takes to finish off an opponent in typical hack-and-slash games are inaccurate due to factors like overkill. Those crude calculations are often good enough, but in case they're not you can turn to this library to get an exact answer.

Installation

dpsbin requires Python 3 or greater and is available on PyPI.

python -m pip install dpsbin

Alternatively, the latest version can be easily downloaded and installed locally.

python -m pip install -e git+https://github.com/hmusgrave/dpsbin.git#egg=dpsbin
git clone https://github.com/hmusgrave/dpsbin.git
cd dpsbin
python -m pip install -e .

Using dpsbin

The only notable entry point is dpsbin.pmf. Suppose you want to know how many times you'll have to roll a 6-sided die to reach a total of 40 or more.

import dpsbin, numpy as np, math

probs = dpsbin.pmf(6, 40)

# probs[k] is the probability you need to roll k times.
assert math.isclose(np.sum(probs), 1)

# easily find out how many rolls you'll need on average.
avg = np.dot(probs, np.arange(len(probs)))

# if you have a 90% chance to miss and not deal the 1d6 damage then
# you can use with_zeros() to translate the old probability mass array
# into one that accounts for zeros. Truncate to only considering up
# to 80 rolls.
hard_to_hit = dpsbin.with_zeros(80, .9, probs)

dpsbin's People

Contributors

hmusgrave avatar

Watchers

 avatar

dpsbin's Issues

Use of mutation testing in dpsbin - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool mutmut in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

No tests fail when pma order is reversed in with_zeros()

In dpsbin._exact.py, changing rtn[-i] = to rtn[i] = doesn't cause any tests to fail, which probably indicates that we don't have tight enough bounds in the earth-mover pma comparison we're doing to catch some classes of fairly major deviations from the correct answer.

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.