Some competitions, in the far flung corners of the world, aren't as straightforward as they bloody well ought to be.
In Belgian's Second Division, for example, the eighteen sides play each other twice in a regular round-robin format. The top team at the end of the season will get promoted, and there's a playoff to determine which team will follow them. All very good so far, it's something that anyone in the UK can instantly recognise.
Unfortunately for me, the Belgians didn't quite run with the same system that I'm used to. Instead of taking the teams who finish second through fourth and sending them into the playoff that also features a side from the top flight, they use a system of "periods". The 34 games are split into three periods of ten, twelve and twelve matches respectively, and the teams who "win" each of these periods will enter the playoffs. Only in the event of extra places needing to be filled, such as whenever a team wins more than one period, will the full league table be used.
Ok, I can do that. I have the fixtures, so surely I can just tell the game to create a table that consists only of fixtures played in rounds 1-10, then 11-22, then finally 23-34. Three additional tables that I can use to determine winners. Easy!
Belgium aren't alone. In the USA's Major League Soccer, the teams are split into two conferences and the top two sides in each conference advance to the playoffs, together with the next four teams with the best record. Again, this requires the creation of a table which effectively merges the two conferences together, producing a 13-team table from which the required sides can be plucked. I can do that too, right? Just collect all the fixtures and create a single table out of them.
It's all quite easy to create new tables whenever you're using all the teams and all the fixtures. Sadly, there are times when that won't be possible. UEFA's World Cup qualifiers involve a playoff featuring whichever sides finished second in their group, and to complicate matters, certain results against the lowest sides are discarded when creating the table.
Let me get this straight then. I need a system that will take a set of fixtures and create a new league table, discriminating against teams and results based on their position within a group, which round the match is a part of and who the opposition are? Bugger.
I didn't really want to do that. Damn you, UEFA! It caused me no end of headaches trying to come up with a system which I considered fast enough to be worthwhile, but in the end I think I got there and I now have a working Extra Table system that can conjure up a single league table of no more than 30 sides, based on whatever criteria I specify. It works perfectly well so far - the only remaining test is to see if it successfully merges data from matches played across multiple stages - rather than listing Germany twice in the table, all results should collected together. I'd have tested that by now but I'm far too lazy to create a new competition to do it. Something for later.
The next task is to create a working draw system for competitions, based on seedings, geography or downright prejudice. Well, maybe not that.