Score one game of tennis. points lists who won each point, "A" or "B", in order.
Return the score after the last point as a string, using these rules:
- While neither player has 3 or more points together (i.e. not both at 3+), show
"<A>-<B>"using the namesLove,15,30,40for 0, 1, 2, 3 points, e.g."30-Love". - A player with 4 points wins if the opponent has 2 or fewer:
"Game A"/"Game B". - Once both players have at least 3 points: equal points is
"Deuce", one point ahead is"Advantage A"/"Advantage B", two points ahead is"Game A"/"Game B". - After a game is won, any further points are ignored.
Examples
Input: points = ["A", "A", "B"]
Output: "30-15"
Input: points = ["A", "B", "A", "B", "A", "B", "A", "A"]
Output: "Game A"
Input: points = ["A", "A", "A", "A", "B"]
Output: "Game A"
Constraints
0 <= len(points) <= 200; an empty list is"Love-Love".
Goals
- Translate a rulebook into careful if/elif branches
- Stop processing once a terminal state is reached