/TennisScoreKata

PHP based tennis score coding kata

Primary LanguagePHP

Tennis Score Kata

Taken from: http://codingdojo.org/cgi-bin/wiki.pl?KataTennis

Goal

The basic principle to calculate a tennis score. Easy.

To keep it simple, the tennis match only lasts for one game.

The game is turn based. Player one goes first, then player two. Repeat until there is a winner.

At any time, you can check the score, it should be after a point has been assigned.

When there is a winner, they should be declared and the game terminated.

Tests should be written first!

Tennis score link: http://en.wikipedia.org/wiki/Tennis#Scoring

A sample phpunit test has been submitted to get you started. Type: $ phpunit test

Ingredients

  • Less than 10 people, no more than 5.
  • A laptop.
  • A projector.
  • A room far away from where people are trying to work quietly.
  • Beer.

Method

  • The kata starts with a pair at the laptop coding for 5 minutes.
  • At the end of the 5 minutes, one of the pair moves off to be replaced by an onlooker.
  • Repeat until you are bored.
  • Nobody should be at the computer for 2 consecutive turns (approx 10 minutes).

Bonus Points

Use no flow control, such as 'if' or the ternary operator.