# MG/ELO

## MuwuM's Concept of ELO ranking in MG

Every (human) player starts with an ELO ranking of 1000. Winning will increase and loosing decrease a players ELO. CPU-Players have fixed/static ELO ranking:

 CPU (Easy) 400 CPU 600 CPU (Ultra) 800 CPU (Mega) 1000

On each match a ranking for each team is calculated$R_{team} = Round(\sqrt{\frac{\sum_{i=1}^{n} R_i^2}{n^2}}*2)$

Where $$R_{team}$$ is the ranking of the team, $$n$$ is the number of players of the largest team (if one team has 2 players and the other team 3 it is 3), $$i$$ is the index of the player of the team (1 is the first player of the team) , and $$R_i$$ is the ranking of the player $$i$$, if no player is found at the team with the position $$i$$ use $$R_i = 0$$.

Afterwards a $$k$$-factor for the team is calculated.

 $$R_{team} \le 2100$$ $$k_{team} = 32*n$$ $$R_{team} \le 2400$$ $$k_{team} = 24*n$$ $$R_{team} > 2400$$ $$k_{team} = 16*n$$

based on the $$k$$-factor for the team the $$k$$-factor of each player is calculated$k_{player} = Round(\frac{k_{team}*R_{player}}{\sum_{i=1}^{n} R_i})$

Now the ELO-difference between the teams is calculated$Diff_{team} = max( min( R_{enemy team} - R_{team}; 400);-400)$

Now the expected score is calculated$E_{team} = \frac{1}{1 + 10^{Diff_{team}/400}}$

Now set $$S_{team} = 1$$ for the winning team and $$S_{team} = 0$$ for the loosing team

And finally the ranking of each player is changed$R'_{player} = R_{player} + Round( k_{player} * ( S_{team} - E_{team} ) )$