Files
trueskill/src/PairwiseComparison.php

27 lines
571 B
PHP
Raw Normal View History

2022-07-05 15:55:47 +02:00
<?php
namespace DNW\Skills;
/**
* Represents a comparison between two players.
2022-07-05 15:55:47 +02: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;
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],
};
}
2022-07-05 15:55:47 +02:00
}