Skip to content

ace-lectures/2aa4-tennis

Repository files navigation

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
  • 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
  • To look at the solution designed during Lecture #04 (Case Study: The Tennis Counting), switch to the solution branch:
    • git checkout solution