candy-calc/index.html
2019-12-09 11:51:03 +01:00

144 lines
7.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="A calculator for Exp. Candy in Pokémon Sword &amp; Shield.">
<title>Candy Calc</title>
</head>
<body>
<main>
<section id="calc">
<h1>Candy Calc</h1>
<p>This calculator is for <abbr title="Experience">Exp.</abbr> Candy optimization in Pokémon Sword &amp; Shield. Read the <a href="/faq.html">FAQ</a> for more information.</p>
<form>
<dl class="input">
<dt><label for="pokemon">Pokémon</label></dt>
<dd>
<input id="pokemon" name="pokemon" list="pokemon-list">
<datalist id="pokemon-list"></datalist>
</dd>
<dt><label for="curve">Experience Curve</label></dt>
<dd><input id="curve" name="curve" type="text" readonly tabindex="-1"></dd>
<dt><label for="current">Current Level</label></dt>
<dd><input id="current" name="current" type="number" pattern="\d+" min="1" max="99" value="1"></dd>
<dt><label for="target">Target Level</label></dt>
<dd><input id="target" name="target" type="number" min="1" max="100" value="50"></dd>
</dl>
<table>
<thead>
<tr>
<th>Candy</th>
<th>In Bag</th>
<th>Required</th>
</tr>
</thead>
<tbody></tbody>
</table>
<template id="candyrow">
<tr>
<td><label>Exp. Candy </label></td>
<td><input type="number" min="0" max="999" value="999"></td>
<td><input type="text" readonly tabindex="-1"></td>
</tr>
</template>
<input type="submit" disabled>
</form>
</section>
<section id="faq">
<h2>FAQ</h2>
<dl>
<dt><p>What does this calculator do?</p></dt>
<dd>
<p>It calculates the optimal amount of candy you should feed your Pokémon to reach a certain level.</p>
<p>This can be useful for Hyper Training, evolving, or teaching a level-up move to a Pokémon.</p>
</dd>
<dt><p>What are Exp. Candy?</p></dt>
<dd>
<p>Exp. Candy are a new kind of item introduced in Pokémon Sword &amp; Shield. These grant Exp. Points when consumed by Pokémon. As shown below, there are 5 sizes, each with a different Experience yield:</p>
<table>
<thead>
<tr>
<th>Item</th>
<th>Exp. Yield</th>
</tr>
</thead>
<tbody>
<tr>
<td>Exp. Candy XS</td>
<td>100</td>
</tr>
<tr>
<td>Exp. Candy S</td>
<td>800</td>
</tr>
<tr>
<td>Exp. Candy M</td>
<td>3,000</td>
</tr>
<tr>
<td>Exp. Candy L</td>
<td>10,000</td>
</tr>
<tr>
<td>Exp. Candy XL</td>
<td>30,000</td>
</tr>
</tbody>
</table>
</dd>
<dt><p>Where do you find Exp. Candy?</p></dt>
<dd>
<p>These items are drop rewards from Max Raid Battles. Raids with a higher number of stars will output larger candy.</p>
<p>Additionally, hikers spread throughout the Wild Area may hand out candy in exchange for Watts and you may also receive them as prizes from the Battle Cafés. However, farming candy through these methods is less efficient than raids.</p>
</dd>
<dt><p>What does optimal mean?</p></dt>
<dd>
<p>In a perfect world, candy is an unlimited resource that streams directly into the bellies of your dearest battle companions. Since this is not the case, it is wise to carefully allocate your candy in order to maximize their usefulness and prevent any waste of resources.</p>
<p>To calculate the optimal distribution of candy, this calculator solves a <a href="https://en.wikipedia.org/wiki/Integer_programming">mixed-integer linear programming</a> problem. In this problem, the objective function is set to minimize the number of candy required (<abbr class="var" title="Candy Number">c<sub>i</sub></abbr>) to meet certain Experience (<abbr class="var" title="Exp. Points">E</abbr>). At the same time, the surplus of Exp. Points is also minimized by taking into account the yields of each candy variant (<abbr class="var" title="Exp. Yield">Y<sub>i</sub></abbr>). In mathematical notation, this is represented as follows:</p>
<figure>
<dl class="math">
<dt>minimize</dt>
<dd>Σ(<abbr class="var" title="Exp. Yield">Y<sub>i</sub></abbr> + 1) <abbr class="var" title="Candy Number">c<sub>i</sub></abbr></dd>
<dt>subject to</dt>
<dd><abbr class="var" title="Exp. Points">E</abbr><abbr class="var" title="Exp. Yield">Y<sub>i</sub></abbr> <abbr class="var" title="Candy Number">c<sub>i</sub></abbr></dd>
<dd><abbr class="var">i</abbr> ∈ { XS, S, M, L, XL }</dd>
</dl>
</figure>
</dd>
<dt><p>What about Rare Candy?</p><dt>
<dd>
<p>Unlike Exp. Candy, Rare Candy yield an exponential amount of Experience. This means that consuming a Rare Candy at Lv. 1 does not equate consuming a Rare Candy at Lv. 99. Conversely, an Exp. Candy XL grants the same amount of Exp. Points regardless of level. Since the candy distribution problem has been posed as a linear problem, Rare Candies are not factored in.</p>
<p>If you want to take Rare Candies into consideration, lower the target level by the amount of candy you want to feed your Pokémon and remember that these should be applied <strong>after</strong> the Exp. Candy.</p>
</dd>
</dl>
</section>
<footer>
<p>
© of <a href="http://twitter.com/richi3f">richi3f</a>, <time datetime="2019">2019</time><br>
Pokémon is © of Nintendo, <time datetime="1995">1995</time>-<time datetime="2019">2019</time>
</p>
</footer>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="static/glpk.min.js"></script>
<script src="static/script.js"></script>
</body>
</html>