/2aa4-tennis

Tennis Counting

Primary LanguageJavaOtherNOASSERTION

Tennis Counting Dojo

build status

Problem Description

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:

  1. Each player can have either of these points in one game: love, 15, 30, 40.
  2. If you have 40 and you win the point you win the game, however there are special rules.
  3. If both have 40 the players are deuce.
  4. If the game is in deuce, the winner of a point will have advantage
  5. If the player with advantage wins the ball they win the game
  6. If the player without advantage wins they are back at deuce.

Assumptions

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)

How to use this software?

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

Usage in 2AA4 @McMaster

  • To look at the code used by your TA during tutorial #01, switch to the tutorial branch:
    • git checkout tutorial
  • To look at the solution designed during Lecture #04 (Case Study: The Tennis Counting), switch to the solution branch:
    • git checkout solution