- Author: Dr. SĂ©bastien Mosser
- Version: 2024.01
- Context: McMaster University > Engineering > Computing & Software > SFWRENG > 2AA4
- License: CC BY-NC-SA 4.0
This problem is a classical Coding Dojo: Tennis Coding Dojo. The objective is to implement a scoring system for a simplified version of tennis.
The scoring system is rather simple:
- Each player can have either of these points in one game:
love
,15
,30
,40
. - If you have
40
and you win the point you win the game, however there are special rules. - If both have
40
the players are deuce. - If the game is in deuce, the winner of a point will have advantage
- If the player with advantage wins the ball they win the game
- If the player without advantage wins they are back at deuce.
The problem description is vague and imprecise, and does not indicate how the score is actually incremented. We'll operate under the following assumptions:
- Players are characterized by a strength (a simplification of their ATP ranking)
- The strength is an integer in the [0,100] range
- This number is provided to the counting assistant through the command line (default is 50)
To compile the source code into a turn-key Java ARchive (JAR):
mosser@azrael 2aa4-tennis % mvn package
To run the counting assistant:
mosser@azrael 2aa4-tennis % java -jar target/tennis.jar -p1 75 -p2 30
** Starting Tennis Counter Assistant
**** Reading Command-Line Arguments
****** P1's Strength is 75/100
****** P2's Strength is 30/100
**** Starting game
** TODO...
** Closing Tennis Counter Assistant