Jumble Puzzle Solver

Computer code to generate certain lists of English words

I wrote the first version of this package in 1997 after I came across the Jumble puzzles. English is not my mother tongue, and I was not able to solve these puzzles in any reasonable time by myself. It was much easier for me to write a program that would generate all the permutations of the letters that were to be unscrambled, and check which of them were present in the English dictionary using the Unix/Linux utility spell. *)

Solving the Jumble puzzles (with or without the help of my code) may actually help improving one's English, as it is a way to get introduced to new words, word plays, and new word meanings. Thus I have made my code somewhat more user friendly, and here it is available to others who also like to play with words (and programming). It will work without any changes only in Linux/Unix (or in Cygwin in MS Windows). Installation and use is very simple.

I've realized that I can easily make it even much more user friendly - by combining the mus and ow/us commands into one in such a way that it will always automatically generate all possible "surprise answers" in cases such as Example 3 below without the user having to do the intermediate steps manually.
So I suggest that you wait with downloading after this note will disappear.

The source code is here: jumble-solver.src.tgz. Download it and unpack into a directory. It consists of C programs and shell scripts. To compile the C programs, open a terminal window, go to the directory where you unpacked the jumble-solver, and type source compile (and hit Enter).
Alternatively, you can download the Linux binaries jumble-solver.bin.tgz. They are ready to be used after unpacking. (Compiling the source package directly on your computer may produce code more efficient then my binaries.)
The package depends on the Unix-like spell checker spell which may not be installed on your Linux distribution by default. Its ow command also uses the sort and sed utilities. You can use e.g. your package manager to install them if any of these are missing on your system.

The Jumble Solver package provides three commands: us (unscramble a single word), mus (multi-word unscramble), ow (one word at a time of a scrambled group of words). Entering each command without any arguments will produce a short description of how to use them.

In brief, the commands generate the following lists:
All English words made of a given set of letters (its only argument). Most often, it returns only one word (definitely for words used in Jumbles; or even none for many randomly chosen letters); thus it's OK to call it the "unscrambling" of a scrambled word.
Using any good English word as the argument of us will produce all other words consisting of the same letters. It's somewhat surprising to see how few different words share the same letters - definitely far fewer than is the number of the available theoretical permutations of the given letters.
In all my examples below I was entering the letter strings in lower case. It is also perfectly OK, actually preferred, to enter all the strings in upper case. Namely, upper case is required whenever proper names may play any role. **)

All groups of several English words of certain lengths containing only a given set of letters, each letter only once. It has a variable number of arguments: a string of letters followed by the lengths of individual words.

All English words of the same length that are made of any subset of a given set of letters. It has two arguments: a string of letters and the length of the words.

Examples of use in solving several Jumble Puzzles

Jumble Puzzle 1

This is the simplest case in which we can do everything with us:
> us acome
comae cameo 
> us feroc
> us reddeg
> us yurfip
> us ercdepi
The text after the prompt > is the command entered, and the next line contains the code's response. The single argument of us is the scrambled word from each line of the Jumble above. The first use of us shows a relatively rare case when us found two words, comae and cameo, and the user has to decide which one the author of the Jumble had in mind (or simply try both in turn). Because the "surprise answer" in this case is also one word, we can can again use us acting on the sequence of letters copied from the circled cells of the jumble.

Jumble Puzzle 2
> us jegud
> us emich
> us nexett
> us cavide
> mus gehittae 5
eight tea
eight ate
eight eta
eight eat
tithe age
Here the "surprise answer" consists of two words, and so we had to use mus. It's first argument is again the string of letters collected from the circled cells, and the second argument is the length of the first word. mus can be used for an arbitrary number of words, and one does not have to give the length of the last word (see example 4 below). Here mus returned five solutions, and of these the obvious choice that corresponds to the cartoon is "eight ate".

Jumble Puzzle 3
> us lyshy
> us gobef
> us slatte
> us rupple
pulper purple
> ow hlybeglasul 5
ables abuse alley bagel bales balls beaus belay bells belly blahs blase blues blush
bugle bulge bulgy bulls bully bushy egaly ellly gable gales galls glues gluey gsaly
gulls gully gushy gybes hales halls hauls heals hells hulas hulls label laugh leash
legal lubes lulls sable sally sealy shale shall shell sully usage usely yeahs yells 
> us hlgasu
When the number of letters in the first argument of mus exceeds 10, the execution time starts to grow significantly with the number of letters (partly because the code uses recursive functions). Here I at first tried msu hlybeglasul 5 as in the previous example, but it was soon obvious that the code will take some time to produce a solution. So I killed it for now, and tried the other approach recorded above using ow. In mere 15 seconds it spitted out the above list of 56 words (one on a line, but I rearranged them as above to save space). These are all English dictionary words that are five letters long and their letters are all in the string 'hlybeglasul'. The only word from this list that has an obvious relation to the cartoon in this Jumble (to the "abdominal surgeon") is the word "belly". So I next tried to find its companion word using us hlgasu. Here 'hlgasu' was obtained by removing from 'hlybeglasul' all the letters that were already contained in "belly". It worked, and gave right away the solution of this puzzle as "belly laughs". All this was achieved in less than two minutes.
Afterwards, I was still curious what mus would come up with in this case. It was:
> mus hlybeglasul 5
belly laughs
balls hugely
bagel lushly
blush galley
gable lushly
glues blahly
So "belly laughs" is really the only relevant solution in this case. But I had to wait 41 minutes for mus to finish its work (on a 2.4GHz computer). The code does not give out any indication that it continues to work, other than occasionally printing out a match with possibly very long intervals in between. There is no potential for infinite loops in the code, so if you have time to wait, be patient and do not kill the program prematurely, unless you are of course sure that one of the already printed matches (such as the first one above, "belly laughs") is the correct solution of the puzzle.
Therefore, in case of a multi-word "surprise answer" with 11 and more letters, the best strategy may be to start directly with ow, to try to get individual words of the solution one at a time. This can be quite fast even if it is sometimes necessary to try more than one word from the initial output of ow.

Jumble Puzzle 4
> us litte
> us ockal
> us nickes
> us tifful
> mus tiokckitu 4 3
kick out ti
kick out it
This is a straightforward application of mus to the case of the final answer consisting of three words of 4, 3 and 2 letters, respectively. Again, the length of the last word need not be given as it can be determined from the number of letters in 'tiokckitu' (9-4-3=2). The correct solution: a "kick out" of "it". Titanium (Ti or ti) of the first match returned above by mus is obviously not related in any way to our cartoon.

Jumble Puzzle 5

> mus rasrupesog 4
rasp grouse
rasp rogues
rasp rouges
raps grouse
raps rogues
raps rouges
rags poseur
rugs operas
rope sugars
ares groups
spar rogues
spar rouges
spar grouse
spur reagos
sera groups
sear groups
soar spurge
soar purges
sour pagers
sour grapes
sour gasper
sops arguer
sags pourer
sago purser
pore sugars
pour regsas
pour gasser
pour gsaers
pros augers
pros argues
pars grouse
pars rogues
pars rouges
pugs soarer
eras groups
ears groups
euro grasps
oars spurge
oars purges
ours pagers
ours grapes
ours gasper
gasp rouser
gasp sourer
gaps sourer
gaps rouser
The already well illustrated initial single-word unscrambling phase is omitted here.
This is an example when mus came up with quite a number of suggestions for "surprise answer" that needed a somewhat more careful read through. Nevertheless, "sour grapes" still emerged as the only serious candidate matching the cartoon.

Miroslav Kolář
February 6, 2011

*) With my code I was then able to solve a Jumble puzzle is a few minutes. I thought that this would give me an advantage over other readers of a local newspaper offering six weekly prizes of $100/$10 selected by lot from among the successful Jumble solvers. I was wrong! I had been regularly submitting my computer-generated Jumble solutions for almost a year but to my disappointment there must have been rather large numbers of other correct submissions as I never won any prize.
**) spell utility does not recognize proper names as valid words if their first letter is not capitalized (the only exception to this rule that I have found so far is "england"). It has no problems with all letters of any word being capitalized (or when only the first letter of any valid word is capitalized as expected in the beginning of sentences or in titles). Therefore, one gets more valid words when all letters are entered in upper case. Never use mixed case for a scrambled word, unless you know in advance which letter is the first one in the unscrambled word. A few examples for illustration:
> us belgium
> us Belgium
> us elgiumB
> us Elgiumb
> us Italy
> us italy
> us ITALY
> us robert
> us Robert
> us stop
stop spot tops opts post pots
> us sTop
> us Stop
Stop Spot 
> us STOP
(A missing response line from us of course means no match.)

code index   Home