mirror of
https://github.com/furyfire/trueskill.git
synced 2025-06-27 23:21:32 +00:00
Regular updates and fixing static analysis findings
This commit is contained in:
@ -2,10 +2,11 @@
|
|||||||
<phive xmlns="https://phar.io/phive">
|
<phive xmlns="https://phar.io/phive">
|
||||||
<phar name="phpmd" version="^2.15.0" installed="2.15.0" location="./tools/phpmd" copy="false"/>
|
<phar name="phpmd" version="^2.15.0" installed="2.15.0" location="./tools/phpmd" copy="false"/>
|
||||||
<phar name="overtrue/phplint" version="^9.6.2" installed="9.6.2" location="./tools/phplint" copy="false"/>
|
<phar name="overtrue/phplint" version="^9.6.2" installed="9.6.2" location="./tools/phplint" copy="false"/>
|
||||||
<phar name="phpstan" version="^2.1.12" installed="2.1.12" location="./tools/phpstan" copy="false"/>
|
<phar name="phpstan" version="^2.1.12" installed="2.1.14" location="./tools/phpstan" copy="false"/>
|
||||||
<phar name="psalm" version="^7.0.0-beta6" installed="7.0.0-beta6" location="./tools/psalm" copy="false"/>
|
<phar name="psalm" version="^7.0.0-beta6" installed="7.0.0-beta7" location="./tools/psalm" copy="false"/>
|
||||||
<phar name="phpcs" version="^3.12.2" installed="3.12.2" location="./tools/phpcs" copy="false"/>
|
<phar name="phpcs" version="^3.12.2" installed="3.13.0" location="./tools/phpcs" copy="false"/>
|
||||||
<phar name="phpcbf" version="^3.12.2" installed="3.12.2" location="./tools/phpcbf" copy="false"/>
|
<phar name="phpcbf" version="^3.12.2" installed="3.13.0" location="./tools/phpcbf" copy="false"/>
|
||||||
<phar name="phpdocumentor" version="^3.7.1" installed="3.7.1" location="./tools/phpdocumentor" copy="false"/>
|
<phar name="phpdocumentor" version="^3.7.1" installed="3.7.1" location="./tools/phpdocumentor" copy="false"/>
|
||||||
<phar name="phpbench" version="^1.4.1" installed="1.4.1" location="./tools/phpbench" copy="false"/>
|
<phar name="phpbench" version="^1.4.1" installed="1.4.1" location="./tools/phpbench" copy="false"/>
|
||||||
|
<phar name="infection" version="^0.29.14" installed="0.29.14" location="./tools/infection" copy="false"/>
|
||||||
</phive>
|
</phive>
|
||||||
|
14
composer.lock
generated
14
composer.lock
generated
@ -837,16 +837,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "11.5.18",
|
"version": "11.5.20",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "fc3e887c7f3f9917e1bf61e523413d753db00a17"
|
"reference": "e6bdea63ecb7a8287d2cdab25bdde3126e0cfe6f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc3e887c7f3f9917e1bf61e523413d753db00a17",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e6bdea63ecb7a8287d2cdab25bdde3126e0cfe6f",
|
||||||
"reference": "fc3e887c7f3f9917e1bf61e523413d753db00a17",
|
"reference": "e6bdea63ecb7a8287d2cdab25bdde3126e0cfe6f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -856,7 +856,7 @@
|
|||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"ext-xmlwriter": "*",
|
"ext-xmlwriter": "*",
|
||||||
"myclabs/deep-copy": "^1.13.0",
|
"myclabs/deep-copy": "^1.13.1",
|
||||||
"phar-io/manifest": "^2.0.4",
|
"phar-io/manifest": "^2.0.4",
|
||||||
"phar-io/version": "^3.2.1",
|
"phar-io/version": "^3.2.1",
|
||||||
"php": ">=8.2",
|
"php": ">=8.2",
|
||||||
@ -918,7 +918,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.18"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.20"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -942,7 +942,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2025-04-22T06:09:49+00:00"
|
"time": "2025-05-11T06:39:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector/rector",
|
"name": "rector/rector",
|
||||||
|
@ -79,7 +79,7 @@ class Matrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValue(int $row, int $col): float|int
|
public function getValue(int $row, int $col): float
|
||||||
{
|
{
|
||||||
$this->checkRowCol($row, $col);
|
$this->checkRowCol($row, $col);
|
||||||
return $this->matrixRowData[$row][$col];
|
return $this->matrixRowData[$row][$col];
|
||||||
@ -212,7 +212,7 @@ class Matrix
|
|||||||
return self::scalarMultiply($determinantInverse, $adjugate);
|
return self::scalarMultiply($determinantInverse, $adjugate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function scalarMultiply(float|int $scalarValue, Matrix $matrix): Matrix
|
public static function scalarMultiply(float $scalarValue, Matrix $matrix): Matrix
|
||||||
{
|
{
|
||||||
$rows = $matrix->getRowCount();
|
$rows = $matrix->getRowCount();
|
||||||
$columns = $matrix->getColumnCount();
|
$columns = $matrix->getColumnCount();
|
||||||
@ -265,7 +265,7 @@ class Matrix
|
|||||||
|
|
||||||
for ($currentRow = 0; $currentRow < $resultRows; ++$currentRow) {
|
for ($currentRow = 0; $currentRow < $resultRows; ++$currentRow) {
|
||||||
for ($currentColumn = 0; $currentColumn < $resultColumns; ++$currentColumn) {
|
for ($currentColumn = 0; $currentColumn < $resultColumns; ++$currentColumn) {
|
||||||
$productValue = 0;
|
$productValue = 0.0;
|
||||||
|
|
||||||
for ($vectorIndex = 0; $vectorIndex < $left->getColumnCount(); ++$vectorIndex) {
|
for ($vectorIndex = 0; $vectorIndex < $left->getColumnCount(); ++$vectorIndex) {
|
||||||
$leftValue = (float)$left->getValue($currentRow, $vectorIndex);
|
$leftValue = (float)$left->getValue($currentRow, $vectorIndex);
|
||||||
|
@ -192,7 +192,7 @@ final class FactorGraphTrueSkillCalculator extends SkillCalculator
|
|||||||
$nextTeam = $teamAssignmentsList[$i + 1];
|
$nextTeam = $teamAssignmentsList[$i + 1];
|
||||||
foreach ($nextTeam->getAllPlayers() as $nextTeamPlayer) {
|
foreach ($nextTeam->getAllPlayers() as $nextTeamPlayer) {
|
||||||
// Add a -1 * playing time to represent the difference
|
// Add a -1 * playing time to represent the difference
|
||||||
$playerAssignments[$currentColumn][] = -1 * PartialPlay::getPartialPlayPercentage($nextTeamPlayer);
|
$playerAssignments[$currentColumn][] = -1.0 * PartialPlay::getPartialPlayPercentage($nextTeamPlayer);
|
||||||
--$rowsRemaining;
|
--$rowsRemaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ final class GaussianWeightedSumFactor extends GaussianFactor
|
|||||||
|
|
||||||
$weightsLength = $variableWeightsLength + 1;
|
$weightsLength = $variableWeightsLength + 1;
|
||||||
for ($weightsIndex = 1; $weightsIndex < $weightsLength; ++$weightsIndex) {
|
for ($weightsIndex = 1; $weightsIndex < $weightsLength; ++$weightsIndex) {
|
||||||
$currentWeights = \array_fill(0, $variableWeightsLength, 0);
|
$currentWeights = \array_fill(0, $variableWeightsLength, 0.0);
|
||||||
|
|
||||||
$variableIndices = \array_fill(0, $variableWeightsLength + 1, 0);
|
$variableIndices = \array_fill(0, $variableWeightsLength + 1, 0.0);
|
||||||
$variableIndices[0] = $weightsIndex;
|
$variableIndices[0] = $weightsIndex;
|
||||||
|
|
||||||
$currentWeightsSquared = \array_fill(0, $variableWeightsLength, 0);
|
$currentWeightsSquared = \array_fill(0, $variableWeightsLength, 0.0);
|
||||||
|
|
||||||
// keep a single variable to keep track of where we are in the array.
|
// keep a single variable to keep track of where we are in the array.
|
||||||
// This is helpful since we skip over one of the spots
|
// This is helpful since we skip over one of the spots
|
||||||
@ -90,9 +90,9 @@ final class GaussianWeightedSumFactor extends GaussianFactor
|
|||||||
|
|
||||||
$currentWeight = (-$variableWeights[$currentWeightSourceIndex] / $variableWeights[$weightsIndex - 1]);
|
$currentWeight = (-$variableWeights[$currentWeightSourceIndex] / $variableWeights[$weightsIndex - 1]);
|
||||||
|
|
||||||
if ($variableWeights[$weightsIndex - 1] == 0) {
|
if ($variableWeights[$weightsIndex - 1] == 0.0) {
|
||||||
// HACK: Getting around division by zero
|
// HACK: Getting around division by zero
|
||||||
$currentWeight = 0;
|
$currentWeight = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentWeights[$currentDestinationWeightIndex] = $currentWeight;
|
$currentWeights[$currentDestinationWeightIndex] = $currentWeight;
|
||||||
|
@ -118,11 +118,11 @@ final class TwoPlayerTrueSkillCalculator extends SkillCalculator
|
|||||||
// non-draw case
|
// non-draw case
|
||||||
$v = TruncatedGaussianCorrectionFunctions::vExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
$v = TruncatedGaussianCorrectionFunctions::vExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
$w = TruncatedGaussianCorrectionFunctions::wExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
$w = TruncatedGaussianCorrectionFunctions::wExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
$rankMultiplier = $comparison->value;
|
$rankMultiplier = (float)$comparison->value;
|
||||||
} else {
|
} else {
|
||||||
$v = TruncatedGaussianCorrectionFunctions::vWithinMarginScaled($meanDelta, $drawMargin, $c);
|
$v = TruncatedGaussianCorrectionFunctions::vWithinMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
$w = TruncatedGaussianCorrectionFunctions::wWithinMarginScaled($meanDelta, $drawMargin, $c);
|
$w = TruncatedGaussianCorrectionFunctions::wWithinMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
$rankMultiplier = 1;
|
$rankMultiplier = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$meanMultiplier = (BasicMath::square($selfRating->getStandardDeviation()) + BasicMath::square($gameInfo->getDynamicsFactor())) / $c;
|
$meanMultiplier = (BasicMath::square($selfRating->getStandardDeviation()) + BasicMath::square($gameInfo->getDynamicsFactor())) / $c;
|
||||||
|
@ -94,7 +94,7 @@ final class TwoTeamTrueSkillCalculator extends SkillCalculator
|
|||||||
+
|
+
|
||||||
BasicMath::sum($otherTeam->getAllRatings(), $varianceGetter)
|
BasicMath::sum($otherTeam->getAllRatings(), $varianceGetter)
|
||||||
+
|
+
|
||||||
$totalPlayers * $betaSquared
|
(float)$totalPlayers * $betaSquared
|
||||||
);
|
);
|
||||||
|
|
||||||
$winningMean = $selfMeanSum;
|
$winningMean = $selfMeanSum;
|
||||||
@ -117,7 +117,7 @@ final class TwoTeamTrueSkillCalculator extends SkillCalculator
|
|||||||
// non-draw case
|
// non-draw case
|
||||||
$v = TruncatedGaussianCorrectionFunctions::vExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
$v = TruncatedGaussianCorrectionFunctions::vExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
$w = TruncatedGaussianCorrectionFunctions::wExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
$w = TruncatedGaussianCorrectionFunctions::wExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
$rankMultiplier = $selfToOtherTeamComparison->value;
|
$rankMultiplier = (float)$selfToOtherTeamComparison->value;
|
||||||
} else {
|
} else {
|
||||||
// assume draw
|
// assume draw
|
||||||
$v = TruncatedGaussianCorrectionFunctions::vWithinMarginScaled($meanDelta, $drawMargin, $c);
|
$v = TruncatedGaussianCorrectionFunctions::vWithinMarginScaled($meanDelta, $drawMargin, $c);
|
||||||
|
Reference in New Issue
Block a user