Fizz Buzz Kata

Fizz Buzz Kata

Fizz Buzz is a counting and number substitution game mainly aimed at teaching children division. Players take turns counting up from one, replacing any number that is divisible by three with the word 'fizz', any number divisible by five with the word 'buzz', and any number divisible by both three and five to be replaced with 'fizz buzz'.


Feature 1 - Basic Fizz Buzz Scoring

You'll be getting used to this by now. Once again, we need a backend for the game that can correctly score the game we're implementing on the front end. It needs to be a reusable library that simply takes a number, and returns the correct answer for that number- whether that is the number itself, 'fizz', 'buzz', or 'fizz buzz'.

Normal Numbers Return Same Number

As a games designer
I want a normal number to return that number
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
1 1
2 2
4 4

Multiples of Three Return Fizz

As a games designer
I want a multiple of three to return 'fizz'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
3 fizz
9 fizz
123 fizz

Multiples of Five Return Buzz

As a games designer
I want a multiple of five to return 'buzz'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
5 buzz
20 buzz
200 buzz

Multiples of Three and Five Return Fizz Buzz

As a games designer
I want a multiple of three and five to return 'fizz buzz'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
15 fizz buzz
45 fizz buzz
315 fizz buzz

Feature 2 - Playing FizzBuzz Variations

Turns out that Fizz Buzz has a whole bunch of variants that people play in different countries and for different ages of children. One of the most interesting we have seen is Fizz Buzz Pop, where the word 'pop' is substituted for numbers that are a multiple of seven. We want you to extend the rules of our current Fizz Buzz game to allow players to play Fizz Buzz Pop instead.

Multiples of Seven Return Pop

As a games designer
I want a multiple of seven to return 'pop'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
7 pop
28 pop
77 pop

Multiples of Three and Seven Return Fizz Pop

As a games designer
I want a multiple of three and seven to return 'fizz pop'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
21 fizz pop
63 fizz pop
126 fizz pop

Multiples of Five and Seven Return Buzz Pop

As a games designer
I want a multiple of five and seven to return 'buzz pop'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
35 buzz pop
70 buzz pop
140 buzz pop

Multiples of Three, Five and Seven Return Fizz Buzz Pop

As a games designer
I want a multiple of three, five and seven to return 'fizz buzz pop'
So that the game can be scored according to the rules

  • Given I have started the game
    When I enter $number
    Then $result is returned
Number Result
105 fizz buzz pop
210 fizz buzz pop
315 fizz buzz pop

Feature 3 - Creating Fizz Buzz Variations

So not that many people have actually heard of or played Fizz Buzz Pop, probably because the substitution words are different in different countries across the world. We're going to give players the ability to create their own substitution words and link them to multiples of certain numbers, and we need you to make this possible.

Using a Custom Substitution

As a player
I want to be able to choose my own substitutions
So that I can tailor the game to my preferences

  • Given I have substituted multiples of two for 'fuzz'
    When I enter $number
    Then $result is returned
Number Result
1 1
2 fuzz
8 fuzz

Linking Custom Substitutions Together

As a player
I want my substitutions to work the same way as Fizz Buzz
So that the essence of the game remains the same

  • Given I have substituted multiples of two for 'fuzz'
    And I have substituted multiples of three for 'bizz'
    When I enter $number
    Then $result is returned
Number Result
4 fuzz
9 bizz
12 fuzz bizz