Esempio n. 1
0
        /// <summary>
        /// Filter the desires to select a new current intention
        /// </summary>
        /// <param name="potentialDesires">Potential desires to filter out and use for intentions</param>
        private void Filter(IEnumerable <Desire <TAction, TAgent, TEnvironment> > potentialDesires)
        {
            //choose strongest achievable desire and add it as a base intention
            CurrentIntentions.Clear();
            potentialDesires = potentialDesires.OrderByDescending(y => y.Strength);

            //now add intentions that do not conflict
            foreach (var potentialDesire in potentialDesires)
            {
                if (CurrentIntentions.All(x => x.IsCompatibleWith(potentialDesire)))
                {
                    CurrentIntentions.Add(new Intention <TAction, TAgent, TEnvironment>(potentialDesire));
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Check to see if our current intention impossible?
 /// </summary>
 /// <returns>True if our current intention impossible to achieve, false otherwise</returns>
 private bool IntentionImpossible() => !CurrentIntentions.All(x => x.IsAchievable());
Esempio n. 3
0
 /// <summary>
 /// Check to see if our current intention has succeeded already
 /// </summary>
 /// <returns>True if we succeeded already in our current intention, false otherwise</returns>
 private bool IntentionSucceeded() => CurrentIntentions.All(x => x.IsFulfilled());