Tennis - GradedJestRisk/kata GitHub Wiki

Wikipedia

TLDR

Game = Collection of balls Individual threshold: 4 points Gap threshold: 2 points

Set = Collection of games Individual threshold: 6 points Gap threshold: 2 points, except on 7-6 where gap is 1 point

Match = Collection of set Best of three sets

Glossary

List:

  • player
  • opponent
  • to score
  • to serve
  • serving player
  • receiving player
  • point
  • game
  • set
  • match
  • advantage
  • deuce
  • love
  • to call (score)
  • point count

What's the name for an exchange between players, ending with a point ? (several service tried)

Structure

Calling a running score is a different job than scoring a game. Scoring a game is telling when the game ends and who has won. Calling a running score involve:

  • individual point count (0/15/30/40);
  • order is serving player first;
  • comparisons (advantage);
  • game potential ending (game ball).

Scoring a game involve:

  • input: for each service, who has won the point
  • state, as a player win relating to an absolute threshold (4) AND the gap between himself and his opponent (2)

4-0: P1 P1 P1 P1 => P1 win 2-4: P2 P1 P2 P1 P2 P2 => P2 win

Game

A game consists of a sequence of points played with the same player serving. A game is won by the first player to have won at least four points in total and at least two points more than the opponent. The running score of each game is described in a manner peculiar to tennis: scores from zero to three points are described as "love", "15", "30", and "40", respectively. If at least three points have been scored by each player, making the player's scores equal at 40 apiece, the score is not called out as "40–40", but rather as "deuce". If at least three points have been scored by each side and a player has one more point than his opponent, the score of the game is "advantage" for the player in the lead.

(TLDR) 0 point: 0 (love) 1 point: 15 2 points: 30 3 points: 40 4 points: 40+

Game won:

  • Phase 1: at least one player has less than 3 points
  • the other has at least 4 points
  • gap of 2 points => eg: 4-0 (quicker: 4 balls) => 4 - 2 (longer - 6 balls)
  • Phase 2: both player had 3 points (deuce) - 6 balls
  • the first having gap of 2 points win => eg: 3-3 => 5-3 (quicker - 8 balls) => N+2 - N (longer=> 2N+2 balls)

Opponent must be 2 points apart to win, but should have played enough (4 points each) (TLDR's TLDR) Individual threshold: 4 points Gap threshold: 2 points

I win if:

  • I have at least 4 points
  • I have 2 points more than my opponent

=> quickest way to win the game is to win all balls => longest is to get to deuce, then alternating

(Drama)
During informal games, "advantage" can also be called "ad in" or "van in" when the serving player is ahead, and "ad out" or "van out" when the receiving player is ahead. The score of a tennis game during play is always read with the serving player's score first. In tournament play, the chair umpire calls the point count (e.g., "15-love") after each point. At the end of a game, the chair umpire also announces the winner of the game and the overall score.

Set

A set consists of a sequence of games played with service alternating between games, ending when the count of games won meets certain criteria. Typically, a player wins a set by winning at least six games and at least two games more than the opponent. If one player has won six games and the opponent five, an additional game is played. If the leading player wins that game, the player wins the set 7–5. If the trailing player wins the game (tying the set 6–6) a tie-break is played. A tie-break, played under a separate set of rules, allows one player to win one more game and thus the set, to give a final set score of 7–6.

(TLDR) I win a set if:

  • I won at least six games
  • gap is 2

(Win in) Phase 1:

  • I won 6 games
  • my opponent won at most 4 games => quickest: 6-0 (6 balls), longest: 6-4 (10 balls)

(Win in) Phase 2:

  • entering 6-5
  • 7-5 => 7 wins
  • 6-6 => 7-6 7 wins

(TLDR's TLDR) Individual threshold: 6 points Gap threshold: 2 points, except on 7-6 where gap is 1 point

(Drama)
A "love" set means that the loser of the set won zero games, colloquially termed a 'jam donut' in the US. In tournament play, the chair umpire announces the winner of the set and the overall score. The final score in sets is always read with the winning player's score first, e.g. "6–2, 4–6, 6–0, 7–5".

Match

A match consists of a sequence of sets. The outcome is determined through a best of three or five sets system. On the professional circuit, men play best-of-five-set matches at all four Grand Slam tournaments, Davis Cup, and the final of the Olympic Games and best-of-three-set matches at all other tournaments, while women play best-of-three-set matches at all tournaments.

The first player to win two sets in a best-of-three, or three sets in a best-of-five, wins the match. Only in the final sets of matches at the French Open, the Olympic Games, and Fed Cup are tie-breaks not played. In these cases, sets are played indefinitely until one player has a two-game lead, occasionally leading to some remarkably long matches.