Thursday, April 17, 2008

Games for Programmers: Jotto

The next in an irregular series of board game recommendations for programmers. Of course, you don't have to be a programmer to enjoy these games, but if you are a programmer, then I think there's a pretty good chance that you'll like them.

However, you might not want to play this particular game with your spouse. Here's why...

“End. E-N-D”, she guessed. “One”, I replied.
“Cab. C-A-B”, I guessed. “One”, she replied.

We were driving to a campground in Massachusetts. My wife and I were in the front seats of the minivan; our daughter was in the middle seat, watching a DVD; and our son and his friend were chatting in the back seat.

We had been on the road for several hours, and I was feeling a bit tired. I needed to do something to help keep me alert. “Jotto?”, I suggested to my wife. “Ok.“

“Icy. I-C-Y”, she guessed. “Zero”, I replied.
“Fed. F-E-D”, I guessed. “One”, she replied.

Jotto is a two-player deduction game, kind of like Mastermind but with words. In fairness, I should say that Mastermind is like Jotto but with colors, since Jotto is older than Mastermind.

Each player secretly chooses a five-letter word with no duplicate letters. The usual restrictions apply—no proper nouns, etc.

The players take turns guessing each other's words. For each guess, you tell the player how many letters were correct. Unlike Mastermind, it doesn't matter whether the letter is in the right position or not. For example, if you guessed BOARD and got one letter right, the answer might be PLAYS (the A matches, in the same place) but it could just as easily be GAMES (the A matches, not in the right place).

“Map. M-A-P”, she guessed. “One”, I replied.
“Jig. J-I-G”, I guessed. “Zero”, she replied.

Jotto is a favorite game for situations where it would not be feasible to set up a board or deal out cards. For example, you can easily play it in a restaurant, or waiting in line, or on a long drive. All you need is two pencils and two pieces of paper.

“Age. A-G-E”, she guessed. “Two”, I replied.
“Out. O-U-T”, I guessed. “Zero”, she replied.

In fact, you don't even need the pencil and paper! Most of the time, we play it in our heads with three-letter words instead of five. This is a great variation that allows the driver to play in the car. It also lets you play in situations where you are moving too much to be able to take notes comfortably, such as jogging or hiking.

For this game, I picked AXE as my word.

“Axe. A-X-E”, she guessed. “Got it. Dang that was fast!”, I replied.
“Men. M-E-N”, I guessed. “One”, she replied.

I started playing Jotto this way with my son when he was 10. We still enjoy it and play it often, but it has become kind of a running joke, because we almost always finish within one guess of each other. This is the first time I have played mental Jotto with my wife, and she's killing me! She got it in five guesses, and I'm not even close!

Ok, with ones for both FED and MEN, I guess that it probably has an E. Next, I want to figure out which letter from CAB was correct. I'll try the A, and I'll also throw one of the other letters from FED to help confirm that it really was the E.

“Far. F-A-R”, I guessed. “One”, she replied.

Good. It probably really was the A. What has an E and an A?

“Sea. S-E-A”, I guessed. “Two”, she replied.

Now I'm getting somewhere. It looks like the E-A is correct. What else has an E-A?

“Pea. P-E-A”, I guessed. “Two”, she replied.

Hmm. I'm nearly certain now that the E-A are correct. What else has an E-A? It can't be TEA because I already got a zero for OUT. What if it's A-E instead of E-A?

Wait a minute. No way. No, she couldn't possibly have picked...

“Axe. A-X-E”, I guessed. “Got it”, she laughed.

Oh, man. We really have been married too long.

Originally written as a session report for BoardGameGeek.


Karmen Blake said...

we are big into singing in the car. I think my family would enjoy this game too!

Daniel said...

Very nice, never heard of this one before. A friend taught me a game called Points & Commas that is very similar (she used digits instead of letters, and kept the unique-characters rule). The variant is that the response comes in the form of points and commas, where a point is a correct character in the correct position and a comma is a correct character in the incorrect position, and the order of the responses matches the guess. So for a guess of '12345' if my number was '26301' I would respond ',.,'.

I had some fun one afternoon writing AI strategies for this game and it turned out a very simple and effective strategy was simply to only make guesses that could be correct, i.e. that would match all previous responses if correct. This differs from the -- I think typical -- human strategy of verifying individual elements.

To use your example, this would mean you shouldn't guess 'FED' following a 1 for 'CAB', since 'FED' can't possibly be correct. Instead you must guess something that has at exactly one letter in common with CAB.

Of course, this might be harder to satisfy when playing with a limited set of words instead of arbitrary choices of numbers, although that is a nice way to bring more vocab in.

In then end this strategy is so good as to kill the fun of the game for Points & Commas (unless you just want to win or tie), so I'm curious how well it fares in Jotto.

Chris Okasaki said...

Daniel: I think many people use this strategy, but I'm not sure it's always a good idea.

For example, suppose your first three guesses are BAT (2), CAT (2), CAB (1). At this point, you know that A and T are in the word.

The problem is that there are still many, many possibilities for the third letter. Using your strategy, you will try each of these possibilities one at a time. Your next few guesses might be TAD, EAT, FAT, TAG, HAT, ... This will take you a long time to get to the answer if the word is VAT.

On the other hand, if you guess FED next and the answer is 0, then that one guess has done the work of TAD, EAT, and FAT. If the answer is 1, then you need at most three more guesses to get the answer.