private IEnumerable<int> Sum(Frame[] frames) { var i = 0; while (i < frames.Length && i < 10) { if(frames[i].IsSpare()) { yield return frames[i + 1].Roll1; } i++; } }
private IEnumerable<int> Sum(Frame[] frames) { var i = 0; while (i < frames.Length && i < 10) { if (Frame.IsStrike(frames[i].Roll1)) { if (Frame.IsStrike(frames[i + 1].Roll1)) { yield return frames[i + 1].Roll1 + frames[i + 2].Roll1; } else { yield return frames[i + 1].Roll1 + frames[i + 1].Roll2; } } i++; } }