Пример #1
0
        // top recommendation
        // return updated results
        public Results GetResults(Results results, Recommendation[] recommendations, int[] recipe)
        {
            // iterate through all possible ingredients and calculate their likelihoods
            for (int i = 0; i < recommendations.Length; i++)
            {
                // pick top recommendation
                Recommendation recommendation = recommendations[0];

                // get top recommendation, discarding other ingredients also in the recipe
                for (int j = 0; j < recipe.Length && recipe.Contains(recommendations[j].ingredient.id); j++)
                {
                    recommendation = recommendations[j];
                    if (recommendations[j].ingredient.id == i)
                    {
                        break;
                    }
                }
                results = UpdateResults(results, recipe.Contains(i), recommendation.ingredient.id == i);
            }

            return(results);
        }