Back to problems

Design Tennis Scoring with Pluggable Rules

Object-Oriented Programming · Reddit · Medium

Design a testable scoring component for a single tennis game between two players. The component must record which player won each point, provide a human-readable current score, and report when the game has ended and who won. Under the standard policy, the point labels are Love, 15, 30, and 40. After both players have at least three points, a tied score is Deuce; a lead of exactly one point is Advantage for the player ahead; and a lead of two points ends the game. The design…

Checking your access…