Skip to content

Kata for learning TDD (Test-Driven Development) & different languages. Goal of the exercise is to calculate the score of a bowling game.

Notifications You must be signed in to change notification settings

thled/kata_tdd_bowling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kata: TDD Bowling

MIT License

Requirements

Installation

  1. Clone this repository: $ git clone git@github.com:thled/kata_tdd_bowling
  2. Change to project directory: $ cd kata_tdd_bowling
  3. Change into the directory of the desired language and continue with the README.md there.

Goal

Bowling Rules

  • The game consists of 10 frames.
    • In each frame the player has two rolls 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 rolls.
    • 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 roll.
    • The frame is then completed with a single roll.
    • The bonus for that frame is the value of the next two rolls.
  • In the tenth frame a player who rolls a spare or strike is allowed to roll the extra balls to complete the frame.
    • However no more than three balls can be rolled in tenth frame.

Implementation

Write a class Game that has two methods:

  • roll(int $pins): void is called each time the player rolls a ball. The argument is the number of pins knocked down.
  • score(): int returns the total score for that game.

About

Kata for learning TDD (Test-Driven Development) & different languages. Goal of the exercise is to calculate the score of a bowling game.

Topics

Resources

Stars

Watchers

Forks