-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
157 lines (136 loc) · 9.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="A calculator for Exp. Candy optimization in Pokémon Sword & Shield, Pokémon Legends: Arceus, and Pokémon Scarlet & Violet.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="static/bg.png">
<link rel="stylesheet" href="static/style.css">
<title>Candy Calc</title>
</head>
<body>
<main>
<section id="calc">
<h1>Candy Calc</h1>
<p>A calculator for <abbr title="Experience Candy">Exp. Candy</abbr> optimization in Pokémon games. Read the <a href="#faq">FAQ</a> for more information.</p>
<form autocomplete="off">
<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"><abbr title="Experience">Exp.</abbr> 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" pattern="\d*" min="2" max="100" value="50"></dd>
</dl>
<table>
<tbody>
<tr>
<th>Candy</th>
<th>In Bag</th>
<th rowspan="6"><input type="submit" value="Calculate"></th>
<th>Required</th>
</tr>
</tbody>
</table>
<template data-target="#calc table tbody">
<tr>
<td><label></label></td>
<td><input type="number" pattern="\d*" min="0" max="999" value="999"></td>
<td><input type="text" readonly tabindex="-1" value="-"></td>
</tr>
</template>
</form>
<p id="log" hidden></p>
</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 <abbr title="Experience Candies">Exp. Candies</abbr>?</p></dt>
<dd>
<p>An <abbr title="Experience Candy">Exp. Candy</abbr> is a new kind of item introduced in Pokémon Sword & Shield. These grant <abbr title="Experience">Exp.</abbr> Points when consumed by Pokémon. As shown below, there are 5 sizes, each with a different Experience yield:</p>
<table>
<thead>
<tr>
<th>Candy</th>
<th><abbr title="Experience">Exp.</abbr> Yield</th>
</tr>
</thead>
<tbody>
<tr>
<td><abbr title="Extra Small Experience Candy">Exp. Candy XS</abbr></td>
<td>100</td>
</tr>
<tr>
<td><abbr title="Small Experience Candy">Exp. Candy S</abbr></td>
<td>800</td>
</tr>
<tr>
<td><abbr title="Medium Experience Candy">Exp. Candy M</abbr></td>
<td>3,000</td>
</tr>
<tr>
<td><abbr title="Large Experience Candy">Exp. Candy L</abbr></td>
<td>10,000</td>
</tr>
<tr>
<td><abbr title="Extra Large Experience Candy">Exp. Candy XL</abbr></td>
<td>30,000</td>
</tr>
</tbody>
</table>
<p><abbr title="Experience Candies">Exp. Candies</abbr> are also obtainable in Pokémon Legends: Arceus and Pokémon Scarlet & Violet.</p>
</dd>
<dt><p>How do you use this calculator?</p></dt>
<dd><p>Enter the species of your Pokémon (the Experience Curve will be auto-completed), its current level, and the target level you want it to reach. Additionally, you may indicate how many candies of each type are left in your Bag. Then, click "Calculate" and voilà!</p></dd>
<dt><p>Where do you find <abbr title="Experience Candy">Exp. Candy</abbr>?</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="Experience Points">E</abbr>). At the same time, the surplus of <abbr title="Experience">Exp.</abbr> Points is also minimized by taking into account the yields of each candy variant (<abbr class="var" title="Experience 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="Experience 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="Experience Points">E</abbr> ≤ Σ <abbr class="var" title="Experience 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 <abbr title="Experience Candy">Exp. Candy</abbr>, Rare Candy yield an exponential amount of Experience as level increases. This means that consuming a Rare Candy at <abbr title="Level 1">Lv. 1</abbr> does not equate consuming a Rare Candy at <abbr title="Level 99">Lv. 99</abbr>. Conversely, an <abbr title="Extra Large Experience Candy">Exp. Candy XL</abbr> grants a fixed amount of <abbr title="Experience">Exp.</abbr> 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 Rare Candies you want to feed your Pokémon and remember that these should be applied <strong>after</strong> the <abbr title="Experience Candy">Exp. Candy</abbr>.</p>
</dd>
<dt><p>What about other modifiers?</p></dt>
<dd><p>The yield of <abbr title="Experience Candies">Exp. Candies</abbr> is not modified by other factors such as holding a Lucky Egg.</p></dd>
<dt><p>I have feedback/questions/bug report.</p></dt>
<dd><p>Contact me on <a href="http://twitter.com/richi3f">Twitter</a> or <a href="https://github.com/richi3f/candy-calc/issues/new">open an Issue</a> in <a href="https://github.com/richi3f/candy-calc">this project's repository</a>.</p></dd>
</dl>
</section>
<footer>
<p>
© of <a href="http://twitter.com/richi3f">richi3f</a>, <time datetime="2023">2023</time><br>
Pokémon is © of Nintendo, <time datetime="1995">1995</time>-<time datetime="2023">2023</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>