As I find and work through new Kata's to use at TDD Kata's I'll write up my version of the kata here.
I expect most will be similar to the source I find; and I don't expect any to be original.
- Create program to score a bowling game.
- A game consists of 10 frames. Each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total
number of pins knocked down, plus bonuses for strikes and spares.
- A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll.
- A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled.
- In the tenth frame a player who rolls a spare or strike is allowed to roll up to 3 extra
balls to complete the frame.
- Write a class named “Game” that has two methods
- roll(pins : int) : called each time the player rolls a ball. The argument is the number of pins knocked down.
- score() : int : called only at the very end of the game. It returns the total score for that game.
The tests are what need to be memorized for the Kata
- First Test - All Gutter Balls
- Second Test - All Single Pin
- Third Test - Single Spare
- Fourth Test - Single Strike
- Fifth Test - Perfect Game