Puzzle With a Unique Solution: How Designers Make Sure

This article was written with AI and may contain mistakes. Found one? Tell us.

By Riddle10 Editorial Published 8 min read

A puzzle has a unique solution when exactly one answer fits every rule, and the surest way for a designer to guarantee that is to check every possibility, often with a computer [1], [2]. Logic puzzle research calls such a puzzle good, and adds a second test: a clear puzzle can be solved from its own statements alone, with no extra facts handed to the solver [1].

This article looks at why uniqueness matters, why it is surprisingly hard to achieve, and three ways that a puzzle can be pinned down to a single answer.

Why does a unique solution matter?

A puzzle makes a promise to the solver: there is an answer, and you can reach it by reasoning. When a second answer also fits every clue, that promise breaks. The solver cannot tell which answer the setter intended, and the moment of certainty that makes a puzzle satisfying never arrives.

A paper published on 4 February 2020 put this into two precise tests [1]. It calls a puzzle good when exactly one solution exists, and clear when the statements in the puzzle are all a solver needs [1]. The number of truth-tellers in a group is an example of extra information that a clear puzzle must do without [1].

Uniqueness is not just a matter of taste. It is also something a designer can build in deliberately, as the examples below show.

Why can't simple truth-teller and liar puzzles have one answer?

In the simplest truth-teller and liar puzzles, every speaker is one of two types. A truth-teller says only true things, a liar says only false things, and every statement is of the form that some person is a truth-teller or that some person is a liar [1].

These puzzles hide a trap. No puzzle of this simple kind is both clear and good [1]. The reason is a mirror effect: take any solution, swap every truth-teller for a liar and every liar for a truth-teller, and you get another valid solution, so solutions always come in pairs [1].

Here is a small example of the trap, with four speakers called P, Q, R and S.

  • P says that Q is a truth-teller.
  • Q says that R is a liar.
  • S says that P is a liar.
  • R says nothing.

Try P as a truth-teller. Then Q tells the truth too, so R is a liar, and S, who called P a liar, must be lying. Every statement checks out. Now flip every type: P and Q become liars, R and S become truth-tellers, and every statement still checks out. A short program that tries every assignment of types confirms that these are the only two solutions.

Notice that a count would not rescue this puzzle. Both solutions have exactly two truth-tellers, so telling the solver how many truth-tellers there are leaves both answers standing. Telling the solver that P tells the truth does pick out one answer, but then the puzzle is no longer clear.

How does a third type of speaker create a single answer?

The 2020 paper found a way out by adding a third type of person, one who can only make self-contradicting statements [1]. The classic self-contradiction is the sentence I am a liar.

Neither a truth-teller nor a liar can say I am a liar. If a truth-teller said it, the statement would be false; if a liar said it, the statement would be true [1]. So anyone who says it must belong to the third type [1].

Add one line to the example: R now says I am a liar. Everything else stays the same.

  • R must be of the third type, because of what R said.
  • Q said that R is a liar. R is not a liar, so that statement is false, and Q is a liar.
  • P said that Q is a truth-teller. That is false, so P is a liar too.
  • S said that P is a liar. That is true, so S is a truth-teller.

Every step was forced, so the puzzle now has exactly one solution. The same short program, trying every assignment of the three types, finds only this one. With only two types allowed, the same statements have no solution at all.

The paper proves that puzzles of this new kind can be both good and clear [1]. It also shows the flip side: every puzzle of this kind that is both good and clear must contain at least one speaker of the third type [1].

How rare are puzzles with exactly one answer?

Rarer than you might expect. The 2020 paper counted every puzzle in which each speaker makes at most one statement about each person, for groups of two, three and four speakers [1].

SpeakersPossible puzzlesGood, two typesGood, three types
Two81 [1]0 [1]9 [1]
Three19,683 [1]0 [1]553 [1]
Four43,046,721 [1]0 [1]136,017 [1]

In this count, a speaker who says nothing may be of any type, the third type included, while anyone who speaks must obey the rules of their type [1]. Even with the third type, only 553 of the 19,683 three-speaker puzzles have exactly one solution, fewer than 3 in every 100 [1].

We rebuilt the two-speaker and three-speaker rows ourselves by computer, using that same rule for silent speakers, and our counts came out identical.

The paper adds two more observations. The number of puzzles with no solution at all grows dramatically as speakers are added [1]. And most of the good puzzles contain exactly one speaker of the third type [1].

For a designer, the lesson is plain. A puzzle written by instinct is far more likely to have zero answers or several answers than exactly one. Checking is not optional.

How do designers build a position with only one good first move?

Peg solitaire shows how a computer can design for uniqueness from the start. Its rules are short: one peg leaps a neighbour into an empty hole, the leapt peg comes off, and the goal is one peg remaining [2].

The design method comes from a paper published on 9 June 2017, which searched for starting positions where exactly one first jump leads to a solution [2]. The method works backward. The computer starts from a finished board and plays the game in reverse, building a complete list of every position with a given number of pegs that can still be solved [2].

With those lists in hand, testing a candidate puzzle is quick. Make each possible first jump in turn: the result can be solved exactly when it appears in the list for one fewer peg [2]. Keep the positions where only one first jump passes that test.

The search is heavy. On the 37-hole hexagon board, the backward calculation took about a week of computer time and 20 GB of disk space, and the largest list held 364,696,466 positions [2].

Does symmetry spoil uniqueness?

Often it does. The paper observes that in a symmetric position, a good first jump always has mirror-image twins that work just as well [2]. Positions with only one first move that leads to a solution therefore tend to be lopsided, with no symmetry at all [2].

There is a second subtlety for designers. Pinning down the opening does not pin down the whole route. Two later jumps can often swap places, or the last jump can go either way, so most of these positions still allow more than one full route [2]. A complete route that is truly the only one turned up in just a handful of cases [2].

How can a computer prove there is exactly one answer?

Logic programming gives a direct test. The idea is to turn every rule of a puzzle into a formal rule and let a solver list every consistent world those rules allow. If it lists exactly one, the answer is not only found but shown to be the only one.

A paper published on 18 July 2023 did this for the well-known sum and product puzzle, where two people each hold only the sum or only the product of two hidden numbers and reason aloud in turn [3]. Its program turned out to have a single stable model, and that model leaves just one pair of numbers standing: 4 and 13 [3].

We repeated the uniqueness check ourselves by computer, filtering every allowed pair through the conversation, and the same single pair was the only one left.

Which uniqueness methods work best?

Each approach suits a different kind of puzzle.

MethodWhere it was usedWhat it guarantees
Count every small puzzleTruth-teller and liar puzzles [1]The exact number of solutions of each puzzle [1]
Search backward from the goalPeg solitaire [2]Exactly one first move keeps the puzzle solvable [2]
Logic program with one modelSum and product puzzle [3]A single consistent answer under the rules [3]
Hand the solver an extra factClassic truth-teller puzzles [1]One answer, at the cost of clarity [1]

The first three methods share one idea: they never trust a feeling that the answer is unique. They check every alternative and rule each one out.

How can you check your own puzzle?

You can apply the same discipline to any riddle or logic puzzle you write.

  1. Write the rules down exactly, so that nothing depends on an unstated assumption.
  2. List every candidate answer, even the silly ones.
  3. Test each candidate against every clue, one by one.
  4. If two candidates survive, add a clue that separates them, then test everything again.
  5. Prefer a clue inside the puzzle to a fact handed over from outside, so the puzzle stays clear.

The chest riddle below is built on exactly this idea: a count of true labels is the clue that leaves a single answer, and testing each chest in turn is the way in. Try it, then try the lock, where the clues together must leave a single code.

References

  1. Alzboon, L., & Nagy, B. (2020, February 4). Truth-Teller–Liar Puzzles with Self-Reference. Mathematics, 8(2), 190. DOI 10.3390/math8020190
  2. Bell, G. I. (2017, June 9). Designing Peg Solitaire Puzzles. Recreational Mathematics Magazine, 4(7), 5-19. DOI 10.1515/rmm-2017-0011
  3. Lifschitz, V. (2023, July 18). On Program Completion, with an Application to the Sum and Product Puzzle. Theory and Practice of Logic Programming, 23(4), 664-677. DOI 10.1017/S1471068423000224

unique solution puzzle design logic puzzles truth teller puzzles puzzle science

More reading