Last active
November 3, 2016 19:48
-
-
Save Ads20000/b3e6941e0507b0d2ec0c6591249d0ee4 to your computer and use it in GitHub Desktop.
A program to find the probability of catching a Pokemon in an Escalator Battle (in Pokemon Shuffle (Mobile)) within a specific number of stage levels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A program to find the probability of catching a Pokemon in an Escalator Battle (in Pokemon Shuffle (Mobile)) within a specific number of stage levels | |
// This program is actually a very long-winded way of making this calculation, because you can do the same thing with the formula 1-(99!/(99-n)!/100^n) where n is the number of attempts: https://www.reddit.com/r/PokemonShuffle/comments/44vd9u/diancie_escalation_hp_graph_and_stats/czxjwmz/ | |
// The simplest way to run this program is to open it in or copy it into Mozilla Firefox's Scratchpad (Firefox Menu > Developer > Scratchpad or Shift+F4) and hit 'Run'. The result will pop up in a window in your open tab. | |
// n is the number of levels which have been attempted | |
// 1 is the initial value for the program | |
var n = 1 | |
// p is the probability of it taking n attempts to catch the Pokemon | |
// 0.01 is the initial value for the program | |
var p = 0.01 | |
// q is the probability of it taking n attempts or less to catch the Pokemon | |
// 0.01 is the initial value for the program | |
var q = 0.01 | |
// SET n <= number TO THE NUMBER OF ATTEMPTS WHICH YOU WANT TO FIND THE PROBABILITY FOR (e.g. n <= 11) | |
for (n = 2; n <= 11; n++) { | |
p = (0.01*n) * (p/(0.01*(n-1))) * (1-(0.01*(n-1))); | |
q = q + p | |
} | |
window.alert(q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment