Okay, so I’m gonna walk you through how I tackled this rugby 7s schedule thing. It was a bit of a head-scratcher at first, but I think I got something decent working.

The Initial Brainstorm
First off, I needed to figure out what the heck I was even trying to do. I knew I needed to create a schedule for a rugby 7s tournament. That means a bunch of teams, playing a bunch of games, across a set amount of time. Simple, right? Not really.
- How many teams are there?
- How many fields do I have?
- How long is each game?
- How much time between games?
- Are there any breaks needed during the day?
These were the questions buzzing around my head. I started by just jotting down what I knew and then made some educated guesses about the rest.
Diving into the Data
I started simple. I created a spreadsheet to keep track of everything. I listed out the teams, gave them numbers to keep track of them. Then, I tried to manually create a schedule, just to see what the issues were.

That’s when I realized I needed to deal with:
- Making sure each team plays a fair number of games
- Avoiding teams playing back-to-back games if possible
- Spreading the games out evenly across the fields
Basic Schedule Logic
I started by making a simple script to generate pairings. I tried to randomize the order of the teams at the start. The idea was to just get a basic schedule going.
The Script (Simple Version)
Here’s roughly what the early version looked like (simplified, of course):

I just used a basic loop and some random shuffling to get the teams paired up. It was messy and didn’t guarantee anything fair, but it was a start.
Dealing with Constraints
The randomization method was fine for a quick test, but it didn’t actually handle any of the constraints I had. So, I needed to add some logic to make sure things were more balanced.
I then tried to loop and generate the schedule. It was still a mess, but a more organized mess.
Making it Fairer

I added in some logic to track how many games each team had played. Before adding a team to a game, I’d check if they were already playing too many games compared to the other teams. If so, I’d skip them and try another team.
Avoiding Back-to-Back Games
This was tricky. I needed to keep track of when each team last played. Before adding a team to a game, I’d check if they had played in the previous slot. If they had, I’d skip them. It’s not perfect, but it helped reduce the number of back-to-back games.
Field Distribution
To spread games across the fields, I just rotated through the fields each time I scheduled a game. It’s a simple round-robin approach.

The Result
I ended up with a script that generates a reasonably balanced rugby 7s schedule. It’s not perfect – there are still some back-to-back games, and the fairness isn’t 100% – but it’s good enough for a starting point.
Next Steps
If I were to continue working on this, I’d want to:
- Implement a smarter algorithm to minimize back-to-back games.
- Add a way to specify breaks or lunch periods.
- Make the schedule more visually appealing (maybe with a web interface).
It was a fun little project. It showed me how complex scheduling can be, even for something as seemingly simple as a rugby tournament!
