mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-15 17:37:39 +00:00
Simplifying
This commit is contained in:
@ -30,9 +30,8 @@ Links
|
||||
* `Project README <README.html>`_
|
||||
* `API Documentations <docs/>`_
|
||||
* `CodeCoverage <coverage/>`_
|
||||
* `Metrics <metrics/>`_
|
||||
* `Test report <test/index.html>`_
|
||||
* `Mutation testing <mutation/>`_
|
||||
* `Mutation testing <mutation/infection.html>`_
|
||||
|
||||
|
||||
Standard Tools
|
||||
|
@ -11,6 +11,12 @@ use Exception;
|
||||
*/
|
||||
abstract class SkillCalculator
|
||||
{
|
||||
public const NONE = 0x00;
|
||||
|
||||
public const PARTIAL_PLAY = 0x01;
|
||||
|
||||
public const PARTIAL_UPDATE = 0x02;
|
||||
|
||||
protected function __construct(
|
||||
private readonly int $supportedOptions,
|
||||
private readonly TeamsRange $totalTeamsAllowed,
|
||||
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills;
|
||||
|
||||
class SkillCalculatorSupportedOptions
|
||||
{
|
||||
public const NONE = 0x00;
|
||||
|
||||
public const PARTIAL_PLAY = 0x01;
|
||||
|
||||
public const PARTIAL_UPDATE = 0x02;
|
||||
}
|
@ -14,7 +14,6 @@ use DNW\Skills\PartialPlay;
|
||||
use DNW\Skills\PlayersRange;
|
||||
use DNW\Skills\RankSorter;
|
||||
use DNW\Skills\SkillCalculator;
|
||||
use DNW\Skills\SkillCalculatorSupportedOptions;
|
||||
use DNW\Skills\Team;
|
||||
use DNW\Skills\TeamsRange;
|
||||
use DNW\Skills\RatingContainer;
|
||||
@ -27,7 +26,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(SkillCalculatorSupportedOptions::PARTIAL_PLAY | SkillCalculatorSupportedOptions::PARTIAL_UPDATE, TeamsRange::atLeast(2), PlayersRange::atLeast(1));
|
||||
parent::__construct(SkillCalculator::PARTIAL_PLAY | SkillCalculator::PARTIAL_UPDATE, TeamsRange::atLeast(2), PlayersRange::atLeast(1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,9 +13,7 @@ use DNW\Skills\RankSorter;
|
||||
use DNW\Skills\Rating;
|
||||
use DNW\Skills\RatingContainer;
|
||||
use DNW\Skills\SkillCalculator;
|
||||
use DNW\Skills\SkillCalculatorSupportedOptions;
|
||||
use DNW\Skills\TeamsRange;
|
||||
use DNW\Skills\Team;
|
||||
|
||||
/**
|
||||
* Calculates the new ratings for only two players.
|
||||
@ -27,7 +25,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(SkillCalculatorSupportedOptions::NONE, TeamsRange::exactly(2), PlayersRange::exactly(1));
|
||||
parent::__construct(SkillCalculator::NONE, TeamsRange::exactly(2), PlayersRange::exactly(1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@ use DNW\Skills\RankSorter;
|
||||
use DNW\Skills\Rating;
|
||||
use DNW\Skills\RatingContainer;
|
||||
use DNW\Skills\SkillCalculator;
|
||||
use DNW\Skills\SkillCalculatorSupportedOptions;
|
||||
use DNW\Skills\Team;
|
||||
use DNW\Skills\TeamsRange;
|
||||
|
||||
@ -26,7 +25,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(SkillCalculatorSupportedOptions::NONE, TeamsRange::exactly(2), PlayersRange::atLeast(1));
|
||||
parent::__construct(SkillCalculator::NONE, TeamsRange::exactly(2), PlayersRange::atLeast(1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@ use DNW\Skills\GameInfo;
|
||||
use DNW\Skills\Player;
|
||||
use DNW\Skills\Team;
|
||||
use DNW\Skills\TrueSkill\FactorGraphTrueSkillCalculator;
|
||||
use DNW\Skills\SkillCalculatorSupportedOptions;
|
||||
use DNW\Skills\SkillCalculator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\CoversNothing;
|
||||
@ -78,6 +78,6 @@ class FactorGraphTrueSkillCalculatorTest extends TestCase
|
||||
public function testMethodisSupported(): void
|
||||
{
|
||||
$calculator = new FactorGraphTrueSkillCalculator();
|
||||
$this->assertEquals(TRUE, $calculator->isSupported(SkillCalculatorSupportedOptions::PARTIAL_PLAY));
|
||||
$this->assertEquals(TRUE, $calculator->isSupported(SkillCalculator::PARTIAL_PLAY));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user