Pokemon Egg Move Calculator

Graph theory applied to Pokemon breeding chains — rebuilt to run in the page, with the impossible chains finally removed.

The problem

Older Pokemon games had a mechanic where certain moves could only be learned through breeding — you'd need a chain of Pokemon that could breed with each other, starting from one that naturally knew the move and ending with the one you actually wanted. The chains could get long and convoluted, and figuring them out manually meant cross-referencing egg group tables and move lists across multiple wiki pages.

It's a graph problem. Every Pokemon is a node. If two Pokemon share an egg group, there's an edge. You want the shortest path from any Pokemon that learns the move naturally to your target. I built this as a collaboration with the University of Illinois Data Driven Discovery group — a genuinely fun data modeling exercise, and where I learned most of what I know about web scraping. The dataset ended up at 917 species and 46,145 edges spread across one directed graph per egg move.

The UIUC-hosted version has been defunct for a while now, and this article spent years promising a rework. This is the rework: the calculator below runs entirely in this page — the same precomputed adjacency lists, fetched on demand, searched with a BFS in your browser, drawn with WebGL. No server, nothing to go defunct except the page you're reading.

Calculator

[ pick a move ]

[ each dot is a pokemon, each edge a shared egg group. bright amber = learns the move naturally, green = your chain, dark red = can't actually breed. hover to identify, click a dot to set it as the target. untick "breeding legality" to see the old, credulous behavior. ]

The Graph

For each egg move, the original scraper built an adjacency list: source nodes are Pokemon that learn the move by level-up or TM, target nodes are Pokemon that can only get it from an egg, and an edge connects a source to a target when they share an egg group. At query time you run a multi-source BFS from every natural learner at once and read off every shortest path to your target. NetworkX did this server-side in the original; forty lines of JavaScript do it client-side now.

the whole search JavaScript
// multi-source BFS: seed with every legal natural learner
sources.forEach(function (s) {
	if (canFather(s)) { dist[s] = 0; queue.push(s); }
});
while (queue.length) {
	var u = queue.shift();
	if (dist[u] > 0 && !canFather(u)) continue; // can receive, can't relay
	for (var v of adj[u]) {
		if (!canReceive(v)) continue;        // no legal mother for v
		if (dist[v] === -1) { dist[v] = dist[u] + 1; parents[v] = [u]; queue.push(v); }
		else if (dist[v] === dist[u] + 1) parents[v].push(u); // keep ALL shortest paths
	}
}

Those two canFather / canReceive checks are the entire difference between this version and the original — see below.

The Bugs

The old calculator's known failure mode was recommending breeding chains that are physically impossible in the games. Auditing the dataset for this rework, the root causes turned out to be a nice little taxonomy of everything the naive graph model ignores:

  • "Undiscovered" is not an egg group. It's the game's way of saying cannot breed — legendaries and baby Pokemon live there. The scraper treated it as a group like any other, which is how the old tool ended up suggesting, with a straight face, that you breed Zapdos with Pichu. The correct route to a Pichu egg move goes through Pikachu, because eggs hatch into the baby form — so baby targets now redirect through their evolved family.
  • Genderless Pokemon can't chain. Magnemite, Staryu, Porygon and friends breed only with Ditto, which means they can neither receive an egg move nor pass one to another species. The old graphs happily routed chains straight through them.
  • Female-only Pokemon can't relay. An egg always hatches into the mother's species — so Chansey, Kangaskhan, or Miltank can receive a move but the chain dies with them. (Nidoran♀ and Illumise get a pass: their eggs hatch their male counterparts, which is exactly how Nido chains work in-game.)
  • All-male lines can't receive. Tauros, Throh, Sawk, and the entire Tyrogue/Hitmon family have no female relative to be the mother, so they cannot get egg moves at all. The old tool would print you a Hitmonchan => Hitmonlee chain that no cartridge in existence can perform.

Running the audit over every move in the dataset: 7,246 move/target combinations, of which the old tool would claim 7,119 were breedable. 40 of those are flat-out impossible, and another 50 printed a shortest chain with an illegal link in it when a longer legal chain existed. Roughly one answer in eighty was a lie — which doesn't sound like much until it's your Hitmonchan.

The fix is two predicates checked during the search, derived from the egg group table plus the gender rules (verified against Bulbapedia): can this species father a cross-species egg, and can this species hatch from a legal mother. Family-aware exceptions — babies, the Nidoran twins, Shedinja-via-Nincada — are a twenty-entry lookup table. The "breeding legality" checkbox in the demo turns all of it off, if you'd like to watch the calculator confidently recommend breeding two Mewtwo.

Collaborators

Contributor Role Contribution
Aravind Sundararajan PhD Student Algorithm development, graph theory implementation
Anna Buyevich BS Computer Science Web interface development
Emily Chen PhD Computational Linguistics Data processing
Wade Fagen-Ulmschneider Faculty Advisor Project supervision

In modern Pokemon games the egg move system has been simplified to the point where a tool like this is mostly unnecessary, which is probably for the best. The graphs remain a lovely dataset to point algorithms at.