/// <summary> /// Determines which desires will become intentions or which intentions should remain or be deleted. /// </summary> /// <param name="percepts"></param> private void Filter() { Intentions.Clear(); foreach (var desire in Desires) { if (desire.SubDesires.Count > 0) { var primaryDesires = desire.GetSubDesires(); primaryDesires.Reverse(); foreach (var d in primaryDesires) { Intentions.Push(Intention.FromDesire(d)); } } else { Intentions.Push(Intention.FromDesire(desire)); } } if (Intentions.Any() && !ExistsPlan()) { ChoosePlan(); } }
public static Intention FromDesire(Desire desire) { var result = new Intention { Name = desire.Name, SubDesires = new List <Desire>(desire.SubDesires), Predicate = desire.Predicate }; return(result); }