Created
January 10, 2021 19:34
-
-
Save Hidden50/297c03cf1c08982d5c5f727fd282d3a4 to your computer and use it in GitHub Desktop.
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
[...(function* () { | |
for (const pokemon of app.pokeData) { | |
let bestChance = 0; | |
for (const dish in pokemon.recipeWeights) { | |
for (const quality in pokemon.recipeWeights[dish]) { | |
const weight = pokemon.recipeWeights[dish][quality]; | |
const chance = weight / app.recipeWeightSums[dish][quality]; | |
if (!app.recipeTable[dish][quality].length) { | |
continue; // impossible: no recipe results in this dish/quality combination | |
} | |
if (chance > bestChance) { | |
bestChance = chance; | |
} | |
} | |
} | |
if (bestChance !== 0) { | |
yield [pokemon.name, bestChance]; | |
} | |
} | |
})()] | |
.sort( ([, left], [, right]) => right - left ) | |
.map( ([pokemon, chance]) => [pokemon, (100 * chance).toFixed(2) + "%"] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment