From 99db5b01aba2ee48a13a7a591efc8812e23d0beb Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 12 Jun 2020 10:24:41 -0700 Subject: [PATCH] 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. --- empathy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 }; -- 2.43.0