我正在尝试制作一个可以自动更改此人的elo等级的程序。我遇到了一个似乎无法解决的问题。这是代码:

        Liam=1000;
        Stefan=1000;
        Dylan=1000;
        Dennis=1000;
        Daniel=1000;
        K=32;
        //eloX is the player who won
        var ratingChange = function(PlayerX,PlayerY){
        //Expected Winning percentage of player X
        var EWP_X = 1/(1+10^((PlayerY-PLayerX)/400));
        //WP=Winning Percentage
        WP=1;
       //Player X rating change
       PlayerX = PlayerX+K*(WP-EWP_X);
       console.log(PLayerX)
       };
       ratingChange(Liam,Dylan)


每当我测试此Javascript时,都会出现错误“未定义PlayerX”。我对Javascript感到生疏,所以我确定这是我忽略的一个明显问题。谢谢你的帮助!

最佳答案

JavaScript区分大小写。 L应该是l:

var EWP_X = 1/(1+10^((PlayerY-PlayerX)/400));

console.log(PlayerX)


请参阅小提琴:http://jsfiddle.net/zeskysee/vd06gox9/

关于javascript - Elo评分系统的此代码有什么问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28335524/

10-10 13:07