Difference between revisions of "Running Stellenbosch Handicap Tournaments"

From SAGoClubs
Jump to navigation Jump to search
(Beginning of documentation on running handicap tournaments)
 
m (Running Stellenbosch Handi's moved to Running Stellenbosch Handicap Tournaments)
(No difference)

Revision as of 06:51, 16 February 2006

This page is starting off a little chaotic, but should, over time, settle into a more useful, organized state.

Using handi_tourney_helper.py

handi_tourney_helper.py is a very simple Python script I wrote to help me make pairings and calculate results. It uses a simple text file for input.

Config file format

  • Lines that start with # are comments. (Only lines, whole lines, that start with #, not whitespace then #, and not a # to the right of some other info.)
  • The first "paragraph", ending with an empty line (not whitespace, empty!), defines the players taking part in the tournament. A player is defined by an alphanumeric id, a rank, and a free-form name, the three seperated by whitespace (any whitespace!). These lines may also start and end with whitespace, as they are processed by the following regular expression: ^\s*(\w*)\s+(\w*)\s+(.*)\s*$. For example:
# PLAYERS
jaco    4k      Jaco Swanepoel
david   6k      David Richfield
rory    7k      Rory Beling
hugo    9k      Hugo van der Merwe
christina 12k   Christina Auret
heinz   13k     Heinz Staschen
ben     15k     Ben Bredenkamp
hanno   17k     Hanno Botha
louis   19k     Louis de Jager
wim     25k     Wim Conradie
iain    27k     Iain Lawrie
andre   29k     Andre Heydenrich
willie  30k     Willie Krige

  • The id is used during the rest of the file to fill in results. The rank is anything from 30k to 1k, or 1d to 6d. The free-form name is used in result and pairing tables.
  • After the players are specified, the next paragraph contains game results. A line should either start with #, or be of the form rory bt hugo, hugo bt rory or unplayed: hugo vs rory. These lines are again quite free (whitespace anywhere), as they are processed using regular expressions.
  • NB: bye results should also be entered, with the player paired against the "bye" "fake player" scoring the victory.

Using the script

The first parameter is the name of the "config file" (defining the players and containing the game results). The second parameter is one of the following:

simpleresults 
Prints results in a "simple form", just a dump of the Python list. E.g.:
[((3, 5, 14), 'hugo'),
 ((2, 4, 16), 'lei'),
 ((2, 4, 13), 'rory'),
 ((1, 6, 12), 'charl'),
 ((1, 3, 15), 'davidr'),
 ((0, 5, 11), 'christina')]
htmlresults 
Prints html for publishing the results in a nice table, that looks like this:
PosName #WinsSOSSOSOS
1Hugo van der Merwe 3514
2Lei Feng 2416
3Rory Beling 2413
4Charl du Plessis 1612
5David Richfield 1315
6Christina Auret 0511
simplepairings 
Prints the best 5 pairings (if it can find 5) in a "simple form": just a dump of the Python list.
pairings 
Prints the best 5 pairings in a "human readable" form, useful for emailing the pairings.
htmlpairings 
Prints html for the best 5 pairings for publishing the pairings in a nice table.

Example: 1st Quarter Handi 2006

First enter all the player info, ending with a blank line, like this (assuming it's in a file Handi06-1):

# PLAYERS
jaco    4k      Jaco Swanepoel
david   6k      David Richfield
rory    7k      Rory Beling
hugo    9k      Hugo van der Merwe
christina 12k   Christina Auret
heinz   13k     Heinz Staschen
ben     15k     Ben Bredenkamp
hanno   17k     Hanno Botha
louis   19k     Louis de Jager
wim     25k     Wim Conradie
iain    27k     Iain Lawrie
andre   29k     Andre Heydenrich
willie  30k     Willie Krige

Now we can generate pairings. This can take quite some time, as it is done "brute force" (with only the simple, obvious tree-pruning). For the first round, with 14 players, it took between 30 and 40 seconds to calculate the pairings. handi_tourney_helper.py Handi06-1 pairings - the output is:

H: [2, 2, 2, 2, 1, 1, 0]  ssh: 18
Wim Conradie(W) vs Iain Lawrie(B) with 2H
Andre Heydenrich(W) vs Willie Krige(B) with 0.5komi
Rory Beling(W) vs Hugo van der Merwe(B) with 2H
Louis de Jager: BYE
Jaco Swanepoel(W) vs David Richfield(B) with 2H
Christina Auret(W) vs Heinz Staschen(B) with 0.5komi
Ben Bredenkamp(W) vs Hanno Botha(B) with 2H
H: [2, 2, 2, 2, 1, 1, 0]  ssh: 18
Wim Conradie(W) vs Iain Lawrie(B) with 2H
Andre Heydenrich(W) vs Willie Krige(B) with 0.5komi
Rory Beling(W) vs Hugo van der Merwe(B) with 2H
Hanno Botha(W) vs Louis de Jager(B) with 2H
Jaco Swanepoel(W) vs David Richfield(B) with 2H
Christina Auret(W) vs Heinz Staschen(B) with 0.5komi
Ben Bredenkamp: BYE
H: [2, 2, 2, 2, 2, 1, 0]  ssh: 21
Wim Conradie(W) vs Iain Lawrie(B) with 2H
Andre Heydenrich(W) vs Willie Krige(B) with 0.5komi
Rory Beling(W) vs Hugo van der Merwe(B) with 2H
Hanno Botha(W) vs Louis de Jager(B) with 2H
Jaco Swanepoel(W) vs David Richfield(B) with 2H
Heinz Staschen(W) vs Ben Bredenkamp(B) with 2H
Christina Auret: BYE
H: [3, 2, 2, 2, 1, 1, 0]  ssh: 23
Wim Conradie(W) vs Iain Lawrie(B) with 2H
Andre Heydenrich(W) vs Willie Krige(B) with 0.5komi
David Richfield(W) vs Rory Beling(B) with 0.5komi
Hanno Botha(W) vs Louis de Jager(B) with 2H
Jaco Swanepoel: BYE
Hugo van der Merwe(W) vs Christina Auret(B) with 3H
Heinz Staschen(W) vs Ben Bredenkamp(B) with 2H
H: [3, 2, 2, 2, 2, 1, 0]  ssh: 26
Wim Conradie(W) vs Iain Lawrie(B) with 2H
Andre Heydenrich(W) vs Willie Krige(B) with 0.5komi
Rory Beling: BYE
Hanno Botha(W) vs Louis de Jager(B) with 2H
Jaco Swanepoel(W) vs David Richfield(B) with 2H
Hugo van der Merwe(W) vs Christina Auret(B) with 3H
Heinz Staschen(W) vs Ben Bredenkamp(B) with 2H

Each pairing starts with a "H:" line, that shows the criteria by which it was sorted: handicaps sorted from maximum to minimum (then sum of square handicaps - which will have no effect on the sorting, it's only there because I found it interesting). Notice that there are two "equal" pairings possible for the first round of this tournament. NB: this script is deterministic, it makes testing the script easier. This means you have to flip a coin or use a random number generator to pick between equal pairings! (Very important, can't allow your name to give you an advantage/disadvantage!) I flipped a coin with "rand * 2", which gave me the first pairing. Copy/paste the relevant text into an email sent to all the participants, then run handi_tourney_helper.py Handi06-1 htmlpairings, which will also take long, as it recalculates the pairings again. Copy/paste the correct pairing into the website. (Make very sure you use the same pairing!)

Next I suggest entering all the pairings into the tournament file as unplayed:

# ROUND 1
unplayed: wim vs iain
unplayed: andre vs willie
unplayed: rory vs hugo
louis bt bye
unplayed: jaco vs david
unplayed: christina vs heinz
unplayed: ben vs hanno

Notice Louis has a bye, which should be entered as a victory for him.

TO BE CONTINUED