Giter VIP home page Giter VIP logo

hearthstone-fatigue-calculator's Introduction

Hearthstone Fatigue Calculator

A handy fatigue calculator, useful when you're playing Mill Rogue or similar decks and you need a quick and reliable way to calculate the lethal damage.

Example

Modes

  1. Lethal mode: turns needed for X damage
  2. Calculator mode: damage dealt in X turns

Note: You get to choose the initial fatigue damage in both modes

How to use

If you don't want to install anything you can copy-paste the code in fatigue.py to repl.it. Otherwise, python3 fatigue.py will do the trick if you have Python >= 3.6.

You can exit the program by pressing Ctrl+C

How it works

The basics of this program are actually a very popular mathematical problem: the triangular numbers. They count objects arranged in an equilateral triangle, as in the diagram below:

fig1

The total fatigue damage is equivalent to the sum of all the points in the triangle, while the turns are the number of rows. The sum can then be expressed as a less computationally expensive formula:

fig2

But in many situations, you don't start at 1 point. Maybe you're already 3 turns in and you want to calculate the damage needed for a fatigue lethal. That's when trapezoidal numbers come into play. You can learn more about them on this paper by Carlton Gamer, David W. Roeder and John J. Watkins. It's basically the same as the triangular numbers but starting at k+1 instead of 1.

fig3

A trapezoidal triangle can be expressed as the entire triangular number (until k+l) minus the small triangular number (until k). To obtain the trapezoidal number beginning with k+1, the formula then can be simplified to:

fig4

Now, to find the turns needed for lethal given the total fatigue damage, the solved formula for l (starting at k instead of k+1) can be used:

fig5

Sources:

hearthstone-fatigue-calculator's People

Contributors

marioortizmanero avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

hearthstone-fatigue-calculator's Issues

Better mode management

It'd be great to be able to go back to choose the mode. Also, something better than a defaultdict could be used.

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.