mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-20 16:48:04 +00:00
First TwoPlayerTrueSkillCalculator unit test passed
This commit is contained in:
23
PHPSkills/RankSorter.php
Normal file
23
PHPSkills/RankSorter.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Moserware\Skills;
|
||||
|
||||
/// <summary>
|
||||
/// Helper class to sort ranks in non-decreasing order.
|
||||
/// </summary>
|
||||
class RankSorter
|
||||
{
|
||||
/// <summary>
|
||||
/// Performs an in-place sort of the <paramref name="items"/> in according to the <paramref name="ranks"/> in non-decreasing order.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The types of items to sort.</typeparam>
|
||||
/// <param name="items">The items to sort according to the order specified by <paramref name="ranks"/>.</param>
|
||||
/// <param name="ranks">The ranks for each item where 1 is first place.</param>
|
||||
public static function sort(array &$teams, array &$teamRanks)
|
||||
{
|
||||
array_multisort($teamRanks, $teams);
|
||||
return $teams;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user