Source for file Player.php
Documentation is available at Player.php
function Games_Chess_Player ($name, $gamesPlayed)
foreach ($gamesPlayed as $game) {
* @param Games_Chess_Result
* @param white|blackwhich side this player played
* @link http://www.chessclub.com/help/ratings
function _calculateICCRating ($game, $played)
if (!isset ($this->ICCRating)) {
$self = $this->ICCRating;
$opponent = $game->{$played == 'white' ? 'black' : 'white'};
if ($opponent['count'] < 20 ) {
// opponent is provisional
$K = 32 * (1 + $opponent['count']) / 21;
$extra = 1/5 * (1600 - $self);
if ($this->gamesPlayed () < 20 ) {
$rating = $opponent['rating'] + (400 * $game->result );
$unaverage = count($this->games ) * $this->ICCRating;
$this->ICCRating = ($unaverage + $rating) / (count($this->games ) + 1 ) + $extra;
$rating = $opponent['rating'];
$this->ICCRating = $self +
1 + pow(10 , ($rating - $self) / 400 )
if ($game->white ['name'] = $this->name ) {
$this->_calculateICCRating ($game, 'white');
$this->games ['W'] = $game;
} elseif ($game->black ['name'] = $this->name ) {
$this->_calculateICCRating ($game, 'black');
$this->games ['B'] = $game;
Documentation generated on Mon, 11 Mar 2019 14:28:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|