Guess

by Dave Maier

I’ve always been a big fan of logic puzzles, especially Japanese ones (heyawake, nurikabe, gokigen naname, hashiwokakero), but I recently ran across another kind of puzzle which has been driving me crazy. So I thought I would share it with you, so maybe you also may be driven crazy. You’re welcome!

I do this puzzle (called “Guess” in this version) on my iPad, and I got it as part of large collection called Puzzles, which means that if you search for it on the App Store, you’ll get a bazillion hits and never find this particular one. Luckily (or not), Guess is easily available under another name, Mastermind, the name of the board game it’s based on. I don’t remember ever playing this game, but the only difference, I take it, is that when it’s played by two humans, one player chooses the tokens while the other guesses, and one scores better or worse based on how long it takes to get the answer (or fails to do so). Guess doesn’t give points, but one naturally tries in any case to solve the puzzle in as few steps as possible — which involves figuring things out rather than simply guessing randomly.

In any case, here’s how it works. Each turn you pick four colored tokens out of six possible colors (     ; repetition allowed) as your guess. The computer returns one black peg for each token with the right color in the right slot, and one white peg for each token with the right color, but in the wrong slot. (Note: if your guess includes two yellow tokens, but there is only one yellow token in the correct answer, you only get one peg for the two of them: black if one of your tokens is in the right spot, white otherwise.) I will use the word “hit” to refer to a token with the right color, whether or not in the right slot (that is, a black or white peg as opposed to no peg at all). Let’s try it!

Turn 1:      Result: 1w

I often do this at my first turn. It’s as good as anything. The first thing you learn about this game is that right guesses aren’t necessarily good and wrong guesses aren’t necessarily bad, so let’s not be disappointed that we only got the one white peg.

Turn 2:       Result: 1b 2w

The advantage of this play is that now that we’ve tried all the colors, but with no overlap between turns, we’ll be able to say for sure if any colors are repeated. And indeed, we now know quite a lot for two turns. Since there are four tokens, and our two guesses have yielded four total pegs, exactly one of them is ( or or or ), and exactly three of them are ( or ); and those last three are (  ) or (  ). If there had been only three total pegs, then either one of the first four must appear twice, or one of the second four three times. But that’s all we know, so we need to guess some more.

Turn 3:       Result: 1b

Okay, so either there’s a yellow one in the first or fourth slot, or a red one in the second or third slot. Not both, and no green or blue. What about the other colors?

Turn 4:      Result: 2b 1w

Here I’ve done something which looks funny: I chose a token which I already know couldn’t possibly be right – I already know there’s no blue one. But this actually helps clear things up. That slot must be the miss; so I know that our three tokens from turn 2 are (  ) rather than (  ). In fact, perhaps surprisingly, we’re almost there – just a 50/50 guess away. Consider: our two black pegs and one white peg correspond to   (the advantage of knowing for sure that the blue one is wrong). But the two black pegs from turn 4 can’t be the two purple tokens, because if so, we wouldn’t have gotten a black peg at turn 2: the purple ones there are in the wrong places, and the orange ones are too (because that’s where the purple ones actually belong, as per our hypothesis). That means the orange one at turn 4 is correct.

_ _ _

Since that’s the only orange one, the black peg at turn 2 must be the purple token in slot 4.

_ _

Now all we need to know is a) where the second purple token is, and b) what color the remaining one is (red or yellow). The black peg from turn 3 can now only be a yellow one in slot 1 or a red one in slot two, with the remaining one purple. So let’s try

Turn 5:  

Ding!

That wasn’t so bad. As do a number of others, however, the version I have suggests a “super” mode with five slots instead of four, and eight colors (       ) instead of six. Let’s try that!

Turn 1: As I usually do, I start with       Result: 1b 1w.

Bummer, not too informative. The best results are mostly right or mostly wrong. Let’s try some other colors.

Turn 2:      . Result: 1b 2w

Hmmm. Not much help. We don’t know which were the black pegs, and no colors have been ruled out; nor do we know which colors may appear more than once.

Turn 3:       Result: 1w

That’s better, just the one white one. We don’t know which one it is, but we do know that there is no more than one green one or light blue one, nor are there more than one of (  ). That’s something! There might be more than one red one though (though of course we don’t know for sure whether there are any at all).

Turn 4:       Result: 1w

That’s a good result too. At most one red one or blue one, and not both — in fact, only one of (  ), although there could still be more than one orange one. Together with turn 1, this means that there is either a yellow one or a green one, but not both (although possibly more than one yellow). There are probably more purple and/or brown ones.

Turn 5:       Result: 2w

OK, let’s see. Our meager showing here means that turn 2’s three hits were NOT   , because that would have given us more than two hits here at turn 5. That means at least one brown or red one (although possibly more than one brown one). Also, if the single hit on turn 3 is a light blue one, then from turn 5 we know that leaves only one yellow or purple one, and so two of turn 2’s three hits would be red and brown. But that can’t be right, because if 3’s single hit really were a light blue one, there couldn’t be any red ones. So there are no light blue ones at all, and our single hit on turn 3 is either red or green, and both of our two hits here at turn 5 are purple or yellow. This last means that turn 2’s three hits can’t include both red and brown (so then, exactly one red or brown there; although, again, maybe more than one brown overall). So:

No

At least one / but not both

At least two /

Turn 6:       Result: 1w.

Ha! Let’s see what this means. First, of course, no more than one of either brown or yellow, and not both. For two reasons that means at least one purple one (turn 5, and turn 2). Also, if our single hit were the orange one, that would mean no yellow, no brown, no red, and no blue (turn 4). But that can’t be right, because turn 2’s three hits mean at least one (  ). So no orange. Turn 4’s hit must be either blue or red.

Also, from turns 5 and 6, if there is a yellow one, it must be in slot 3. But if turn 2’s black peg is the yellow one in slot 3, then there are no purple ones in any of 3/4/5; and from turn 5 we know that there aren’t any purple ones in 1 or 2 either. But we already know there’s at least one purple one. So there’s no yellow one then.

That makes the single hit in turn 6 a brown one; and if no yellow (or light blue, which we already knew) then turn 5’s two hits are both purple. So turn two’s hits are two of   , and the black peg there is for the purple token. So, no red.

That’s big. If there aren’t any red ones, that makes turn 4’s single hit blue, and in 3/4/5. Also, no red and no light blue makes turn 3’s single hit green, and in 1/2/3. That makes turn 1’s two hits one green and one blue. So:

No

No

No 

No 

Exactly one 

At least two 

At least one 

Exactly one 

Now we should have our colors:     . But where do they go? Well, turn 5 tells us that neither purple one is in slot 1 or 2. But neither is the blue one (turn 4). So that leaves the brown and green ones for 1 and 2, and the two purple ones and the blue one for 3/4/5. But if the brown one were in slot 1, then turn 2’s black peg is that brown one, and the two purple ones would be the two white pegs. But that can’t be right, because two purple ones have to fit into 3/4/5, so one of turn 2’s purple ones must be the black peg. So that makes the brown one slot 2, and that leaves the green one for slot 1.

So if turn 1’s black peg isn’t the green one in slot 3, then it’s the blue one in slot 4; leaving the two purple ones in slots 3 and 5.

Turn 7:    

Ding!

Okay, one more. Cutting to the chase, here are the first seven turns:

1)      Result: 2w

2)      Result: 1w

3)      Result: 3w

4)      Result: 1b

5)      Result: 1b 1w

6)      Result: 3b

7)      Result: 2b

Here’s how I deduced, on my eighth turn, what the answer was.

Turn 6 was      // 3b, while turn 7 was      // 2b. This means that the three correct tokens on turn 6 are not the one orange and two brown ones, because if they were, we’d get the same three black pegs on turn 7. But we didn’t; so that means that there’s a yellow one, in either the first or third place (or possibly both).

From turn 2, then, that single white peg must be the yellow one, which we now know to be in the first slot. The other tokens in row 2 are wrong; so there are no red ones and no purple ones.

 _ _ _ _

If there’s no purple one, though, then from turn 5 we know that there must be at least one orange one, because we got two hits from the two orange and one blue there. This means that the two hits from turn 1 are the orange one and the yellow one. So there are no red ones (we knew that already), no green ones, and no blue ones.

No green and no red means that the single black peg from turn 4 is the light blue one in slot 5.

 _ _ _ 

From turn 6 we know that there must be at least one brown one, because slot 3 is a miss (there are no white pegs, and we know from turn 2 that slot 3 is not yellow) and there are two brown guesses in the four remaining, with three hits — so, at least one brown one, and since there are no white pegs, that brown one must be in the right spot: that is, either slot 4 or slot 5. But we already know that slot 5 is light blue. So, slot 4 is brown.

 _ _  

Since there are no blue ones and no purple ones, turn 5 tells us that the two hits are both orange. But there are only two slots remaining. So,

Turn 8:    

Ding! (Phew!)

For more, get thee to the App Store and look for Mastermind. But if it drives you crazy, don’t say you weren’t warned!