From: Steinar H. Gunderson Date: Sun, 25 Mar 2012 19:13:30 +0000 (+0200) Subject: Properly handle the fact that score X-0 is different from X-(-X). Urg, bad bug. X-Git-Url: https://git.sesse.net/?p=wloh;a=commitdiff_plain;h=6e223b94f62742c179d7f89124d9203f3d49aa48 Properly handle the fact that score X-0 is different from X-(-X). Urg, bad bug. --- diff --git a/mcwordfeud.cpp b/mcwordfeud.cpp index 3b55f01..049a219 100644 --- a/mcwordfeud.cpp +++ b/mcwordfeud.cpp @@ -196,8 +196,13 @@ int main(int argc, char **argv) float mu = drawn_ratings(pl1) - drawn_ratings(pl2); int score = lrintf(draw_gaussian(mu, match_stddev)); - scores[pl1][pl2] = score; - scores[pl2][pl1] = -score; + if (score >= 0) { + scores[pl1][pl2] = score; + scores[pl2][pl1] = 0; + } else { + scores[pl1][pl2] = 0; + scores[pl2][pl1] = -score; + } } } @@ -249,7 +254,7 @@ int main(int argc, char **argv) continue; } float mu = drawn_ratings(pl1) - drawn_ratings(pl2); - float z = (scores[pl1][pl2] - mu) / match_stddev; + float z = (scores[pl1][pl2] - scores[pl2][pl1] - mu) / match_stddev; llh -= z * z * 0.5f; } } @@ -277,7 +282,7 @@ int main(int argc, char **argv) if (has_scores[pl1][pl2]) { continue; } - printf("%s %s %d\n", players[pl1].c_str(), players[pl2].c_str(), mlm_scores[pl1][pl2]); + printf("%s %s %d\n", players[pl1].c_str(), players[pl2].c_str(), mlm_scores[pl1][pl2] - mlm_scores[pl2][pl1]); } } }