A decision tree is a branching structure. Each internal node asks a question, and each answer moves you further down the tree until you reach a final result.
In Animal, the internal nodes are yes/no questions and the final leaves are animal guesses. The program does not need to understand animals in any deep way. It only needs to follow the path produced by the player’s answers.
Example tree
Questions are more powerful near the top
A broad question near the top can separate many possible animals. A narrow question near the bottom only separates two or three. That is why questions such as “Is it a mammal?” are often more useful early than very specific questions such as “Does it bark?”
Animal does not automatically optimise its tree. If users add weak or oddly placed questions, the tree can become clumsy. That clumsiness is historically interesting because it shows that the program’s intelligence depends heavily on the human trainer.
How this maps to JSON
A modern browser version can store the same structure in a small JSON object:
{
"type": "question",
"text": "Does it swim?",
"yes": { "type": "animal", "text": "fish" },
"no": { "type": "animal", "text": "bird" }
}
That makes it easy to save the tree in the browser, export it as a file, or inspect how the game has changed over time.
Why this is useful beyond Animal
Decision trees are still useful because they are explainable. You can trace exactly why a conclusion was reached. Animal is therefore a friendly toy example of a much broader idea: systems can make decisions by asking questions in a structured order.