Esempio n. 1
0
 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));
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        public void GetRollScoreThrowsExceptionWhenIndexIsOutOfRange()
        {
            Frame f = new Frame();

            f.AddRoll(new Roll('7'));
            Assert.AreEqual(0, f.GetRollScore(10));
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 public void GetRollScoreThrowsExceptionWhenIndexIsOutOfRange()
 {
     Frame f = new Frame();
     f.AddRoll(new Roll('7'));
     Assert.AreEqual(0, f.GetRollScore(10));
 }