mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			571 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			571 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace DNW\Skills;
 | 
						|
 | 
						|
/**
 | 
						|
 * 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
 | 
						|
{
 | 
						|
    final const WIN = 1;
 | 
						|
 | 
						|
    final const DRAW = 0;
 | 
						|
 | 
						|
    final const LOSE = -1;
 | 
						|
 | 
						|
    public static function getRankFromComparison($comparison)
 | 
						|
    {
 | 
						|
        return match ($comparison) {
 | 
						|
            PairwiseComparison::WIN => [1, 2],
 | 
						|
            PairwiseComparison::LOSE => [2, 1],
 | 
						|
            default => [1, 1],
 | 
						|
        };
 | 
						|
    }
 | 
						|
}
 |