# How can I create written logic puzzles with multiple variables and the fewest number of clues?

When I refer to written logic puzzles, I mean those in which, for example, 5 men wearing 5 different colors of aprons are bringing 5 different pies from 5 different cities to 5 different booths in the fair. There are clues such as, "John is bringing an apple pie from Pittsburgh, while the man wearing the green apron is taking his pie to the kissing booth." Given the clues, the reader has to determine each man's name, the color of his apron, which pie he's bringing, which city he's coming from, and which booth he's going to. A grid is frequently used to record the answers. (Sorry to be so verbose in my description, but I wanted to be sure a new person would know what I meant.)

I would like to create some of these -- I plan to send them to a magazine for publication -- but in order for me to solve them, I need to give too many clues. In the above situation, I should only need to give about 10 of these compound clues, but I find I'm giving easily twice as many. Is there a trick to reduce the number of clues needed, or do I just need to be smarter?

• Questions about puzzle creation are absolutely fine for this site (see puzzle-creation) and this is a good question :) Commented May 12, 2020 at 18:25
• Do you have an example of a puzzle of this type with 5 categories and only 10 hints? Usually I see 15-20 hints if you don't call "A is B and C is D" as one hint Commented May 12, 2020 at 19:40
• @Helena, I'm calling "A is B and C is D" as one compound clue, since they almost always pair clues in the same sentence. Commented May 12, 2020 at 21:01
• My approach would be to make a computer solver and the iteratively remove the solutions one at a time until it can't be solved any more. Commented Apr 26, 2022 at 4:21

A trick I find helpful is doing relationships, or in other words, "Jill brang a pie to (description of city) before the apple pie was delivered to Pittsburgh." This tells us that Jill is not carrying an apple pie, Jill is not going to Pittsburgh, Jill was before Pittsburgh, Pittsburgh is getting an apple pie, among other logical deductions. It's usually best to involve time (e.g. March, April, May, June, July) or some numerical values for these, so I would consider adding those (or swapping out an aspect for it) for your logic puzzle. It's also best to do these with three or four different people instead of just 2 (2 people used in example above) to give a lot more information in a clue. Then, after a few of these, add a few small clues such as "the person with the pumpkin pie is not going to new york" in order to ultimately lead to the other things being resolved becauxe of the small clues.

There are endless great ways to make a logic puzzle, and that variety is what keeps them fun, challenging, and interesting. I will walk through creating and solving a logic puzzle like the one mentioned, offering my thoughts along the way. This is an introduction to the topic, so be patient if I say something obvious to you.

This reply is just my personal take on this, which itself is constantly changing. To make the puzzle your own, you must put your own style and spin on it, and create it however best pleases you for reasons of your own. At the end of this walk-through, I will summarize some general tips.

Here goes...

My first thought when creating a puzzle like this is to calculate the solution space (if possible), which is just the number of possible solutions or configurations at the start before any clues are given. If that number is small enough that I can enumerate all of the possible solutions in an Excel spreadsheet, then I would probably try to do that. If the number is too large for Excel, then I would consider using a database (SQL Server is what I know, but there are many others).

If the number is too large to feasibly use a database, then I can either adjust the problem to shrink the space, or just start creating the puzzle on-the-fly and go back through it multiple times tweaking and rearranging the details.

The advantage to having a list of the entire solution space is that I can easily find out exactly how many possibilities each proposed clue would remove, and how many possibilities would remain. This allows me to be able to use much more complex logical clues and still keep track of how many solutions remain.

Here is a table showing the setup:

• Apron Colors: Red, Blue, Green, Yellow, and Orange
• Pies: Apple, Blackberry, Coconut Cream, Key Lime, and Lemon Meringue
• Cities: Chicago, Dallas, Los Angeles, New York, and Pittsburgh
• Booths: Kissing, Circle, Music, Sunshine, and House

Let's calculate the solution space for the example problem that you mentioned. If you don't want to see the math, skip this part.

To get the total number of permutations possible,

24.8 billion is the size of the solution space if order matters, but it does not, so we divide by 120 (permut(5,5))

207 million is the number of possibilities. If one were to take a random guess without looking at any clues, he would have a 1 in 207.36 million chance at guessing the correct answer.

Unfortunately, 207 million is just too large to feasibly make a list in Excel. Sure, it probably COULD be done, but Excel was not created for such large files. We could have 208 columns of 1 million rows each, but searching that would be nearly impossible.

However, a database table could easily hold all 207 million rows. Enumerating the possibilities correctly via VBA code behind Excel was not too difficult, but correctly enumerating the possibilities in the database table was more difficult (at least for me).

Therefore, I skipped enumerating the possibilities and just started creating the puzzle, making up clues on the fly and trying to use most/all of the logical operators (AND, OR, XOR, NOT) and combine them. I didn't use very complex clues on my first pass. I knew that I could add them in on my later attempts.

Clue #1 was taken straight from the OP's example question. I like it because the entire second part of it cannot be represented in the table yet. We must remember to come back to it and apply it when possible. The first part is directly stated, and I think it is more interesting to state MOST clues based on relationships to other things and/or using the logical operators rather than to state things directly.

Clue #2 uses two NOT operators and adds some complexity by using words that must be figured out in order to understand the clue (using "primary color" instead of naming the color(s) directly). I look at the latest state of the solution table at each step before making the next clue and use that information to focus my clue on the relationships that make sense.

Clue #3 gives a ton of information and allows for the removal of many pies, cities, and booths. At this point, I realized that it is not necessarily about the number of clues in a puzzle, but about how many possibilities each clue removes. If you want fewer clues in your puzzle, use more clues that each remove many possibilities. If you want to add complexity, use more clues that each remove fewer possibilities.

Clue #4, like Clue #3, removes a lot of possibilities. It combines three OR operators without even using the word "or". This is another way to add complexity: use more complex combinations of logic statements. More than 2 things can be connected with the OR operator. Mixing and/or nesting many ANDs and ORs is a way to add even more complexity which I did not use in this example.

Clue #5: Instead of directly saying, "Chad brought the Key Lime pie and Eric has the green apron," I try to say essentially the same thing in a different way that will be helpful only if the solver has correctly reduced the possibilities. Also, here is the point at which the solver must remember that part of clue #1 is not represented on the solution table and it can be used now to solve Eric's apron color (and thus, Chad's and Dan's apron colors), since he is at the kissing booth.

Clue #6: I use an XOR that appears true both ways on its face, but when closely examined, can be used to reduce the possibilities. According to our latest solution table, John COULD have a red apron, but Eric MUST be at the kissing booth, which means that John does not have a red apron, which leads to more reductions of other possibilities.

Clue #7: First the solver must know or find out what the Windy City is and what the Empire State is, and then apply one NOR and one NOT operator to the solution table.

Summary of Tips