public void GetRollScoreCanBeUsedToGetASingleRollsScore() { Frame f = new Frame(); f.AddRoll(new Roll('1')); f.AddRoll(new Roll('8')); Assert.AreEqual(1, f.GetRollScore(0)); Assert.AreEqual(8, f.GetRollScore(1)); }
public void GetRollScoreThrowsExceptionWhenIndexIsOutOfRange() { Frame f = new Frame(); f.AddRoll(new Roll('7')); Assert.AreEqual(0, f.GetRollScore(10)); }
public int CalculateLookAhead(Frame currentFrame, int frameIndex, int numRolls) { int rollScore = 0; for (int i = 0; i < numRolls; i++) { int index = i; if (index >= currentFrame.Size) { index = 0; currentFrame = _frames[++frameIndex]; } rollScore += RawScoreToRealScore(currentFrame.GetRollScore(index)); } return rollScore; }
public int CalculateLookAhead(Frame currentFrame, int frameIndex, int numRolls) { int rollScore = 0; for (int i = 0; i < numRolls; i++) { int index = i; if (index >= currentFrame.Size) { index = 0; currentFrame = _frames[++frameIndex]; } rollScore += RawScoreToRealScore(currentFrame.GetRollScore(index)); } return(rollScore); }