Efficient code for "Codenames" board game

91 Views Asked by At

There is this popular board name called "Codenames".

Rules in short (also available here):
In this game, there are two teams - red and blue. There is also a grid 5x5 of random words. This grid hides 4 different types of objects. Specifically:

  1. 8-9 Blue spies
  2. 8-9 Red spies
  3. 1 Assassin
  4. 7 Bystanders

Each team must guess the right words to uncover all their agents. The team wins after all their agents are uncovered. However, if they uncover the assassin at any point, they immediately lose. Uncovering a bystander is considered a wasted move.

How does the team know which words to uncover? Each team chooses a "spymaster". All players see the grid of words, but only the spymasters have complete information about the layout of all the agents, bystanders, and the assassin. The role of the spymasters is to take turns and give clues to their team about the whereabouts of their agents. The other players take turns in guessing these whereabouts. For example, there are words like "Prince", "Queen" and "Castle" somewhere in the grid. The blue spymaster notices that they all hide blue agents. He then proceeds to say the clue "Royalty, 3". The spymaster is constrained to give only a single word clue and a number of how many words the clue relates to. His team then needs to guess at least one card a turn. The game usually last 3-6 turns. The starting team always has 9 agents to uncover. The second team has 8. The information which team starts is given by red or blue markers around the complete grid information card. Also, the number stating how many words the clue relates to lets the team make only number+1 guesses in that round. So when your spymaster says "Royalty, 3", you can uncover at most 4 cards.

The 5x5 word grid with some of the agents cards uncovered plus the card with a complete grid layout information

The problem:
The game prohibits the use of clues that relate to the location on the grid. However, I still wonder what would be the efficient way to play this game if that was not the case. I was wondering about a universal, word-agnostic (or not) code to convey the right coordinates. One such code would be a binary number which is potentially 25 bits long. We would need to convey at most 24 of course, since we can infer the last bit from the first 24. We could have a mapping of such big binary numbers to some collection of words, but that seems unwieldy. What are some other efficient strategies? Conveying the number of agents in each row and column? Dissecting the grid into smaller parts and giving the number of agents there? Remember that we can say only one "clue" word and one number, which itself shouldn't be a clue, but we might loosen that constraint as well if necessary.

TLDR:
A grid 5x5 has 8 or 9 mines in it. Convey the complete information about their location with one word.