Welcome to βοΈ Chess Tournament Management system! This guide will help you set up, run, and test the application. This is a task made for the assessments: More about the task here.
I use my own uzdev
npm library to build the API. You can learn more about it here: uzdev on npm.
Credential for admin:
- username:
admin
- password:
hi!12345
Test the application globally at: https://api.menda.page
Clone the repository to your local machine:
git clone https://github.com/mensenvau/assignment_global_move
cd assignment_global_move
You need to update the .env file. You can use the .env.example template as a reference.
Run the following script to set up your MySQL database (scripts/db-init.sql):
mysql -u root -p < scripts/db-init.sql
Navigate to the server directory and start it:
cd server
npm install
npm run start
npm test # for unit tests.
Find the function to test the basic logic at:
cd server # on server path
node function/test.system-swiss-tournament.js
Build match:
To start the next match, the system automatically creates pairings based on the following logic:
Players are initially sorted by rating. In subsequent rounds, they are sorted by their current score. Players who have not yet played against each other and have similar scores are paired together. The remaining players are paired in a similar manner. If there is an odd number of players, the lowest-ranked player who has not yet received a bye will get one, earning 1 point to advance to the next stage.
The next round cannot be generated until the results of the previous round are finalized. Additionally, a round number cannot be generated if Log2(Player Count) exceeds a manageable size.
The process is recursive to ensure proper sorting and pairing, though this approach may become inefficient if the number of players is very large.
- I didn't have time to write the front-end.
- Since the Swiss function is recursive, it needs to be optimized for multi-player rounds.
- Registration and login was not protected by captcha or email/phone message was not sent.
- Not optimized for caching.
For any questions, feel free to reach out: balkibumen@gmail.com
Watch the detailed installation guide: Installation Video
Stay updated and join the conversation: Telegram Channel