This site requires JavaScript, please enable it in your browser!
Greenfoot back
fejfo
fejfo wrote ...

2015/12/18

Helpfull score system

fejfo fejfo

2015/12/18

#
this is not a problem just something I thought some people might find use full the situation is basically this : everyone has a score and lots of people with a wide range of scores (and skill) will get compared in a game (fight or something) you want to give everyone points if they do better then expected and have the get less/lose points if they do worse so I came up with a system based on chess's elo system before the games starts : calc the winchance of every one by : score/sum of scores after the game : calc how will they did by : place = (#players - rank)/#players then calc if how mutch better they did then expected : place/winchance then the new score is : score+= <x>/point*score this makes it so that the higger x the more points you get per game I suggest ones start points are +/- x/10 and makes it so that the more points you have the harder it becomes to grow and if you just keep playing against noobs you don't progress or even lose points in code this would be :
public score[] calcSocres(double[] scores, int[] ranks) {

    double totalScore = Math.sum(scores);
    for(int i = 0; i < scores.length; i++) {
         double expectedRank = scores[i]/totalScore
         double realRank = (scores.length+1-ranks[i])/scores.lenght;
         double score = realRank/expectedRank;
         scores[i] = scores[i] + 1000.0/scores[i]*score
    }
   return scores;
} 
You need to login to post a reply.