Skip to content

Instantly share code, notes, and snippets.

@crebma
Last active September 28, 2017 13:55
Show Gist options
  • Save crebma/5ca949f8c0620dca7932b71ae3788f87 to your computer and use it in GitHub Desktop.
Save crebma/5ca949f8c0620dca7932b71ae3788f87 to your computer and use it in GitHub Desktop.
Tennis Scoring Kata

Write a program to output correct score for a tennis game. Here is the summary of tennis scores:

A game is won by the first player to if the player has won at least four points in total and at least two points more than the opponent.

  • The running score of each game is describe as 'Love', 'Fifteen', 'Thirty' and 'Forty' for points from zero to three.
  • If at least three points is scored by both players and the scores are equal, the score is 'Deuce'.
  • If at least three points is scored by both players and a player has one more point than his opponent, the score of the game is 'Advantage' for the player with more points.
  • Sets and matches are out of scope. We only need to report the score for the current game.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment