Project site:
chess-pairing.online
sbezo.github.io/chess-pairing
Project repository:
github.com/sbezo/chess-pairing
How I came to this project
Each year we have a small round-robin tournament in our chess club during Christmas time. Up to 15 players. And every year we struggle with the pairing. It looks easy, but definitely is not.
We used to do it by hand in paper table and every time there are mistakes.
I did some research and found many web projects tackling this problem.
But there is always some BUT.
Most of them have some limitations, you always need to register somewhere and most of them try to convert you to some pricing plan.
I understand it, but I still want something:
- simple
- without registration
- without limits
And I always wanted to build some web page other then boring tutorial’s ToDo list. This sounds like perfect challenge for me.
Beginning
As I’m not a developer, I started with ChatGPT of course :). And I progressed quickly with basic design of new page.
I wanted to keep it as simple and clean as possible. So just pure JavaScript, HTML and CSS. No backends, no frameworks. I wanted to learn how such simple interactive page work under the hood. How tabs are created, how buttons works, how can I read or write something. I really enjoyed this beginning.
I knew that critical part will be pairing itself following Berger’s table algorithm by Richard Schurig. I did it in python, which is my native language and Chat helped with translation to js and it worked perfect.
So after few weeks of fight I had my first working version and was very happy…
But when I look back, It was real mess. Scripts with data logic mixed with scripts for page rendering. No system. Everything was somehow interconnected. Bug fixes were difficult, and adding new features was even harder.
OOP
And then my coding mentor Juraj came to the scene. Highest time ;). He helped me with refactoring whole code to OOP fashion. The new internal architecture is beautiful and I really love it now. There is a class Controller for handling web page itself (DOM) and there is a class Tournament exclusively for data tournament handling(players, results, pairings…). Juraj also came with some new features and ideas. Everything is clean and make sense now.
This change allowed me to develop new interesting features like saving/loading data to Local Storage, adding more rounds, demo features…
What else I’ve learned
Interesting is how many topics you should handle during such ‘innocent’ project. Not going to details but just few points:
- domain related tasks
- git collaboration
- prod/dev environment setup
- GitHub Actions
- Cookies consent
- Web analytics
- SEO (by the way currently this site is the second in bing search of keywords ‘chess pairing’)
What next?
I have some small ideas for improvement like ’extra round’ button even after pairing - typical case for small number of players with open end friendly tournament. Or tournament performance calculation.
But generally I let it live as it is and will see.
Conclusion
I feel much more confident in this web discipline as before. And I hope that I created something useful.