I would like to propose an additional test for the Bowling exercise which covers the following scenario:

If the first roll in the last frame is not a strike, then assert that the next roll (i.e. the second roll in the last frame) pin count is less than or equal to the remaining number of pins in the lane.

This test case is similar to some already existing cases:

• “a spare in the last frame gets a one roll bonus that is counted once” - ensure that the penultimate value in the ‘previousRolls’ list is less than or equal 3
• “two bonus rolls after a strike in the last frame cannot score more than 10 points” and “the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike” - only instead of observing last frame rolls #2 and #3, we observe last frame rolls #1 and #2.

There is already a pull request for the proposed change.

Isn’t this already covered by `"two rolls in a frame cannot score more than 10 points"`?

It is, for regular (i.e. non-last) frames. I view the last frame as a separate case because two rolls in the last frame can in fact score more than 10 points despite what it says in the case description.

The point is, and @SleeplessByte’s question is spot on there, whether or not a solution can be provided which fails to take this particular case into account. I believe is it certainly a possibility, that it is possible to make a solution that will pass all existing tests, but fail in this particular scenario. In fact, my first instinct was exactly to treat the last frame as a completely different state machine than other frames.

Though when I think about it now, the existing test set obviously doesn’t nearly cover all possibilities. For instance, the `two rolls in a frame cannot score more than 10 points` case checks only the first frame. But what about the second frame? Or any other non-last frame for that matter? Basically, we’re probably talking about the need for per-frame checks here, which would, granted, be impractical. Any working solution may be trusted in good faith to have covered the missing test cases, though it needn’t be the case.

I believe is it certainly a possibility, that it is possible to make a solution that will pass all existing tests, but fail in this particular scenario.

Seeing is believing, so I decided to share an example of just such a solution - my own. It passes all 31 existing test cases, but not the one I propose (the last in line). Unless, of course, I uncomment lines 67 and 68 of `bowling.py`.