Exemple #1
0
        /// <summary>
        /// An extension method to display the frames and their scores.
        /// </summary>
        public static string DisplayScoreCard(this ScoreCard scoreCard)
        {
            StringBuilder result = new StringBuilder();

            foreach (BowlingFrame frame in scoreCard.GetAllFrames())
            {
                result.Append($"{frame.PrintFrame()}\t");
            }
            result.AppendLine();
            foreach (int?score in scoreCard.GetFramesScores())
            {
                result.Append($"{score}\t");
            }

            return(result.ToString());
        }
Exemple #2
0
 /// <summary>
 /// Returns the current score of a given scorecard
 /// </summary>
 public static int GetScore(ScoreCard scoreCard)
 {
     // Receives an array of all frames' scores and summarize it
     return(scoreCard.GetFramesScores().Sum().Value);
 }