]> git.cworth.org Git - empires-server/commit
Fix bug with incorrect scoring based on capitalization
authorCarl Worth <cworth@cworth.org>
Fri, 12 Jun 2020 17:10:06 +0000 (10:10 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 12 Jun 2020 17:10:06 +0000 (10:10 -0700)
commitf55c5650ffac1781c1cd675f64276c4e4c33d2b8
tree48d70ce449dc7c7cc07c166eeba8740d68128977
parent1c0d86cea49a79e94c884ffd4c811fe696db534b
Fix bug with incorrect scoring based on capitalization

As exposed in the previous commit which extended testing.

After we construct what we call "word maps", (where a group of words
are hased to by each word in the group individually), we collapse them
down to just the array of word groups themselves. This step was being
carried out by looking for the mapping to the word group where the
mapped word matched the first word in the list.

However, if that first word happened to differ in case from the
mapping word (which was already made canonically lowercase) then the
word group wouldn't be included in the final array and all submissions
of words from that group would incorrectly be scored as singletons.

The fix for this is to simply force the word being compared to as in
this commit.

This commit causes the test suite to pass again.
empathy.js