- 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
- To look at the code used by your TA during tutorial #01, switch to the
tutorial
branch:git checkout tutorial
- If you want to go through the step-by-step demo done during lecture #04, look at the
dojo
directory.- Each step of the demo is available through a dedicated tag:
- Initial conditions:
git checkout demo_step_0
- Walking skeleton
git checkout demo_step_01
- Minimal & viable product:
git checkout demo_step_02
- Second refactor:
git checkout demo_step_03
- Initial conditions:
- Each step of the demo is available through a dedicated tag:
- To look at the solution designed during Lecture #04 (Case Study: The Tennis Counting), switch
to the
solution
branch:git checkout solution