ocafix is a tool to schedule OCA fixtures. After the initial parameters are defined, it then performs Monte-Carlo simulations until it finds a fixture list that meets the constraints. The fixtures are then written to stdout. A python pickle file (fixtures.pickle) is also created so that further analysis can be undertaken.
The code is written in Python3 and uses standard libraries.
On a local machine
Check out this repository and change directory to its contents, Then run
python3 ocafix.py N
where N is the number of simulations to be evaluated.
In a web browser
Click on the ocafix.ipynb link
Click on the area saying "run -i 'ocafix.py'" This will make sure it is highlighted (there will be a coloured line on the side), and then just click "Run" The numerical argument is the number of simulations to be evaluated.
- Fixtures lie with the two halves of the season
- Fixtures occur on the club night of the home team
- Fixtures are only between teams in the same division
- Teams in the same division play each other twice; once at home and once away
- Teams do not play each other twice during the same half of the season
- Teams from the same club play each other at the beginning of the season halves
- No team plays more than one match in the same week (except for the University)
- No fixtures scheduled for the day after Kidlington
- No fixtures scheduled for the day after The Witney Congress
- No fixtures scheduled for Easter Bank Holiday
- No fixtures scheduled for the day of the Peter Wells' simultaneous event
- No fixtures scheduled for the day of the Cowley Blitz
- Fixtures between teams from the same club are scheduled at the begining of each half of the season
- No matches to be scheduled outside ranges specified for clubs. Currently Abingdon School terms and University terms, excluding Michaelmas 1st week for initial preparation and Trinity 5th to 8th week for exams.
- Clubs do not have more than a specified number of fixtures at home on the same day (currently 2 for all clubs)
- Cowley does not have more than 1 fixtures at home on the third Monday of the month to avoid clash with Stamp Club.
- The number of teams that have adjacent teams playing on the same night is minimized.
- The number of times both Bicester teams play at home on the same night is maximize
- Cowley Didcot and Witney teams don't have "adjacent" (e.g. Team N and Team N+1) playing on the same night.
- The Banbury teams are excluded from playing on the 84! nights in which there are clashes with the Leamington and Warwick leagues,.
Conversion to a Windows executable
The python program can be built as a standalone windows executable by running the following steps on a Windows machine. Tested on a Windows 10 machine, will probably work on other versions, also Linux and Mac.
- Install PyInstaller with "pip install PyInstaller"
- Convert with pyinstaller.exe -F ocafix.py (builds ocafix.exe in dist folder)
- Run with ".\dist\ocafix\ocafix.exe"