Learning to use decision trees
We already learned the power and flexibility of decision trees for adding a decision-making component to our game. Furthermore, we can also build them dynamically through supervised learning. That's why we're revisiting them in this chapter.
There are several algorithms for building decision trees that are suited for different uses such as prediction and classification. In our case, we'll explore decision-tree learning by implementing the ID3 algorithm.
Getting ready…
Despite having built decision trees in a previous chapter, and the fact that they're based on the same principles as the ones that we will implement now, we will use different data types for our implementation needs in spite of the learning algorithm.
We will need two data types: one for the decision nodes and one for storing the examples to be learned.
The code for the DecisionNode
data type is as follows:
using System.Collections.Generic; public class DecisionNode { public string testValue; ...