2016-05-24 14:10:39 +02:00
|
|
|
<?php namespace Moserware\Skills;
|
2010-08-28 22:05:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a comparison between two players.
|
|
|
|
* @internal The actual values for the enum were chosen so that the also correspond to the multiplier for updates to means.
|
|
|
|
*/
|
|
|
|
class PairwiseComparison
|
|
|
|
{
|
|
|
|
const WIN = 1;
|
|
|
|
const DRAW = 0;
|
|
|
|
const LOSE = -1;
|
|
|
|
|
|
|
|
public static function getRankFromComparison($comparison)
|
|
|
|
{
|
|
|
|
switch ($comparison) {
|
|
|
|
case PairwiseComparison::WIN:
|
2016-05-24 14:10:39 +02:00
|
|
|
return array(1, 2);
|
2010-08-28 22:05:41 -04:00
|
|
|
case PairwiseComparison::LOSE:
|
2016-05-24 14:10:39 +02:00
|
|
|
return array(2, 1);
|
2010-08-28 22:05:41 -04:00
|
|
|
default:
|
2016-05-24 14:10:39 +02:00
|
|
|
return array(1, 1);
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
|
|
|
}
|
2016-05-24 14:10:39 +02:00
|
|
|
}
|