# What's the best way to ensure a cryptogram has a unique solution?

What's the best way to make sure your new cryptogram has one, or very limited, valid solutions?

It could be very easy to accidentally include multiple solutions, what's a good way to prevent this?

• One way, which I suspect is the way the logic puzzle programmers do it, is to write a solving program with whatever logical implications you want. For a specific puzzle, you generate the solution first. You feed the (empty set) of clues to your solver. If it can't solve the puzzle, you add a random clue, then repeat until the solver succeeds. This lets you have different levels of puzzle, as you can limit the ways the solver can derive information. – Ross Millikan Dec 4 '14 at 3:44

### Make it long

The longer your cryptogram is, the less likely it is that all the words will form other valid words. As a very obvious example, a short one like ATX YXKI could have so many possibilities that it's just pointless to bother.

### Use most of the alphabet, including uncommon letters

For similar reasons to above. Uncommon letters (by definition) don't appear in as many words, so your chance of a collision is lower. If you're using 25/26 letters, the odds that another word just happens to have a Z or J in the right spot drops considerably.

### Use letter patterns

Certain digrams/trigrams are used often, others aren't. Other patterns such as vowel-consonant-vowel are very common. This is often the starting point when solving cryptograms, but you can also take it into consideration when creating them. By using uncommon patterns, you might increase both the difficulty and "uniqueness".

### Test it!

If you have the ability to do so, write a program to test many, many combinations against a dictionary. A straight brute-force is probably out of the question, but you could approach it step by step. First, just enter a word or two and have it search for matches. Then once it finds potentials, feed the rest of it in with those known letters.

You can do this by hand if you have strange word lengths or patterns. Find yourself a good dictionary (arranged by letter count), and try to solve one of the more rare words/patterns in as many ways as possible. Then see if there are any likely matches in the rest of the text.

### Unique?

For some cryptograms, there may be (despite your best effort) another possibility or few. That's not really a big deal, since you can give your puzzle a title/clue/theme. For example, many are pithy quotations, so if you "solve" one but it doesn't form coherent sentences, you didn't solve it.

• Hi @Geobits, I'm interested in why you don't see brute-forcing as a practical solution? ("A straight brute-force is probably out of the question") – A E Dec 4 '14 at 19:40
• @AE I should say a naive brute force is impractical. Assuming the puzzle uses the full alphabet, you'd need to test 26! (4e26) possibilities to check every letter-letter swap. I may have overlooked something with the math, but doing it a "smarter" way such as weeding it out with a few words first will save much time either way. – Set Big O Dec 4 '14 at 19:43
• Very nice answer. This type of answer is the kind that truly improves the overall quality on Puzzling. Great job! (I'll wait to see if there's more answers before accepting but I will +1) – warspyking Dec 4 '14 at 20:15