Пример #1
0
        private static void PrintForecast(EloCalculator calculator, out TeamForecast[] teamList)
        {
            Console.WriteLine("Команды: \n");

            teamList = _competition.teamList.Select(t => new TeamForecast()
            {
                Id = t.id, Name = t.name, Elo = 1000
            }).ToArray();
            var forecastResult = calculator.CalculateForecast(teamList, _competition.gameList);

            foreach (var teamForecast in teamList.OrderByDescending(t => t.Elo))
            {
                var delimiter = " \t\t ";
                if (teamForecast.Name.Length >= 11)
                {
                    delimiter = " \t ";
                }
                if (teamForecast.Elo < 1000)
                {
                    delimiter += " ";
                }
                Console.Write(new string(' ', Console.WindowWidth - 1));
                Console.CursorLeft = 0;
                Console.WriteLine(teamForecast.Id + " - " + teamForecast.Name + delimiter + teamForecast.Elo.ToString("0.000"));
            }
            Console.WriteLine("Delta = " + forecastResult[0].ToString("0.0000") + ", Iterations = " + forecastResult[1].ToString("0"));
        }
Пример #2
0
        public static void Forecast()
        {
            Console.Clear();
            var calculator = new EloCalculator();
            var teamList   = new TeamForecast[0];

            PrintForecast(calculator, out teamList);
            Console.WriteLine("\nВведите список команд. Пустая строка - возврат назад.\n");

            var input = "";

            do
            {
                input = Console.ReadLine();
                var resultSplit = input.Split(' ');
                if (resultSplit.Length != 2)
                {
                    continue;
                }

                var teamOne = Convert.ToInt32(resultSplit[0]);
                var teamTwo = Convert.ToInt32(resultSplit[1]);
                Console.CursorLeft = 0;
                Console.CursorTop  = Console.CursorTop - 1;
                decimal fcOne, fcTwo;
                calculator.Forecast(teamList.First(t => t.Id == teamOne).Elo, teamList.First(t => t.Id == teamTwo).Elo,
                                    out fcOne, out fcTwo);
                Console.WriteLine(GetTeam(teamOne) + " - " + GetTeam(teamTwo) + "\t\t" + Math.Round(fcOne, 4) + " - " +
                                  Math.Round(fcTwo, 4));
            } while (input != "");
            OpenCompetition();
        }
Пример #3
0
 private static void PrintForecast(EloCalculator calculator)
 {
     TeamForecast[] tf = new TeamForecast[0];
     PrintForecast(calculator, out tf);
 }