예제 #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));
 }