More code standards

This commit is contained in:
2024-02-02 14:53:38 +00:00
parent 968c78d989
commit 3dddfc05db
46 changed files with 156 additions and 55 deletions

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace DNW\Skills;
use Exception;
@ -13,15 +15,17 @@ abstract class SkillCalculator
private int $supportedOptions,
private readonly TeamsRange $totalTeamsAllowed,
private readonly PlayersRange $playersPerTeamAllowed
) {
)
{
}
/**
* Calculates new ratings based on the prior ratings and team ranks.
*
* @param GameInfo $gameInfo Parameters for the game.
* @param Team[] $teams A mapping of team players and their ratings.
* @param int[] $teamRanks The ranks of the teams where 1 is first place. For a tie, repeat the number (e.g. 1, 2, 2).
* @param GameInfo $gameInfo Parameters for the game.
* @param Team[] $teams A mapping of team players and their ratings.
* @param int[] $teamRanks The ranks of the teams where 1 is first place. For a tie, repeat the number (e.g. 1, 2, 2).
*
* @return RatingContainer All the players and their new ratings.
*/
abstract public function calculateNewRatings(
@ -35,6 +39,7 @@ abstract class SkillCalculator
*
* @param GameInfo $gameInfo Parameters for the game.
* @param Team[] $teams A mapping of team players and their ratings.
*
* @return float The quality of the match between the teams as a percentage (0% = bad, 100% = well matched).
*/
abstract public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float;