mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-15 17:37:39 +00:00
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
"lint": [
|
||||
"phplint",
|
||||
"phpcs",
|
||||
"phpcbf src/ tests/ benchmark/ examples/",
|
||||
"phpmd src/,tests/,benchmark/,examples/ text phpmd.ruleset.xml"
|
||||
],
|
||||
"analyze": [
|
||||
|
14
composer.lock
generated
14
composer.lock
generated
@ -2025,16 +2025,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "11.3.4",
|
||||
"version": "11.3.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "d2ef57db1410b102b250e0cdce6675a60c2a993d"
|
||||
"reference": "4dc07a589a68f8f2d5132ac0849146d122e08347"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d2ef57db1410b102b250e0cdce6675a60c2a993d",
|
||||
"reference": "d2ef57db1410b102b250e0cdce6675a60c2a993d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4dc07a589a68f8f2d5132ac0849146d122e08347",
|
||||
"reference": "4dc07a589a68f8f2d5132ac0849146d122e08347",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2055,7 +2055,7 @@
|
||||
"phpunit/php-timer": "^7.0.1",
|
||||
"sebastian/cli-parser": "^3.0.2",
|
||||
"sebastian/code-unit": "^3.0.1",
|
||||
"sebastian/comparator": "^6.0.2",
|
||||
"sebastian/comparator": "^6.1.0",
|
||||
"sebastian/diff": "^6.0.2",
|
||||
"sebastian/environment": "^7.2.0",
|
||||
"sebastian/exporter": "^6.1.3",
|
||||
@ -2105,7 +2105,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.4"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2121,7 +2121,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T06:08:34+00:00"
|
||||
"time": "2024-09-13T05:22:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psalm/plugin-phpunit",
|
||||
|
@ -36,6 +36,3 @@ for($i = 0; $i < 5; ++$i) {
|
||||
echo "P2: " . $newRatings->getRating($p2)->getConservativeRating() . PHP_EOL;
|
||||
echo "P3: " . $newRatings->getRating($p3)->getConservativeRating() . PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -33,6 +33,3 @@ for($i = 0; $i < 5; ++$i) {
|
||||
echo "P1: " . $newRatings->getRating($p1)->getConservativeRating() . PHP_EOL;
|
||||
echo "P2: " . $newRatings->getRating($p2)->getConservativeRating() . PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -18,9 +18,10 @@ $csv->setHeaderOffset(0);
|
||||
|
||||
//build a statement
|
||||
$stmt = Statement::create()->where(static fn (array $record): bool => $record['category'] == "MotoGP" || $record['category'] == "500cc");
|
||||
//$stmt = Statement::create();
|
||||
|
||||
/** @var $riders Player[] */
|
||||
/**
|
||||
* @var $riders Player[]
|
||||
*/
|
||||
$riders = [];
|
||||
//query your records from the document
|
||||
$records = $stmt->process($csv);
|
||||
@ -31,10 +32,8 @@ $first_record = $records->first();
|
||||
$year_race = $first_record['year'] . '_' . $first_record['sequence'] . '_' . $first_record['category'];
|
||||
|
||||
$race_rate = [];
|
||||
foreach($records as $record)
|
||||
{
|
||||
if ($year_race !== $record['year'].'_'.$record['sequence'].'_'.$record['category'])
|
||||
{
|
||||
foreach ($records as $record) {
|
||||
if ($year_race !== $record['year'] . '_' . $record['sequence'] . '_' . $record['category']) {
|
||||
//Calculate the old race
|
||||
$newRatings = $calculator->calculateNewRatings($gameInfo, $teams, $pos);
|
||||
|
||||
@ -44,8 +43,7 @@ foreach($records as $record)
|
||||
foreach ($riders as $rider) {
|
||||
//echo $rider['P']->getId().": ". $newRatings->getRating($rider['P'])->getConservativeRating() . PHP_EOL;
|
||||
$rider['T']->setRating($rider['P'], $newRatings->getRating($rider['P']));
|
||||
if($newRatings->getRating($rider['P'])->getConservativeRating() > $highest_rate)
|
||||
{
|
||||
if ($newRatings->getRating($rider['P'])->getConservativeRating() > $highest_rate) {
|
||||
$highest_rate = $newRatings->getRating($rider['P'])->getConservativeRating();
|
||||
$highest_rider = $rider['P']->getId();
|
||||
}
|
||||
@ -53,13 +51,11 @@ foreach($records as $record)
|
||||
|
||||
echo sprintf('Highest rider: %s => %s', $highest_rider, $highest_rate) . PHP_EOL;
|
||||
|
||||
foreach($global_riders as $r)
|
||||
{
|
||||
foreach ($global_riders as $r) {
|
||||
$rate = $r['T']->getRating($r['P'])->getConservativeRating();
|
||||
|
||||
$race_rate[$year_race][$r['P']->getId()] = $rate;
|
||||
if (!isset($top_rating[$r['P']->getId()]) || $top_rating[$r['P']->getId()] < $rate)
|
||||
{
|
||||
if (! isset($top_rating[$r['P']->getId()]) || $top_rating[$r['P']->getId()] < $rate) {
|
||||
$top_rating[$r['P']->getId()] = $rate;
|
||||
}
|
||||
}
|
||||
@ -74,8 +70,7 @@ foreach($records as $record)
|
||||
}
|
||||
|
||||
//Is it a new rider?
|
||||
if(!isset($global_riders[$record['rider']]))
|
||||
{
|
||||
if (! isset($global_riders[$record['rider']])) {
|
||||
$global_riders[$record['rider']]['P'] = new Player($record['rider_name']);
|
||||
$global_riders[$record['rider']]['T'] = new Team($global_riders[$record['rider']]['P'], $gameInfo->getDefaultRating());
|
||||
//echo "New Rider: ". $record['rider'] . " => ".$global_riders[$record['rider']]['P']->getId().PHP_EOL;
|
||||
@ -90,8 +85,6 @@ foreach($records as $record)
|
||||
|
||||
echo "All time top score" . PHP_EOL;
|
||||
asort($top_rating);
|
||||
foreach($top_rating as $n=>$r)
|
||||
{
|
||||
foreach ($top_rating as $n => $r) {
|
||||
echo sprintf('%s => %s', $n, $r) . PHP_EOL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user