Skip to the content of the web site.

Project L.1: Round-robin tournament

Write a program to do the following:

  1. Query the user for the number of teams to play in a double-elimination tournament. Ensure this number is a power of two.
  2. Ask for a name for each of the teams and ensure that each name is unique.
  3. List all the games to be played, and give each game a unique identifying number.
  4. Allow the user to identify the game being played and the result. Once all results are in, continue by printing the next set of games to be played.
  5. Continue until the required games of a double-elimination tournament are satisfied and then calculate a winner.

Remember that a team must lose twice to be eliminated, so if in the final game the undefeated team loses, a second final game must be scheduled.

You can read about a double-elimination tournament at Wikipedia.

Modifications

Schedule an optional game to decide who comes in third by having those teams that lost the semi-finals play against each other.

Store information in a text file so that the information is preserved even if the program is terminated. Then, when the program is started again, allow a command-line argument to be the file containing information to be read in.