Skip to content

🎮 Calculate Pokemon Sword and Shield VGC metagame matchups via CLI with pikacalc, powered by Node.js

Notifications You must be signed in to change notification settings

GriffinLedingham/pikacalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pikacalc

Calculate Pokemon Sword and Shield VGC metagame matchups via CLI with pikacalc. Find out how target Pokemon simulate against other meta threats, check specific moves, and more.

Setup

yarn setup

(The compile step in the damage-calc submodule will actually fail, but don't worry, our script's setup still worked)

Usage

yarn calc <Absolute Filepath to usage .json> <Attacker> <Defender> [Move Name]

yarn genetic <Absolute Filepath to usage .json> <Attacker> <# of Pokemon to sim against> <Population Size>

Usage .json mentioned above may be compiled using my tool smogon-usage-parser. This should be an absolute filepath to the ouput file generated by that tool.

Calc Example

yarn calc ~/YOUR PATH/smogon-usage-parser/out/2020-01/gen8vgc2020-1760.json Gyarados Rotom-Wash

yarn calc v0.15.1
$ node dist/index.js ~/YOUR PATH/smogon-usage-parser/out/2020-01/gen8vgc2020-1760.json Gyarados Rotom-Wash
--- Waterfall -------------
252 Atk Gyarados Waterfall vs. 0 HP / 0 Def Rotom-Wash: 32-38 (25.6 - 30.4%) -- guaranteed 4HKO
252 Atk Gyarados Waterfall vs. 252 HP / 0 Def Rotom-Wash: 32-38 (20.3 - 24.2%) -- guaranteed 5HKO
252 Atk Gyarados Waterfall vs. 0 HP / 252 Def Rotom-Wash: 25-30 (20 - 24%) -- guaranteed 5HKO
252 Atk Gyarados Waterfall vs. 252 HP / 252 Def Rotom-Wash: 25-30 (15.9 - 19.1%) -- possible 6HKO
--- Power Whip -------------
252 Atk Gyarados Power Whip vs. 0 HP / 0 Def Rotom-Wash: 126-150 (100.8 - 120%) -- guaranteed ***** OHKO *****
252 Atk Gyarados Power Whip vs. 252 HP / 0 Def Rotom-Wash: 126-150 (80.2 - 95.5%) -- guaranteed 2HKO
252 Atk Gyarados Power Whip vs. 0 HP / 252 Def Rotom-Wash: 102-120 (81.6 - 96%) -- guaranteed 2HKO
252 Atk Gyarados Power Whip vs. 252 HP / 252 Def Rotom-Wash: 102-120 (64.9 - 76.4%) -- guaranteed 2HKO
--- Bounce -------------
252 Atk Gyarados Bounce vs. 0 HP / 0 Def Rotom-Wash: 33-40 (26.4 - 32%) -- guaranteed 4HKO
252 Atk Gyarados Bounce vs. 252 HP / 0 Def Rotom-Wash: 33-40 (21 - 25.4%) -- 0.4% chance to 4HKO
252 Atk Gyarados Bounce vs. 0 HP / 252 Def Rotom-Wash: 27-32 (21.6 - 25.6%) -- 0.3% chance to 4HKO
252 Atk Gyarados Bounce vs. 252 HP / 252 Def Rotom-Wash: 27-32 (17.1 - 20.3%) -- possible 5HKO
--- Earthquake -------------
Earthquake doesn't affect Rotom-Wash!
Earthquake doesn't affect Rotom-Wash!
Earthquake doesn't affect Rotom-Wash!
Earthquake doesn't affect Rotom-Wash!
--- Stone Edge -------------
252 Atk Gyarados Stone Edge vs. 0 HP / 0 Def Rotom-Wash: 53-63 (42.4 - 50.4%) -- 1.2% chance to 2HKO
252 Atk Gyarados Stone Edge vs. 252 HP / 0 Def Rotom-Wash: 53-63 (33.7 - 40.1%) -- guaranteed 3HKO
252 Atk Gyarados Stone Edge vs. 0 HP / 252 Def Rotom-Wash: 42-50 (33.6 - 40%) -- guaranteed 3HKO
252 Atk Gyarados Stone Edge vs. 252 HP / 252 Def Rotom-Wash: 42-50 (26.7 - 31.8%) -- guaranteed 4HKO
✨  Done in 0.27s.

Genetic Example

yarn genetic ~/YOUR PATH/smogon-usage-parser/out/2020-01/gen8vgc2020-1760.json Gyarados 10 100

Understanding the Genetic Example Output

The output from this command displays the most fit offspring, every other generation of our genetic algorithm. What this means is that the genetic algorithm randomises 100 parents here with varying EV spreads, and simulates each of them against the top 10 Pokemon in the VGC 2020 meta. This simulation determines matchup competancy in a head-to-head between the two Pokemon. From these head-to-heads, a fitness score for the parent is tallied up.

This parent then creates an offspring with another random parent, averaging their EV spreads to create a child sharing in traits from both parents. These children can have genetic mutations, in which they will pick up a deviation from their parents (an increase or decrease by a margin in a random stat).

This will continue with offspring breeding new offspring, up to 4000 iterations. Every iteration, a chunk of the offspring are killed off, while the fitter ones carry forward. By the time you get into the thousands of iterations, you stop seeing significant change, as the less fit offspring have been removed.

What this produces, is a "best fit" EV spread for the Pokemon, in which it will do as much damage as possible, while also trying to remain as defensive as possible. This leads to many hybrid spreads being generated, but common meta spreads often turn up from this method (Gyarados investing most heavily into Attack and Speed).

Each row in the sample output below displays another iteration forward in generations, and the "best fit" EV spread that has been found up to this point. Decimals are mainted here, as to not lose precision, but obviously must be rounded off before implementing a resulting EV spread.

There are MANY reasons that this method is flawed, and will not produce optimal EV spreads for the VGC format (this produces better results for Single-battle formats). This tool should be taken as proof of concept, and a platform to continue iteration on, and not a generator for a team to take to your next Regionals. 😬

$ node dist/Genetic.js ~/YOUR PATH/smogon-usage-parser/out/2020-01/gen8vgc2020-1760.json Gyarados 10 100
0 '-1.5681' [ 100, 52, 80, 88, 68, 120 ]
2 '-1.5681' [ 100, 52, 80, 88, 68, 120 ]
4 '-1.5681' [ 100, 52, 80, 88, 68, 120 ]
6 '-1.4519' [ 100, 52, 84, 84, 68, 120 ]
8 '-1.4519' [ 100, 52, 84, 84, 68, 120 ]
10 '-1.4519' [ 100, 52, 84, 84, 68, 120 ]
12 '-1.4519' [ 100, 52, 84, 84, 68, 120 ]
14 '-1.3480' [ 102.109375, 60.171875, 85.03125, 87.4375, 56.203125, 117.046875 ]
16 '-1.3480' [ 102.109375, 60.171875, 85.03125, 87.4375, 56.203125, 117.046875 ]
18 '-1.3480' [ 102.109375, 60.171875, 85.03125, 87.4375, 56.203125, 117.046875 ]
20 '-1.3480' [ 102.109375, 60.171875, 85.03125, 87.4375, 56.203125, 117.046875 ]
22 '-1.3480' [ 102.109375, 60.171875, 85.03125, 87.4375, 56.203125, 117.046875 ]
24 '-1.2313' [ 108.109375, 60.171875, 87.03125, 85.4375, 50.203125, 117.046875 ]
26 '-1.2313' [ 108.109375, 60.171875, 87.03125, 85.4375, 50.203125, 117.046875 ]
28 '-1.1370' [ 108.109375, 60.171875, 95.03125, 81.4375, 46.203125, 117.046875 ]
30 '-1.1370' [ 108.109375, 60.171875, 95.03125, 81.4375, 46.203125, 117.046875 ]
32 '-1.1370' [ 108.109375, 60.171875, 95.03125, 81.4375, 46.203125, 117.046875 ]
34 '-1.0532' [ 108.987548828125,
  69.617431640625,
  86.57177734375,
  80.3896484375,
  42.429443359375,
  120.004150390625 ]
36 '-1.0532' [ 108.987548828125,
  69.617431640625,
  86.57177734375,
  80.3896484375,
  42.429443359375,
  120.004150390625 ]
38 '-1.0221' [ 116.162353515625,
  60.899658203125,
  94.10107421875,
  77.2548828125,
  41.746826171875,
  117.835205078125 ]
40 '-0.95892' [ 109.1358642578125,
  68.5357666015625,
  94.566162109375,
  77.34619140625,
  40.9749755859375,
  117.4410400390625 ]

About

🎮 Calculate Pokemon Sword and Shield VGC metagame matchups via CLI with pikacalc, powered by Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published