7
$\begingroup$

This puzzle is part of the Monthly Topic Challenge #7: Board games.


Inspired by the incident, I created a variant of Mastermind, although it wasn't actually intended for colorblind people. The main difference is that you don't know what the small pegs exactly mean in the first place. You just know that one of them means "hot" (the number is correct and in the right place) and the other means "warm" (the number is correct but is in the wrong place) - you don't know which is which. Here is an example.

Guess | Response
1267  | No small pegs
3458  | 3 blue pegs
7824  | 1 blue peg
5888  | 1 pink peg
4533  | 3 blue pegs and 1 pink peg

The variant can be made harder if a third small peg for "cold" (the number is not in the hidden code at all - equivalent to the empty slot in the original Mastermind) is mixed into the set of small pegs. Here is another example. In this example I will use three different symbols for each kind of pegs. (The order of the small pegs does not matter)

Guess | Response
1234  | $$$£
3445  | $$$$
4567  | $$€$
2733  | £$$$
4787  | $£$£
8628  | €£$$

Task 1:

Is it possible to find the hidden code of the above two rounds through logical deduction? If not, consider the possible further guesses that could lead to the solution.

Task 2:

Is there a clever way to solve these Mastermind variants?

$\endgroup$

5 Answers 5

7
$\begingroup$

Puzzle 1:

Immediately, we see that pink is hot: you cannot have three hot pegs and one warm peg in four-peg Mastermind.
The digits are given in 4533 since we have four pegs; 5888 shows that the 5 is correct. 3458 and 7824 rule out 5433 and 5334 (otherwise the 4 would be hot), so 5343 is correct.

Puzzle 2:

$ must be cold; otherwise, 3445 has all correct digits and 1234 would need two cold pegs.
If € is hot, then the 6 in 4567 must be the hot peg, because the 7 is not hot in 2787. The 6 is warm in 8628, and 2 cannot be hot because it's in 6's place so it is cold, but then 7 must be warm in 2733 and cold in 4567.
So € is warm and £ is hot, and the rest is simple: 2 is not hot in 1234 because it would be warm in 2733, so the code begins with 17, and the second 7 is not hot in 4787 because it is warm in 4567, so the 8 must be, and the hot peg in 8628 can only be the last one, making the code 1788.

$\endgroup$
3
$\begingroup$

I assume that

If a digit in the guess appears multiple times but there is only one of it in the actual solution, there are two possible guess results

one

if one of the guesses is in the correct position, this will result in a "one hot" outcome.

two

However, if none of the guesses are in the correct position, it will only result in a "one warm."

I have found the answer as

1788

£ is

Hot or $\oplus$

$ is

cold or $\otimes $

and € is

warm or $\ominus $

the rest is very straight forward;

Let's start from $2nd$ guess | $(1)$

since all are , we can conclude that 3,4 and 5 are not in the solution. -> $[{\otimes3},{\otimes4},{\otimes5}]$

Note that

We use the phrase "at least once" because based on the information given, it's uncertain if it may occur more than once.

Let's go back to the $1st$ guess; | $(2)$

By using the information from $(1)$, we can conclude that either 1 or 2 has to exist in the solution at least once and its location is right. $[\oplus(1,2)]$

From 3rd guess; | $(3)$

By using the information from $(1)$, we know that 4,5 do not e xist so either 6 or 7 has to exist in the solution at least once and its location is wrong. $[\ominus(6,7)]$

from fourth guess; | $(4)$

Similar to $(2)$ and $(3)$, either 2 or 7 has to exist in the solution at least once and its position is right. $[\oplus(2,7)]$

by using the information from $(2)$, $(3)$ and $(4)$, we can conclude that | $(5)$

Either 2 and 6 have to exist together or 1 and 7 have to exist together in the solution at least once for each of them. If 1 and 7 exist, they are in the right locations.

From fifth guess; | $(6)$

Since we already know that 4 does not exist, there are only two possible outcomes 7,7 or 8,7 has to be in the solution.

and by using the information coming $(5)$ from the sixth guess; $(7)$

we can tell that 2,6 or 8,8 do exist in the solution. Because we know that if 2 exists 6 has to exist. If 2,6 do not exist, then 8,8 has to exist in the solution.

therefore,

Let's assume 8,8 do not exist in the solution, then from $(6)$, 7,7 has to be in the solution. But this condition would not satisfy condition $(5)$ saying either 2,6 or 1,7 existence.

As a result

2,6 do not exist, resulting 1,7 has to then and their locations are right! and since 2,6 do not exist, 8 and 8 have to exist.

which results;

we can have 1,7,8,8 as numbers. 1,7 are in the right locations, then just 8s into the rest will result the solution.

$\endgroup$
3
  • 1
    $\begingroup$ I'm sorry, but I seem to be having trouble following your train of logic; how did you go about working out which symbol was "Hot" and which was "Cold"? You seem to just state it as fact, and then go straight into solving the puzzle using those values? $\endgroup$ Feb 2, 2023 at 23:43
  • $\begingroup$ @Chronocidal I edited the solution for you, hopefully it is better. $\endgroup$
    – Oray
    Feb 4, 2023 at 8:01
  • 1
    $\begingroup$ You still seem to be jumping straight into saying "we know this symbol means the location is right" and "we know this symbol means the location is wrong", without actually saying how you determined that? i.e. your "Step (1)" is logically sound, but I cannot see anything showing how you arrived at the priors you rely on for "Step (2)" and "Step (3)"? I would have expected that to come in Step (4) by comparing guesses 3 and 6… $\endgroup$ Feb 4, 2023 at 17:27
1
$\begingroup$

Solution to Task 1, Puzzle 1:

From the last clue, the 4 digits used must be 4,5,3,3. Go to the second clue. If the blue pegs were to represent 'hot', then the code would start with '345'. This means the last guess can have at most 1 blue peg, which is the three end. As this is impossible, blue must represent 'warm' and pink 'hot'.

The fourth clue tells us 5 must be the first digit. The second and third clues used together tell us that 4 cannot be the second or the last digit. So 4 has to be the third digit. So the code is 5343

$\endgroup$
3
  • $\begingroup$ wait a minute. The pegs correspond to the same-positioned large pegs? I thought it was mixed. $\endgroup$ Feb 2, 2023 at 13:08
  • 2
    $\begingroup$ I think your hot pound deduction (about the sevens in clue five) is mistaken. The correct digits could be the eight and one of the sevens. $\endgroup$
    – fljx
    Feb 2, 2023 at 13:18
  • $\begingroup$ Ah of course, i fell into the trap of carelessly assuming both the pound signs are in the exact position as given in the clue. $\endgroup$ Feb 2, 2023 at 13:46
1
$\begingroup$

Situation 1:
Blue peg = right digit, in wrong place
Pink peg = right digit, in right place
No peg = wrong digit

1267 | No small pegs
3458 | 3 blue pegs
7824 | 1 blue peg
5888 | 1 pink peg
4533 | 3 blue pegs and 1 pink peg

By case 3, we can see 345 are correct digits, and we know 4 cannot be the second place digit from case 2.
In case 4, 5 is the leading digit with a pink peg.
Thus the answer here is 5343.

Situation 2:
A lot trickier. If the ordering does not matter...
£ = right digit, in right place
€ = right digit, in wrong place
\$ = wrong digit

Here we have to work case by case. Without being too sure on what the symbols mean, given that the $ symbol accounts for more than four digits, we can assume it means "wrong digit."
Case 1: 1234, one good digit(can't ascertain correct digit or position)
Case 2: 3445, no good digits(chuck all of these)
Case 3: 4567, one good digit(can't ascertain correct digit or position)
Case 4: 2733, one good digit(can't ascertain correct digit or position)
Case 5: 4787, two good digits(can't ascertain correct digit or position)
Case 6: 8628, two good digits(can't ascertain correct digit or position)

We know 3,4,5 are all out. This leaves 1 and 2 from case 1. 6 or 7 is good from case 3. If we go by overlaps, we have 2 and 7 in case 4 with one of these being right. They can't both be right, but if I assume 7 is right from case 3, I can also eliminate 2 from case 1. 6 can also be eliminated from case 4. This leaves me 1 and 7 thus far. That means 8 is my remaining option(no 0 or 9 shown). In case 5 we see two 7s and two "good" pegs. This rules out 8. In case 6, we have a problem. 2 and 8 have been ruled out, but there are two "good" pegs. What if the amount of good pegs shown for a digit corresponds with its frequency in the solution?

Now let's take another look. 3,4,5 are still out. 1 and 7 still fit as right digits. Revisiting case 5, 4 is out, but one 7 and one 8 could be correct for the solution. And the two correct digits from case 6 are likely 8s, as 2 and 6 have been ruled out. Now we just need to ascertain the positions of the 1, 7, and two 8s.

I want to start with cases 3 and 4. 7 is marked with € in case 3, and £ in case 4. One of the 7s in case 5 is also marked with £, and there is only one 7 in my solution. 7 comes second in both case 4 and 5, and is marked with the same symbol in each case, so now I have my symbols figured out! This also means 8 comes third in the solution. If we know € = right digit in wrong place, then we can determine that 8 is not the first digit in the solution. Thus, we are left with the answer: 1788

P.S.: Is there an easier way to make spoiler blocks? I'm new :^)

$\endgroup$
1
$\begingroup$

In both examples (Games 1 and 2), x denotes blanks/digits not in the code at all.

Game 1:

1, 2, 6 and 7 are out.

8 is out due to the opposite colors for 7824 and 5888.

As for 3458, 3, 4 and 5 are in.

4s are in different places in 345x (3 blue from row 2) and xxx4 (1 blue from row 3), so blue = warm.

5 is hot in 5xxx from row 4, so 5 comes first.

4 comes third.

The answer is 5343.

Game 2:

1234 and 4567 only have 4 as a common digit, so at most we can get 5 non-cold results, making the dollar sign cold. This means 3, 4 and 5 are out.

1 or 2 exists. 7 or 6 exists. 7 or 2 exists. 7 must be in, so 1 is also in, ruling out 2 and 6.

8 is also in. 1, 7 and 8 are in the code.

The symbols are different for xxx7 and x7xx, so 7 can't be both the 2nd and last digit.

8xx8 has one pound and one euro, so there are two 8s with one of them being the first or last digit, and there's only one 7, meaning one of the 7s in x787 must be the dollar. Both of the remaining symbols for x787 are pounds, so xx8x has two.

7 can be the 2nd or last digit.

x7x7 has a pound, so it must mean hot. The result is 1788.

Task 2 (partial):

First variant:

1. Guess 1234.

2. Guess 5678.

3. If there are 4 symbols in total, digits don't repeat in the code. Guess 1256 (or rearrange the digits/guess an arrangement of the remaining digits).

4. Guess 5634 (ditto).

5. Guess 1237 (ditto).

6. Guess 1247 (ditto).

7. Guess 3426 (ditto).

8. Guess 3416 (ditto).

For a more equal representation among the number orders, actually guessing 1234, 5678, 2156, 4563, 3712, 7421, 6342 and 8527 would be better, though.

9. After those steps, you can figure out which digits are in the code:

- If there's only 1 digit we can call $n$, the answer is $nnnn$.

- If there are only 2 digits we can call $n$ and $m$, first guess $nnnn$. Any filled pegs will be the "hot" color.

If 2 pegs are filled, the code can be $nnmm$, $mmnn$, $nmnm$, $nmmn$, $mnmn$ or $mnnm$, and we can find it in 3 turns by guessing $nxxx$ first, narrowing down to $nnmm$, $nmmn$ and $nmnm$ (hot), or $mmnn$, $mnmn$ and $mnnm$ (cold). Assuming the first case is true, then guess $xnmx$. Then you can find the code in your last move.

If 3 pegs are filled, there are 3$n$s. To find where the $m$ is, guess $mmxx$. Depending on the result, binary search the $m$ and find the code in the 12th move.

- If there are 4 digits, we can also find out what the colors mean and the code thanks to the rarity of the hot color.

- If there are 3 digits, guess $dddd$, $d$ being one of the digits in the code. The remaining 3 guesses are enough.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.