Bowling Exercise on Ruby Track Seems to Use Conflicting Checks

The code has the following check:

 def test_consecutive_strikes_each_get_the_two_roll_bonus
    game = Game.new
    rolls = [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    rolls.each { |pins| game.roll(pins) }
    assert_equal 81, game.score
  end

My understanding is that this array would have 18 entries after the game.roll call? Therefore if each frame is two balls, this would mean you have bowled 9 frames, not a full game of 10 frames (assuming no extra balls).

This would violate the check for an incomplete game which uses this code:

  def test_an_incomplete_game_cannot_be_scored
    game = Game.new
    rolls = [0, 0]
    rolls.each { |pins| game.roll(pins) }
    assert_raises Game::BowlingError do
      game.score
    end
  end

Where the idea is that if you haven’t rolled 10 frames already, you should be throwing an error.

Am I missing something here? Seems like these checks might be off and cannot all be used at once which is making me confused here.

Rolling a 10 is a strike and ends the frame.

Frame 1: 10
Frame 2: 10
Frame 3: 10
Frame 4: 5, 3
Frame 5: 0, 0
Frame 6: 0, 0
Frame 7: 0, 0
Frame 8: 0, 0
Frame 9: 0, 0
Frame 10: 0, 0

Ah woops, looks like I overlooked that! Thanks :slight_smile: