Exemplifying waypoints for decision making
Just as we learned in Chapter 3, Decision Making, evaluating a waypoint's value it is not flexible enough, but rather a more complex process. In this case, the solution is to apply techniques learned previously and incorporate them into the waypoint for tackling the problem.
The key idea behind this recipe is to add a condition to the node so that it can be evaluated, for example, using a decision tree and develop more complex heuristics for computing a waypoint's value.
Getting ready
It is important to read the recipe Implementing a finite-state machine, in Chapter 3, Decision Making, before diving in.
How to do it...
We will make a little adjustment to the Waypoint
class:
- Add a member variable to the
Waypoint
class:
public Condition condition;
- Assign the condition class to be used, for example
ConditionFloat
:
condition = new ConditionFloat();
How it works...
The pseudo-abstract class Condition
, which we learned about previously, has a member function called...