示例#1
0
文件: UI.cs 项目: olafbauer/Tennis
        public static void Scoreboard(Match m)
        {
            List <Score> scores = m.Sets.Select(s => s.CurrentScore()).ToList();
            var          range  = Enumerable.Range(1, scores.Count);
            List <int>   p1     = scores.Select(score => score.a).ToList();
            List <int>   p2     = scores.Select(score => score.b).ToList();

            if (Match.IsOver(m))
            {
                Console.WriteLine(WinString(Match.CurrentScore(m)));
            }

            Console.WriteLine(range.Aggregate("Set        |", FormatAgg));
            Console.WriteLine("---------------------------");
            Console.WriteLine(p1.Aggregate("Player A   |", FormatAgg));
            Console.WriteLine("---------------------------");
            Console.WriteLine(p2.Aggregate("Player B   |", FormatAgg));
            Console.WriteLine("---------------------------");
        }
示例#2
0
文件: Match.cs 项目: olafbauer/Tennis
 public static bool IsOver(Match match)
 {
     return(Match.CurrentScore(match).HasMin(Settings.MinSets));
 }