Wolfram Blog
Bernat Espigulé-Pons

Finding Pokémon GO’s Shortest Tour to Compute ’em All!

August 12, 2016 — Bernat Espigulé-Pons, Consultant, Technical Communications and Strategy Group

There’s a Computed Pokémon nearby! Here is a Poké Spikey. This will help you catch ’em all! In this blog post I will share with you several data insights about the viral social media phenomenon that is Pokémon GO. First I will get you familiarized with the original 151 Pokémon that have now invaded our real world, and then I’ll show you how to find the shortest tour to visit your nearby gyms.

A Poké Spikey—you can catch 'em all with the Wolfram Language!

I first came across Pokémon in 1999 when my twin brother and I got Pokémon Blue and Red versions, respectively, along with the Green and Yellow Game Boy Color handhelds shown below. To catch ’em all, we learned to team up. We used a Game Link Cable to trade (and later clone) Pokémon, so we could explore the Kanto region twice as fast. Nostalgia, no doubt, inspired millions to play the recently released Pokémon GO game.

Our first introduction to Pokémon

Pokémon GO has inherited the Pokémon from the Red and Blue versions. But the game dynamics are completely different. You can no longer “catch ’em” all from the sofa. You have to get some exercise in order to help Professor Willow study all these creatures that are now living in our augmented reality. There are three ways to get new specimens: catch ’em, evolve ’em or hatch their eggs using incubators, which requires you to walk a certain distance in kilometers (to honor the Meter Man). Once you catch ’em all, your Pokédex should look like this:

All 151 Pokémon currently available in Pokémon GO—click to see the (very long) full image

These are only Generation 1 Pokémon. But future releases of Pokémon GO will come with additional types of Pokémon, and the trading of Pokémon will be enabled. To make sense of all the different types of Pokémon currently available in the game, I’ve made the following graph (edges are connections of Pokémon with their type and their evolved Pokémon):

A graph of Pokémon with ther types and evolved forms—click for huge full-size image

Dots in blue are Pokémon from newer generations (not yet available in the augmented reality game) that evolve into Generation 1 Pokémon (currently available). I suspect that a possible way to get them in the future will be by means of breeding their evolved forms. Here is how to sneak a peek at these cuties:

A preview glimpse of newer-generation Pokémon

You can do the same for the forthcoming grown-ups. An extreme example is Eevee, which will eventually evolve into eight different types of Pokémon (currently it only evolves into Vaporeon, Jolteon, or Flareon).

Eevee evolutions

Oh! There is still one Pokémon evolving from Eevee missing, Sylveon:


A cool thing about having Pokémon data built into the Wolfram Language is that you can quickly get some insights into these fictional creatures. For example, here is how I’ve quantified all their different weights and heights using a ListLogLogPlot:

Pokémon height vs. weight

To inject these creatures into the real world, Pokémon GO uses the user-generated data from another augmented reality game called Ingress, also developed by Niantic. They have taken Ingress portals, in public spaces such as libraries, sculptures, churches, strange buildings, shops or places Ingress players found interesting, and they have dressed them up as Pokémon Gyms or PokéStops, depending on the portal’s popularity. PokéStops provide experience (XP points) and accessories (Pokéballs, Potions, …) to players who are checking them out. They also serve to attract wild Pokémon when a lure module is installed on them. If you live in a rural area with few PokéStops, you will be better off going to an urban area to play the game. (Most wild Pokémon don’t live in the wild.) For example, here is how insanely dense, in terms of Pokémon GO, a city like Paris can be: Applidium successfully extracted all the coordinates contained in a Pokémon GO app response from their office located in the middle of Paris. I downloaded and imported their KML file into a notebook to build the following custom GeoGraphics:

Extracted Pokémon GO coordinates in Paris

Black birds represent the wild Pokémon that spawned in the area when the fake player requested a response from the Pokémon GO servers. These Pokémon tend to cluster in parks and gardens surrounded by blue GeoMarkers, which are Ingress portals (points of interest) that have been converted into PokéStops and Gyms.

Pokémon Gyms are often placed in well-known public spaces that have their own geolocated entries in Wikipedia. Using our built-in WikipediaData function, I obtained the GeoPosition of locations in Paris with Wikipedia entries that are probably Gyms in the game (following the logic on how Gyms’ locations have been assigned in the Pokémon GO Game), and then I computed the FindShortestTour to visit ’em all:

Shortest path to all probable Pokémon Gyms in Paris, courtesy of the Wolfram Language

Brilliant! With this tour I could hatch three eggs and take control over 65 gyms! I must say that I haven’t tried this strategy yet. But I plan to put it to work in Barcelona. In another post, I talked about how my Runkeeper activities evolved over the span of a year. This was before Pokémon GO was released. These activities and the activities of millions of other players, including Olympic medalists, have dramatically changed.

Me hatching 1000 Pokémon GO eggs!

There is so much data in the Pokémon universe that can be computed with the Wolfram Language. For example, Pokémon have six stats that form the basis for how they perform in battle: hit points, attack, defense, special attack, special defense and speed. As with other numerical values in Wolfram|Alpha, you can refer to them by name in equations or query them with conditions or with ordinals. I will stop my exploration here, but I can’t wait to hear your adventures using computations in the realm of Pokémon.

Leave a Comment


MM Thomas

A first-rate example of tying a Mathematica-driven analysis to a popular phenomenon, for the benefit of future programmers still in high school. From a historical perspective, I never knew about the handheld units circa 1999 (as it was before my two sons were born, by a few years).

Posted by MM Thomas    August 26, 2016 at 12:30 pm
    Bernat Espigulé-Pons

    Thank you Matthew!

    Posted by Bernat Espigulé-Pons    September 7, 2016 at 12:39 pm
Daniel Smith

What’s up with this section of the tour? http://i.imgur.com/yDiDMNv.png

Posted by Daniel Smith    September 5, 2016 at 3:56 pm
    Bernat Espigulé-Pons

    Good catch Daniel!

    Strange enough this zigzagged path is slightly shorter than using the integer linear programming method:

    tour = FindShortestTour[gyms, Method -> "IntegerLinearProgramming"]


    Posted by Bernat Espigulé-Pons    September 7, 2016 at 12:38 pm

Leave a comment


Or continue as a guest (your comment will be held for moderation):