Setting the Scene
I was approached by my soccer coach to generate teams for a dutch blitz or swiss style tournament. Sadly, online there doesn’t seem a good option for these especially for matches of 3v3 randomized. I then tried maybe using Google Sheets and an automation design software like Calvalry to try and generate a .pdf file with the teams. Sadly, I was not able to find a streamlined approached to do the team generation this way.
Using Knowledge from Computer Science Class
I was thinking of custom coding the project in Java as that is what AP Computer Science A+ is taught in. I decided not to because the current IDE I had on my computer was BlueJay which does not have the best text editor compared to my typical Visual Studio Code option. However, I do code in Visual Studio Code with C# for my Unity games.
On to C#
I am honestly most comfortable with the C# programming language as I have the most variety and experience in creating unique projects via C#. Initially, Visual Studio Code was going to be my code editor and IDE (with some console commands) which was fine. This was working for a while. I was able to get fairly far into the development of the project. A .CSV file was imported and then people were spliced into teams and the teams were printed to the console. This was all good but not very friendly…
Looking back, investing time into figuring out how to just use previous repos would have been better and would have given my more control in making a PDF that shows the teams. I started thinking for alternatives… Ah yes you can print webpages. So I started looking if you could convert C# code into HTML (into a webpage). It turns out ASP.NET with Razor Pages is the way to go. But this is when I left Visual Studio Code and moved onto Visual Studio for Mac (a proper IDE) There were just too many issues with trying to install ASP.net and running the website through VS Code so I pivoted to the path of least resistance and started looking into generated a webpage with Visual Studio for Mac.
Within minutes I had a webpage that previously took my hours troubleshooting in VS Code.
Following the tutorial series above I was able to Frankenstein-together my previous C# code and the format of the ASP.NET webpages and processes.
Some annoying bugs came up as I have never really worked on webpages except for years ago and that was just HTML and CSS. Each time the webpage loaded the player objects would be reinstated so they lost their previous information which means I could create multiple matches that would rely on previous data. I was stuck to only doing random sorts (list shuffles) and hoping that duplicate match-ups would be rare.
Here is an example of what it looks like.