Files
trueskill/src/PairwiseComparison.php

30 lines
619 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
{
const WIN = 1;
2022-07-05 15:55:47 +02:00
const DRAW = 0;
2022-07-05 15:55:47 +02: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];
case PairwiseComparison::LOSE:
2022-07-05 15:55:47 +02:00
return [2, 1];
default:
2022-07-05 15:55:47 +02:00
return [1, 1];
}
}
2022-07-05 15:55:47 +02:00
}