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
|
|
|
|
{
|
2022-07-05 16:21:06 +02:00
|
|
|
final const WIN = 1;
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2022-07-05 16:21:06 +02:00
|
|
|
final const DRAW = 0;
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2022-07-05 16:21:06 +02:00
|
|
|
final const LOSE = -1;
|
2010-08-28 22:05:41 -04:00
|
|
|
|
|
|
|
public static function getRankFromComparison($comparison)
|
|
|
|
{
|
2022-07-05 16:21:06 +02:00
|
|
|
return match ($comparison) {
|
|
|
|
PairwiseComparison::WIN => [1, 2],
|
|
|
|
PairwiseComparison::LOSE => [2, 1],
|
|
|
|
default => [1, 1],
|
|
|
|
};
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
2022-07-05 15:55:47 +02:00
|
|
|
}
|