2022-07-05 15:55:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace DNW\Skills;
|
2010-08-28 22:05:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a comparison between two players.
|
2022-07-05 15:55:47 +02:00
|
|
|
*
|
2010-08-28 22:05:41 -04:00
|
|
|
* @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;
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2010-08-28 22:05:41 -04:00
|
|
|
const DRAW = 0;
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2010-08-28 22:05:41 -04:00
|
|
|
const LOSE = -1;
|
|
|
|
|
|
|
|
public static function getRankFromComparison($comparison)
|
|
|
|
{
|
|
|
|
switch ($comparison) {
|
|
|
|
case PairwiseComparison::WIN:
|
2022-07-05 15:55:47 +02:00
|
|
|
return [1, 2];
|
2010-08-28 22:05:41 -04:00
|
|
|
case PairwiseComparison::LOSE:
|
2022-07-05 15:55:47 +02:00
|
|
|
return [2, 1];
|
2010-08-28 22:05:41 -04:00
|
|
|
default:
|
2022-07-05 15:55:47 +02:00
|
|
|
return [1, 1];
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
|
|
|
}
|
2022-07-05 15:55:47 +02:00
|
|
|
}
|