Ejemplo n.º 1
0
 public void WicketBallBowled(Batsman batsman)
 {
     var ball = new Ball();
     ball.Runs = 0;
     ball.IsPenaltyBall = false;
     WicketBall += ball.OnWicketBall;
     DeliverBall(ball);
     OnWicketBall(batsman);
 }
Ejemplo n.º 2
0
        public void DeliverBall(int runs, bool isFail)
        {
            if (isFail)
            {
                PenaltyBallDeliverBall(runs);
            }
            else
            {
                var ball = new Ball();
                ball.Runs = runs;
                OnBallBowled(runs);
                OverBalls.Add(ball);
            }

            IsOverComplete();
        }
Ejemplo n.º 3
0
 private string IsPenaltyBall(Ball ball)
 {
     if (ball.IsPenaltyBall)
     {
         return "p";
     }
     else
     {
         return "";
     }
 }
Ejemplo n.º 4
0
 private void PenaltyBallDeliverBall(int runs)
 {
     var ball = new Ball();
     ball.Runs = runs;
     ball.IsPenaltyBall = true;
     if (hasPenaltyBall)
     {
         runs += 3;
     }
     else
     {
         runs += 1;
     }
     hasPenaltyBall = true;
     OnBallBowled(runs);
     OverBalls.Add(ball);
 }
Ejemplo n.º 5
0
 private void DeliverBall(Ball ball)
 {
     OnBallBowled(ball.Runs);
     OverBalls.Add(ball);
 }