Building a 365-Species Linnaean LCA Taxonomy Engine in Vanilla JS (Zero Backend)
When designing Guess The Animal — a free daily browser deduction game spanning 365 real wildlife species, 730 curated photographs, and 201 authentic field recordings — we wanted players to receive biologically meaningful
When designing Guess The Animal — a free daily browser deduction game spanning 365 real wildlife species, 730 curated photographs, and 201 authentic field recordings — we wanted players to receive biologically meaningful clues instead of arbitrary string hints.
Rather than querying a remote server on every guess, we modeled the entire phylogenetic tree as a compact static dataset (open-sourced under CC0/MIT at soler-yang/animal-taxonomy-365) and compute Lowest Common Ancestor (LCA) ranks client-side in O(1) depth steps.
Encoding Taxonomic Paths for Instant Client-Side Clues
Each species record stores its verified Linnaean lineage as a fixed 6-rank tuple:
{
"id": "snow-leopard",
"name": "Snow Leopard",
"lineage": ["Animalia", "Chordata", "Mammalia", "Carnivora", "Felidae", "Panthera"],
"diet": "Carnivore",
"habitat": ["Alpine", "Mountain"],
"iucn": "Vulnerable"
}
Given the mystery species target and a player's guess, finding their closest evolutionary divergence takes five array comparisons:
const RANKS = ["Kingdom", "Phylum", "Class", "Order", "Family", "Genus"];
export function findLowestCommonRank(targetLineage, guessLineage) {
let matchedDepth = -1;
for (let i = 0; i < RANKS.length; i++) {
if (targetLineage[i] === guessLineage[i]) {
matchedDepth = i;
} else {
break;
}
}
return matchedDepth >= 0
? { depth: matchedDepth, rank: RANKS[matchedDepth], clade: targetLineage[matchedDepth] }
: { depth: -1, rank: "None", clade: "Unrelated" };
}
If the player guesses African Lion when the answer is Snow Leopard, both share Mammalia -> Carnivora -> Felidae -> Panthera, returning Genus: Panthera (depth 5) immediately — guiding the player down the real evolutionary tree instead of forcing blind memorization.
Extending the Engine to Audio & Birding Modes
Because every species carries clean taxonomic tags, adding specialized daily modes required zero duplicate data tables:
-
Bird Guessing Game filters strictly on
Class === "Aves"with real field photographs and bird calls. - Animal Sound Game pairs 201 verified nature recordings with instant Web Audio playback and taxonomic narrowing.
- Every daily challenge uses a deterministic UTC date hash so players worldwide solve the same species without requiring accounts or backend state.
Open Dataset & Live Play
- Open CC0/MIT 365-Species Dataset + LCA CLI: https://github.com/soler-yang/animal-taxonomy-365
- Play live in browser (free, zero login, zero AI-generated photos/audio): https://guesstheanimalgame.com/
Happy to discuss taxonomic edge cases, IUCN status normalization, or compact static game data architectures in the comments!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.