add heuristic(no args) to GoalComposite

GoalNear and GoalRunAway are still missing it
This commit is contained in:
ZacSharp 2020-09-06 16:42:05 +02:00
parent 45dc8b949d
commit 7255ccbdaa
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
1 changed files with 10 additions and 0 deletions

View File

@ -57,6 +57,16 @@ public class GoalComposite implements Goal {
return min;
}
@Override
public double heuristic() {
double min = Double.MAX_VALUE;
for (Goal g: goals) {
//just take the highest value that is guaranteed to be inside the goal
min = Math.min(min, g.heuristic());
}
return min;
}
@Override
public String toString() {
return "GoalComposite" + Arrays.toString(goals);