public override ResponseVotes Evaluate(IAiContext context) { var votes = new ResponseVotes(); var matchingResponses = context.AvailableResponses.OfType<TRESPONSE>().Where(r => Child1.Evaluate(context).IsMatch(r)); matchingResponses.ForEach(response => context.VoteFor(response, Child2.Evaluate(context))); return votes; }
public override ResponseVotes Evaluate(IAiContext context) { var buyTreasureResponses = context.AvailableResponses.OfType <BuyCardResponse>().OrderByDescending(r => r.Item.Coins); if (buyTreasureResponses.Any()) { return(context.VoteFor(buyTreasureResponses.First(), 1)); } return(context.Votes); }