# cathyjf/PokemonSwitchStats

Fetching contributors…
Cannot retrieve contributors at this time
80 lines (59 sloc) 3.54 KB

# 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.

## Dependencies

• 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.

## Definitions

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)