Ejemplo n.º 1
0
        private void PrintBallUpdates(MatchStats matchStat)
        {
            var print = (matchStat.Balls / 6) + "." + (matchStat.Balls % 6) + "  " + matchStat.CurrentPlayer.Name;

            print += (matchStat.CurrentRuns != -1) ? " scores " + matchStat.CurrentRuns + " runs " : " is out!";

            if (matchStat.Balls % 6 == 0)
            {
                var    remainingBalls = matchStat.TotalBalls - matchStat.Balls;
                string requiredRuns   = matchStat.RequiredRuns != 0 ? matchStat.RequiredRuns.ToString() : " - ";
                if (remainingBalls != 0)
                {
                    print += "\n\n" + remainingBalls / 6 + " overs left. " + requiredRuns + " to win.";
                }
            }

            Console.WriteLine(print);
        }
Ejemplo n.º 2
0
 public MatchSimulator(MatchStats matchStats)
 {
     _matchStat = matchStats;
 }