A programming beginner project idea
In reponse to a Reddit question about the best beginner projects, I suggested that the ELO ranking system is a good option. I repost my answer below as a memo for myself.
How about implementing the ELO ranking system ?
Create a function that takes the ELO rank of two players A and B and returns the new ELO rank of A given that A has won against B. The calculation is well explained on the Wikipedia page. This will train on function definition and math functions.
Create a structure to represent the players. It could have two fields: the player name and its current rank for example. Modify the previous function to take two of these structures in argument and update the ranking field of the winning player. This will train on structures, strings and pointers.
To test the above everything would have supposedly been hard coded so far. Modify to accept as command line arguments two names (the winning and loosing players) and update the ranking accordingly (in a still hard coded array of players). This will train the command line argument processing, basic searching algorithm, string functions.
Instead of the player names as argument, modify to take the path to a file containing one pair of name (winner/loser) per row and create a new function to process a list of game results at once. This will train operation on text files and more string functions.
Modify to save the list of players in a file, load and reuse it instead of a hard coded array of players. Search how to handle the addition of new player: editing the player file manually ? through command line argument ? automatically (or interactively) added if a new name appears when processing a result file ? ... This will train more on previous concepts.
Learn how to keep the player file sorted according to players' ranking. This will train about sorting algorithm.
At this point, an actually usable software would have already been reached and the beginner could enjoy applying it to manage a small tournament in its community, which would be probably very rewarding. Or, exploiting data available on the web, it could be used to create alternate ranking systems for fun and curiosity. I gave an example about formula one pilots here.
Further improvement could be: replacing the CLI by a GUI (using gtk for example), studying other ranking systems (TrueSkill for example), developping a video game using their ELO implementation as the ranking system, ...
I think it's a good beginner project because the basis is very simple and doable even for a complete beginner, it's quickly rewarding, concretely related to something used in the real world, and open up to many more challenging problems.
, C programming
48 viewsI'm open for work ! Check my profile and email me.
Liked this article ? Please consider supporting me: