这个Elo评级系统代码有什么问题

时间:2015-02-05 03:08:42

标签: javascript

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

        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中生锈了,所以我确定这是一个明显的问题,我看了。谢谢你的帮助!

1 个答案:

答案 0 :(得分:2)

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

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

console.log(PlayerX)

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