2022-07-05 15:33:34 +02:00
|
|
|
<?php namespace DNW\Skills\Tests\Elo;
|
2010-08-28 22:05:41 -04:00
|
|
|
|
2022-07-05 15:33:34 +02:00
|
|
|
use DNW\Skills\Elo\FideEloCalculator;
|
|
|
|
use DNW\Skills\Elo\ProvisionalFideKFactor;
|
|
|
|
use DNW\Skills\PairwiseComparison;
|
|
|
|
use DNW\Skills\Tests\TestCase;
|
2016-05-24 13:59:35 +02:00
|
|
|
|
2016-05-24 14:06:43 +02:00
|
|
|
class FideEloCalculatorTest extends TestCase
|
2016-05-24 13:59:35 +02:00
|
|
|
{
|
2010-08-28 22:05:41 -04:00
|
|
|
public function testFideProvisionalEloCalculator()
|
|
|
|
{
|
|
|
|
// verified against http://ratings.fide.com/calculator_rtd.phtml
|
|
|
|
$calc = new FideEloCalculator(new ProvisionalFideKFactor());
|
2016-05-24 13:59:35 +02:00
|
|
|
|
2010-08-28 22:05:41 -04:00
|
|
|
EloAssert::assertChessRating($this, $calc, 1200, 1500, PairwiseComparison::WIN, 1221.25, 1478.75);
|
|
|
|
EloAssert::assertChessRating($this, $calc, 1200, 1500, PairwiseComparison::DRAW, 1208.75, 1491.25);
|
|
|
|
EloAssert::assertChessRating($this, $calc, 1200, 1500, PairwiseComparison::LOSE, 1196.25, 1503.75);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testFideNonProvisionalEloCalculator()
|
|
|
|
{
|
|
|
|
// verified against http://ratings.fide.com/calculator_rtd.phtml
|
|
|
|
$calc = FideEloCalculator::createWithDefaultKFactor();
|
|
|
|
|
|
|
|
EloAssert::assertChessRating($this, $calc, 1200, 1200, PairwiseComparison::WIN, 1207.5, 1192.5);
|
|
|
|
EloAssert::assertChessRating($this, $calc, 1200, 1200, PairwiseComparison::DRAW, 1200, 1200);
|
|
|
|
EloAssert::assertChessRating($this, $calc, 1200, 1200, PairwiseComparison::LOSE, 1192.5, 1207.5);
|
|
|
|
|
|
|
|
EloAssert::assertChessRating($this, $calc, 2600, 2500, PairwiseComparison::WIN, 2603.6, 2496.4);
|
|
|
|
EloAssert::assertChessRating($this, $calc, 2600, 2500, PairwiseComparison::DRAW, 2598.6, 2501.4);
|
|
|
|
EloAssert::assertChessRating($this, $calc, 2600, 2500, PairwiseComparison::LOSE, 2593.6, 2506.4);
|
|
|
|
}
|
2016-05-24 13:59:35 +02:00
|
|
|
}
|