Esempio n. 1
0
        public IList<IFrame> Create(IList<int> rolls)
        {
            var rollsWithNullShots = AddNullRollsDueToStrike(rolls);

            var frames = new List<IFrame>();
            IFrame currentFrame = null;

            for (var i = 0; i<rollsWithNullShots.Count; i++)
            {
                if ((i) % _configuration.NumberOfRollsPerFrame == 0)
                {
                    currentFrame = new Frame(frames.Count);
                    frames.Add(currentFrame);
                }

                currentFrame.Rolls.Add(new Roll(rollsWithNullShots[i]));
            }

            return frames;
        }
 public void AddFrame(Frame frame)
 {
     this.frames.Add(frame);
 }
 private int AddFrameRolls(Frame frame)
 {
     return frame.FirstRoll + frame.SecondRoll;
 }