This repo is about genberator of teams in soccer (or other sports) with a multiple open source algorithms.
Set randomly an order of the teams. The first team pick a player, the second team pick the next player, the third team pick two players. After this round, it goes back. After the third team pick two players, then the second team pick a player, and then the first team pick two players. and so on. The team picks a player according to the rank order. Here is an example of the algorithm selection:
I believe that variety of teams should be picked by uniform distrubtion according to skills. Here we define player by 5 skills: Leadership (field domination, increase the moral), Attack (finishing, key-pass), Defence (close to the goalkeeper, physics, aggression), Stamina (fit, pace, speed) and Passing (passing accuracy, playmaker).
The teams are ordered randomly, and then the algo picks randomly one of the skills above. Now we pick top 3 players with the highest rank in the specific skill, and spread them in each team.
Note: While picking 3 players ordered by skill rank, it goes like this:
- We pick the highest skill rank.
- If there are at least two players with the same skill rank, we pick the one with the higher avarage rank (avarage rank means avarage of all other skills rank)
- If there are at least two players still, we pick randomly.
After this step. we have 3 teams, and each team contain one player according to the random skill. Now we pick a new skill (of the rest skills), and put the players in the same way. But now, the order of the picking teams is not random, but ordered by the team total rank (calculated by the summary of the players rank in the team).
First, think of an algorithm which makes sense and could be helpful and disribute it!
In Algos
folder you could find AlgoType
enum which declares the existing algo types. Add you new enum value that suitable to your algorithm name.
Now, Create your own folder for your algorithm with the name of your algo with a postfix of Algo.
For instace, if you create an algorithm with the name TheBestAlgoEver you should add enum with the name TheBestAlgoEver
and folder with the name TheBestAlgoEverAlgo
.
Here are 3 interfaces you should implement:
IAlgoManager
is the one who implements teams generation.IPlayerReader
is the one who implements the players reading.IPlayer
is an interface which reflects the player model.
IPlayerReader
receives the path
string as parameter and returns collection of IPlayer
with the relevant data (according to the implementation).
In case your algorithm engine works with local files, you should create a file with the name players
with any extension you desire. The file path is provided to your IPlayersReader
implementor and reading the players as you wish.
Under CLI folder you can find all of the commands and the printer classes. Creation of a new command for CLI requires these steps:
- Create an implementation of
IPrinterOptionCallback
. - Fill the
Description
andDoCommand
. - Add your command to the
optionsCallback
dictionary inProgram.cs
file.
This runner is an endpoint application which runs on Windows machine only.
In order to run the user should maintain a config.json file.
The file contains an array of shirtColors
which is an array of objects based on name
which is the color name, and whatsappSymbol
which is the color symbol that integrated with whastapp app.
After this file is created, the user should edit the player
file which is stored in the algo folder.
Then all the user need is to run the app, choose the relevant algorithm and receive its teams.
In order that any one at the world could use your algorithm, you should maintain the web service.
In WebAppAPI
we should add our algorithm to the both dictionary (follow the existing items), and in addition we need to add a new AlgoType
enum.