From: Carl Worth Date: Fri, 12 Jun 2020 17:24:41 +0000 (-0700) Subject: Force all submitted judging words to lowercase before mapping X-Git-Url: https://git.cworth.org/git?p=empires-server;a=commitdiff_plain;h=99db5b01aba2ee48a13a7a591efc8812e23d0beb Force all submitted judging words to lowercase before mapping This fixes the bug revealed in the previous commit so that the test suite now passes once again. The server now doesn't apy attention to the capitalization that a client happens to use when providing a judging submission, but will treat things as equivalent regardless of case differences. --- diff --git a/empathy.js b/empathy.js index e80c1af..cfe0618 100644 --- a/empathy.js +++ b/empathy.js @@ -182,11 +182,13 @@ class Empathy extends Game { eq = [group[j], group[i]]; } - const exist = this.equivalencies[`${eq[0]}:${eq[1]}`]; + const key=`${this.canonize(eq[0])}:${this.canonize(eq[1])}`; + + const exist = this.equivalencies[key]; if (exist) { exist.count++; } else { - this.equivalencies[`${eq[0]}:${eq[1]}`] = { + this.equivalencies[key] = { count: 1, words: eq };