THE MATCHES
There are Np people participating in the competition. Each match is played in teams of 2 persons: one defender and one attacker. The teams change each round.
There are two competitions: one for the best defender and one for the best attacker. Each competition has its own ranking (see below). Each person participates in both competitions.
A match ends when one of the teams has scored 8 goals. This means that final scores can be (for instance) 8-0, 8-5 or 3-8. Draws do not occur.
A total of Nr rounds is played.
THE RAKING
The ranking in each competition is based on the following (in this order):
- The number of games won
- The number of resistance points. To compute this number for defender A, take all the players (defenders and attackers) that player A has played against and count the number of games that those opponents have won up until the current round.
- The goal difference. This is the total number of goals scored by your own team, minus the total number of goals scored against.
The initial ranking is based on a draw. This draw also counts as a tie breaker in case of equal rankings.
ODD NUMBER OF PLAYRS AND THE ’BYE’
In case of an odd number of Np people, each round one defender and one attacker will not play a match. These players will receive a so-called ‘bye’. This means they get a victory, without receiving resistance points.
The player that receives a bye is the player who is ranked lowest and has not received a bye yet. This counts for both the defender-bye and the attacker-bye. This can be the same person.
MATCH MAKING
At the beginning of each round, a new match schedule is made with all players, except the players that have received a bye. Matches are made based on the following rules (in order of priority):
- All players play once as a defender and once as an attacker
- Defenders don’t play against attackers that they have played against before
- Defenders are not in the same team with attackers that they have been in a team with before
- Defenders don’t play against defenders that they have played against before
- Attackers don’t play against attackers that they have played against before
Within the above set of rules, matches are scheduled to minimize the distance between players on the rankings. Specifically, the sum of all distances between all players on the rankings is minimized. As an example, suppose a match is played between the following teams:
- Team 1: Number 1 defender (player A) and number 4 attacker (player B)
- Team 2: Number 3 defender (player C) and number 1 attacker (player D)
The sum of all distances for this match is:
abs(1-4) + abs(1-3) + abs(1-1) (sum of distances from player A to B, C and D)
+ abs(4-3) + abs(4-1) (sum of distances from player B to C to D)
+ abs(3-1) (sum of distances from player C to D)
= 11
If there are multiple solutions with equal distance between players, there is no preference.
SPECIFICS & RULES
- Please write your solution in Python/C++/Matlab.
- Please add information (in the README) on how to execute the code.
- Your solution should be able to take player names as an input.
- Your solution should be able to output a match schedule, take actual match results as an input and then output the current scoring table. How you do this, is up to you. Just know that we do like a good-looking and well-constructed output ;)
- We will evaluate your solutions based on inventiveness, efficiency, and good coding practices.
- We will only accept submissions in the form of a link to a Github repository.
- Please submit to communication@demcon.com
- We’ve added some instructions below if you’re unfamiliar with Github.
HOW TO USE GITHUB
- In your internet browser, navigate to github.com
- Enter your email address, and press ‘sign up for GitHub’
- Press continue, create a password and enter a username
- Solve the puzzle to show that you are a human
- Verify your email address and customize your Github experience
- Create a new project by pressing ‘start a project’
- Give your repository a name, and make sure it is set to public. Press ‘create repository’
- In quick startup, press ‘create new file’ or ‘upload existing file’
- Enter the code for this challenge here
- When you are ready to submit, go to the <>code section of your repository and press ‘code’ and copy the HTTPS link. Enter this link into your submission.