Skip to content

Instantly share code, notes, and snippets.

@ceilidhboy
Created July 14, 2022 09:38
Show Gist options
  • Save ceilidhboy/452f630432cb8bf8762c9752a0c2a0b9 to your computer and use it in GitHub Desktop.
Save ceilidhboy/452f630432cb8bf8762c9752a0c2a0b9 to your computer and use it in GitHub Desktop.
Simple instructions for the Bowling Game Code Kata
Requirement: create a class which calculates the score for a complete game of 10 Pin Bowling
The class should have two functions, roll() and score().
roll should be given the number of pins knocked down on that roll: roll(int $pins)
score takes no parameters and simply returns the score for the game: score(): int
Games are made up of 10 frames. Each player gets 2 rolls of the ball per frame
to try to knock down as many pins as possible. The score for each roll is the
number of pins knocked down in that roll.
The score for a frame is the total of the pins knocked down in the two rolls for
that frame, with two exceptions, as follows:
If a player knocks down all 10 pins with their first roll, this is called a STRIKE.
Since all the pins have been knocked down, that player doesn't take a second roll
as there are no pins left to knock down ;)
If a player knocks down all 10 pins with his two rolls, this is called a SPARE.
A STRIKE scores 10 PLUS A BONUS of the number of pins knocked down in their
NEXT TWO ROLLS.
A SPARE scores 10 PLUS A BONUS of the number of pins knocked down in their
NEXT ROLL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment