pair - Pair players for the next round of a swiss tournament
The scripts in script_files/ need to be installed somewhere so that they can be run in the directory in which pairing of each round is done.
- DIRECTORY LAYOUT
The scripts assume that there is a directory in which a configuration file, called league.yaml, with data about the players exists. The rounds are paired in subdirectories, named 1,2,3,.. in this directory. A file called pairtable.yaml in the subdirectory allows pairing of the round to take place. This file can be created from a pairing table, eg pairing.txt, by running pairtable2yaml pairing.txt
- DATA FILES
Do NOT use tabs in these YAML files. The level of indentation is significant. Follow the examples closely. The first, league.yaml has lines of the form:
member: - id: 1 name: Laver, Rod rating: 2810 title: Grandmaster - id: 2 name: Sampras, Pete rating: 2800 title: Unknown - id: 3 name: McEnroe, John rating: 2780 title: Unknown
Late entries are separate.
If you are using your own scoring scheme, and colors (called, roles), see the example in t/tennis in the distribution. You can add your own data to the member and late records. A pairing number is generated for the players, so don't include a pairing number. The new id (ie pairing number) is added to league.yaml. This is a bit tricky. I am working with names here (eg with the absentees and the pairings left in round.yaml). TODO Configuration of your own scoring scheme looks like it is broken.
pairtable.yaml is of the form:
--- opponents: 1 : [6,4,2,5] 2 : [7,3,1,4] 6 : [1,5,3,9] roles: 1 : [White,Black,White,Black] 2 : [White,Black,White,Black] 6 : [White,Black,White,Black] floats: 1 : [Up,Down] 2 : [~,Down] 6 : [~,~] score: 1: 3.5 2: 3.5 6: 2.5
Or its equivalent. As for league.yaml, indentation (no tabs) is important.
- GENERATING PAIRINGS
Starting with an empty main directory, create league.yaml, and an empty subdirectory for the first round. Run the script, 'pair' in the empty round subdirectory. A log of the pairing is printed and 'round.yaml' in the directory contains the matches. A number of other yaml files are created to store state for the round. (These will probably go away in a later version of this script).
After the games in the round are complete, create a pairing table for the next round. (Perhaps you can use pairingtable. This currently uses the yaml serialization files in the round subdirectory and score files in the scores subdirectory. Enter the scores for the players in the file, '1.yaml', or whatever the round is. A template file is generated in the round subdirectory. Then you can run 'crosstable' or 'pairingtable' in the original directory above the subdirectory, to get current standings.) If there is a next round, make another empty subdirectory named after it, put pairtable.yaml (created by hand or by pairtable2yaml) in it and continue as before. You add late-entering players in league.yaml in the main directory.