Hacker News new | ask | show | jobs
by mkaszkowiak 672 days ago
I've also thought about creating a Codenames bot: what if we could use semantic similarity to batch words together? Surely, this can be done using a prebuilt embedding model and clustering!

After some failed experiments - it performed worse than I thought it will - I've googled the subject, and... it turns out there's a whole paper about ML and codenames :)

https://arxiv.org/abs/2105.05885 (Playing Codenames with Language Graphs and Word Embeddings) - fun to read

2 comments

Very cool! A couple of months ago, after playing Codenames for the first time, I devised a strategy that any team of humans can learn, in order to win in 3 moves, guaranteed, every game. It only takes a few minutes to learn.

Imagine you have a Codenames board and you're on the blue team. The key is that you can represent the board as a text of 1s and 0s, where 1 is blue and 0 is not blue:

0 1 0 0 1

0 0 0 0 1

1 1 0 0 0

1 0 0 0 1

0 0 1 0 0

The next key is to realize that each sequence of 4 cards can be thought of as a 4-digit binary number, for example the first binary sequence above is "0100", or 4. The second binary sequence is "1000", or 8.

The strategy is to simply communicate the numbers 4 and 8 to your team—so we can simply choose a word that starts with the 4th letter of the alphabet (d) and ends in the 8th letter of the alphabet (h). If we tell our team "ditch", they'll know exactly what the first 8 cards are.

Repeat this for 3 turns, and your team has figured out 8 cards each turn, for a total of 24 cards out of 25 total. The final card can be inferred simply—on the third turn, if any card is unaccounted for, your team knows it must be in the 25th position.

I just hope your teammates know how to count in binary.

(N.B. the strategy can be optimized by eliminating less-common letters of the English alphabet, like J, where it may be difficult to think of words that end in that letter)

This strategy is specifically banned by the rules: https://czechgames.com/files/rules/codenames-rules-en.pdf

I quote:

> Your clue must be about the meaning of the words. You can't use your clue to talk about the letters in a word or its position on the table.

You're talking about cluing about the position, so it's against the rules.

I guess the rules do also say:

> But if no one notices that a clue is invalid, it counts as valid.

which kinda maybe makes it legal, but it seems like it's quite against the spirit of the rules, and the "invalid" clue thing there is just stuff like "accidentally used a word that's a part of a compound word on the board", not maliciously trying to cheat the rules.

I'd also attempted something like this years ago [1] based on word2vec, and it played decently! Occasionally it would throw out nonsensical clues or guesses, but was usable.

I'm sure with more modern embeddings/tools one could make a really excellent not.

[1] https://github.com/bcspragu/Codenames