Program that prepares statistics regarding Pokémon switching.
Switch branches/tags
Nothing to show
Latest commit 6708a14 Jan 8, 2013 @cathyjf cathyjf Revised

Pokémon Switching Statistics

This is a program that reads Shoddy Battle battle logs in order to prepare statistics regarding Pokémon switching. This program was written by Cathy Fitzpatrick in September 2009 and it is licensed under the GNU Affero General Public License, version 3 or later.

The logs directory contains several sample logs to run the program on. The main.php program parses the input logs and produces a results output file. The sort.php program reads the results file (sample: results-2009-08.bin) and produces a set of HTML output files.


  • This program requires PHP.
  • The sort.php program optionally uses HTML Tidy, which is assumed to be on the PATH and named tidy. If tidy is not found, the program will still work; the only difference is that the HTML output will not be indented.


In order to understand the statistics, it is necessary to define some terms.

Except for at the start of the battle, whenever one player sends out a new Pokémon X (including through Baton Pass and U-turn), if there is a Pokémon Y on the opponent's side of the field, then we say that Pokémon X switched into Pokémon Y. We call Pokémon X the subject of the switch in and Pokémon Y the object of the switch in.

We can sort the switch in statistics both by subject and by object. Given a particular Pokémon X, the statistics sorted by subject tell you the most common Pokémon that Pokémon X switches into. Similarly, given a particular Pokémon X, the statistics sorted by object tell you the most common Pokémon who switch into Pokémon X.

Interpretation example

Here is an example of how to interpret this data. This is an excerpt from the statistics sorted by subject showing you the most common Pokémon that Gyarados switches into on the Standard ladder:

  1. Scizor - 7.12% (12166)
  2. Heatran - 6.37% (10897)
  3. Swampert - 4.85% (8284)
  4. Infernape - 4.62% (7907)
  5. Salamence - 3.86% (6597)
  6. Gyarados - 3.7% (6321)
  7. Lucario - 3.34% (5715)

This means that in August 2009, Gyarados switched into Scizor 12166 times, which was 7.12% of all switches in which Gyarados was the subject.

August 2009 data

This program was run on the battle logs from Smogon's Shoddy Battle server for August 2009. Here are the results as generated by this program:

Further reading

You may be interested in more information about Shoddy Battle's statistical functionality.