Exemplo n.º 1
0
        public void BowlerChange()
        {
            BowlerStat bowl1 = this.BowlingStats.First(x => x.IsOnStrike);
            BowlerStat bowl2 = this.BowlingStats.Last(x => !x.IsOnStrike);

            bowl1.ToggleOnStrike();
            bowl2.ToggleOnStrike();
        }
Exemplo n.º 2
0
        public string GetHighlighter(BowlerStat bowler)
        {
            if (bowler.IsOnStrike)
            {
                return("*");
            }

            return(String.Empty);
        }
Exemplo n.º 3
0
        public void CreateBowlingOrder(Team team)
        {
            for (int i = 0; i < team.Players.Count; i++)
            {
                BowlerStat bowler = new BowlerStat(team.Players[i].PlayerName, 0, 0, 0, 0, 0, 0, 0, false);
                if (i == team.Players.Count - 1)
                {
                    bowler.IsOnStrike = true;
                }

                this.BowlingStats.Add(bowler);
            }
        }
Exemplo n.º 4
0
        public void DisplayBowlingScoreCard()
        {
            Console.WriteLine("Bowling Scorecard for Team : {0}", this.Team2.TeamName);
            Console.WriteLine("{0,-20}{1}{2,10}{3,10}{4,10}{5,15}", Constants.PlayerName, "Overs", "Runs", "Wickets", "Maiden", "Dots");

            for (int i = 0; i < BowlingStats.Count; i++)
            {
                BowlerStat bowler = BowlingStats[i];

                Console.WriteLine("{0}{1,-10}{2,10}{3,10}{4,10}{5,10}{6,15}", bowler.PlayerName, GetHighlighter(bowler), bowler.OversBalled + "." + bowler.BallsInCurrentOverBalled, bowler.RunsConceded, bowler.WicketsTaken, bowler.MaidenOvers, bowler.DotBalls);
            }

            Console.WriteLine();
        }