Which would not be very sporting of course, so we don't allow it.
Note that this restriction is applied after the majority-ruled
matching. So a player can't even give kudos to a word they didn't
submit and then hope to get matched into it.
It's also worth noting that the group can decide to split a group
where one player gave kudos. That will mean that both sides of the
split get kudos from the player, which seems to match the kudos-giving
player's intent.
for (let group of word_groups) {
const words = group.words;
for (let group of word_groups) {
const words = group.words;
- if (group.kudos)
- this.kudos[player.name] = [...words];
+ if (group.kudos) {
+ this.kudos[player.name] = {
+ player: player,
+ words: [...words]
+ };
+ }
for (let i = 0; i < words.length - 1; i++) {
for (let j = i + 1; j < words.length; j++) {
for (let i = 0; i < words.length - 1; i++) {
for (let j = i + 1; j < words.length; j++) {
/* Apply kudos from each player to the word maps, (using a set so
* that no word_map can get multiple kudos from a single
* player). */
/* Apply kudos from each player to the word maps, (using a set so
* that no word_map can get multiple kudos from a single
* player). */
- for (let player of Object.keys(this.kudos)) {
- for (let word of this.kudos[player]) {
+ for (let kudos of Object.values(this.kudos)) {
+ for (let word of kudos.words) {
const word_canon = this.canonize(word);
if (! word_maps[word_canon])
continue;
const word_canon = this.canonize(word);
if (! word_maps[word_canon])
continue;
- word_maps[word_canon].kudos.add(player);
+ /* Don't let any player give kudos to a group where they
+ * submitted a word themself. That just wouldn't be right. */
+ if (! word_maps[word_canon].players.has(kudos.player)) {
+ word_maps[word_canon].kudos.add(kudos.player);
+ }
return {
word: group.words.join('/'),
players: Array.from(group.players).map(p => p.name),
return {
word: group.words.join('/'),
players: Array.from(group.players).map(p => p.name),
- kudos: Array.from(group.kudos)
+ kudos: Array.from(group.kudos).map(p => p.name)