Ladder: Support "both players lose"

Send -1 as the score to mean "both players lose"
This commit is contained in:
Guangcong Luo 2017-07-27 01:52:43 -04:00
parent a7c7fe9e2b
commit fceb63c0ee

View File

@ -404,13 +404,19 @@ class NTBBLadder {
if (!@$p1['rating']) $this->getRating($p1, true);
if (!@$p2['rating']) $this->getRating($p2, true);
$p2score = 1 - $p1score;
if ($p1score < 0) {
$p1score = 0;
$p2score = 0;
}
if (!$p1M) {
$p2rating = new GlickoPlayer($p2['rating']['r'], $p2['rating']['rd']);
$p1M = $p2rating->MatchElement($p1score);
}
if (!$p2M) {
$p1rating = new GlickoPlayer($p1['rating']['r'], $p1['rating']['rd']);
$p2M = $p1rating->MatchElement(1 - $p1score);
$p2M = $p1rating->MatchElement($p2score);
}
$p1M['score'] = $p1score;
$p2M['score'] = 1 - $p1score;