Dear PHP gurus. Crawled across the expanses of the Internet in search of a single script. Stumbled upon an interesting option. Maybe among you there are fans of the movie, and someone watched the movie "Social Network". At the very beginning of the film describes the creation of the site "FACEMASH.COM" . On the site "HABRAHABR.RU" found the script of this site. HERE . At the end of the instructions describes the file functions.php . Here is its content:

  <? PHP / / Вычислить ожидаемый результат% Ожидается функцию ($ Rb, Ra $) { возвращает 1 / (1 + ПР (10, ($ $ Rb-Ra) / 400)); } / / Вычислить новую оценку winnner Функция выигрыша ($ оценка, $ ожидалось, $ K = 24) { вернуть $ оценка + $ K * (1 - $ ожидалось); } / / Вычислить новую счетом проиграл функция потерь ($ оценка, $ ожидалось, $ K = 24) { вернуть $ оценка + $ K * (0 - $ ожидалось); } > 

The question is about the incomprehensible descriptions contained inside the code. If it's not difficult for anyone, please translate to php .

    1 answer 1

    You drive in Google translate (which, apparently, the author did) and chuuuuut a little rule:

     // Calculate the expected result% function expected($Rb, $Ra ) { return 1 / (1 + PR (10, ($Rb-$Ra) / 400)); } // Calculate the new estimate winnner function win ($price, $expected, $K = 24) { return $price + $K * (1 - $expected); } // Calculate new account lost function loss ($price, $expected, $K = 24) { return $price + $K * (0 - $expected); } 

    Why do you need it?

    • Like any novice programmer, I just wonder :) - kirillfootballer
    • I didn’t drive too much, why did he translate this piece of text into Russian. But, apparently, he didn’t bother with the article at all, judging by the quality of the Russian comments on the code - knes
    • Corrected the names of functions in accordance with the article - knes
    • Thanks for the answer. Very helpful. True, I pppavil it, but he still naughty - kirillfootballer
    • We will understand - kirillfootballer