Skip to content

Instantly share code, notes, and snippets.

@Mygod
Last active February 20, 2021 04:45
Show Gist options
  • Save Mygod/8f0aedb61752d488a1ffc235849ff59d to your computer and use it in GitHub Desktop.
Save Mygod/8f0aedb61752d488a1ffc235849ff59d to your computer and use it in GitHub Desktop.
Maximize raid candies in your browser
let lv25 = false;
let candyXl = false;
let spinap = false;
let medal = 1.4; // https://gamepress.gg/pokemongo/catchcalc#/
let bcr = 0.02; // base capture rate
let thr = 1.7; // excellent 1.7, great 1.3
let candyBonus = (candyXl ? lv25 ? 85 : 55 : 0) + 3 + 2;
let candyPinap = (spinap ? 7 : 6) + candyBonus;
let candyGrazz = 3 + candyBonus;
let ball = 1; // premier ball
let curve = 1.7;
let pinap = spinap ? 1.8 : 1;
let grazz = 2.5; // golden razz
let cpmultiplier = lv25 ? 0.667934 : 0.5974; // https://gamepress.gg/pokemongo/cp-multiplier
let probPinap = 1 - (1 - bcr / 2 / cpmultiplier) ** (ball * curve * pinap * thr * medal);
let probGrazz = 1 - (1 - bcr / 2 / cpmultiplier) ** (ball * curve * grazz * thr * medal);
let x = 0;
let p = 0;
for (let i = 1; i <= 24; ++i) {
let xPinap = probPinap * candyPinap + (1 - probPinap) * x;
let xGrazz = probGrazz * candyGrazz + (1 - probGrazz) * x;
if (xGrazz >= xPinap) {
p += (1 - p) * probGrazz;
console.log("Ball " + i + ": grazz ~ " + xGrazz + "\tw.p. " + p);
x = xGrazz;
} else {
p += (1 - p) * probPinap;
console.log("Ball " + i + ": pinap ~ " + xPinap + "\tw.p. " + p);
x = xPinap;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment