Exemple #1
0
        public TOption GetBest(IAIContext context, IList <TOption> options)
        {
            TOption tOption = default(TOption);
            float   single  = Single.MinValue;
            int     count   = options.Count;

            for (int i = 0; i < count; i++)
            {
                TOption item    = options[i];
                float   single1 = 0f;
                int     num     = this._scorers.Count;
                for (int j = 0; j < num; j++)
                {
                    IOptionScorer <TOption> optionScorer = this._scorers[j];
                    if (!optionScorer.isDisabled)
                    {
                        single1 += optionScorer.Score(context, item);
                    }
                }
                if (single1 > single)
                {
                    tOption = item;
                    single  = single1;
                }
            }
            return(tOption);
        }
Exemple #2
0
        public void GetAllScores(IAIContext context, IList <TOption> options, IList <ScoredOption <TOption> > optionsBuffer)
        {
            int count = options.Count;

            for (int i = 0; i < count; i++)
            {
                TOption item   = options[i];
                float   single = 0f;
                int     num    = this._scorers.Count;
                for (int j = 0; j < num; j++)
                {
                    IOptionScorer <TOption> optionScorer = this._scorers[j];
                    if (!optionScorer.isDisabled)
                    {
                        single += optionScorer.Score(context, item);
                    }
                }
                optionsBuffer.Add(new ScoredOption <TOption>(item, single));
            }
        }