static AnalyzerResult GetWinner(Ranking winsBr, Ranking winsLu, Ranking winsDi, Ranking winsDe, out Ranking firstPlace, out Ranking secondPlace)
        {
            var meals = new Ranking[] {winsBr, winsLu, winsDi, winsDe};
             var sorted = (from m in meals orderby m.Score descending select m).ToArray();

             firstPlace = sorted[0];

             secondPlace = sorted[1].Score/sorted[0].Score > 0.8f ? sorted[1] : null;

             var ret = new AnalyzerResult(firstPlace.Type, (secondPlace != null ? secondPlace.Type : Category.None));
             return ret;
        }
Ejemplo n.º 2
0
        static AnalyzerResult GetWinner(Ranking winsBr, Ranking winsLu, Ranking winsDi, Ranking winsDe, out Ranking firstPlace, out Ranking secondPlace)
        {
            var meals  = new Ranking[] { winsBr, winsLu, winsDi, winsDe };
            var sorted = (from m in meals orderby m.Score descending select m).ToArray();

            firstPlace = sorted[0];

            secondPlace = sorted[1].Score / sorted[0].Score > 0.8f ? sorted[1] : null;

            var ret = new AnalyzerResult(firstPlace.Type, (secondPlace != null ? secondPlace.Type : Category.None));

            return(ret);
        }
Ejemplo n.º 3
0
 private static AnalyzerResult GetWinner(Ranking winsBreakfast, Ranking winsLunch, Ranking winsDinner, Ranking winsDessert)
 {
     var meals = new Ranking[] { winsBreakfast, winsLunch, winsDinner, winsDessert };
     var sortedMealsByScore = meals.OrderByDescending(meal => meal.Score).ToArray();
     var firstPlace = sortedMealsByScore[0];
     var secondPlace = (sortedMealsByScore[1].Score / sortedMealsByScore[0].Score > 0.8f) ? sortedMealsByScore[1] : null;
     var result =
         new AnalyzerResult(
             firstPlace.Type,
             secondPlace != null
             ? secondPlace.Type
             : Category.None);
     return result;
 }