mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-21 22:17:41 +01:00
Implemented kashdan
This commit is contained in:
parent
5128d2762e
commit
07c3a8ad21
@ -206,4 +206,30 @@ abstract class Tiebreaks extends Tournament
|
||||
}
|
||||
return $tiebreak;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return int
|
||||
*/
|
||||
protected function calculateKashdan(Player $player)
|
||||
{
|
||||
$tiebreak = 0;
|
||||
foreach ($player->getPairings() as $pairing) {
|
||||
$toadd = 0;
|
||||
if (array_search($pairing->getResult(), Constants::Won) !== false) {
|
||||
$toadd = 3;
|
||||
} elseif (array_search($pairing->getResult(), Constants::Draw) !== false) {
|
||||
$toadd = 2;
|
||||
} elseif (array_search($pairing->getResult(), Constants::Lost) !== false) {
|
||||
$toadd = 1;
|
||||
}
|
||||
|
||||
if (array_search(Constants::NotPlayed, $pairing->getResult()) !== false) {
|
||||
$toadd = 0;
|
||||
}
|
||||
$tiebreak += $toadd;
|
||||
}
|
||||
return $tiebreak;
|
||||
}
|
||||
}
|
||||
|
@ -311,6 +311,9 @@ class Tournament extends Tiebreaks
|
||||
case Tiebreak::Sonneborn:
|
||||
return $this->calculateSonneborn($player);
|
||||
break;
|
||||
case Tiebreak::Kashdan:
|
||||
return $this->calculateKashdan($player);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user