Anagrams

ANAGRAMS v1.6

Contents:

DOWNLOAD ANAGRAMS

ANAGRAMS is a shareware program that generates anagrams for any word or phrase you give it. ANAGRAMS is a DOS program but it runs under Windows as well.

You can download either of the following files:

This archive contains the following files:

FILE SIZE DATE TIME
ANAGRAMS.EXE 27,368 03-11-97 11:19p
ANAGRAMS.TXT 28,533 03-11-97 11:21p
1.CMP 6 05-20-91 1:40a
2.CMP 59 05-20-91 1:40a
3.CMP 964 05-20-91 1:40a
4.CMP 5,338 05-20-91 1:40a
5.CMP 14,351 05-20-91 1:40a
6.CMP 28,148 05-20-91 1:40a

ANAGRAMS.EXE is the main executable file, ANAGRAMS.TXT is this documentation file, and *.CMP are the dictionary files.

NEW: I've recently released the ANAGRAMS source code (as well as source code to other programs) under the GNU GPL.

WHAT ARE ANAGRAMS?

An anagram is a word or phrase made by rearranging all the letters in another word or phrase. For example, an anagram for SUBMARINE is SEMIURBAN.

Here are anagrams for other phrases:

PHRASE ANAGRAM
Saddam Hussein He damns Saudis
Charles Manson Slasher con man
Marilyn Monroe Merrily moan on
David Letterman Dead mitral vent
Mary Jo Kopechne My joke chaperon
Benito Mussolini So, I bout Leninism
Lee Harvey Oswald Oe, why ever Dallas?
Elvis Aron Presley Very loin pleasers
Ronald Wilson Reagan Orwellian radon snag
Richard Milhous Nixon Nix Hanoi child rumors
John Fitzgerald Kennedy Jerk thy fond Nazi legend
George Herbert Walker Bush Heartbroke Hebrew slugger
Jacqueline Lee Bouvier Onassis Bees join sequoia surveillance

ANAGRAMS is a program that anagrammizes any phrase you give it. The anagrams it generates are made up of words in ANAGRAMS's dictionary.

I got the idea to write ANAGRAMS after having seen Neil J. Rubenking's NAMEGRAM program. ANAGRAMS was written in its entirety by Kim Moser, using Borland's Turbo C 2.0. (The latest version was compiled with Microsoft Visual C++ 1.5.) Neither ANAGRAMS's source code nor its algorithms were derived from any other programs.

Two versions of ANAGRAMS are available: the "unregistered" version and the "registered" version. The dictionary supplied with the unregistered version of ANAGRAMS contains words up to 6 letters long.

The registered version of ANAGRAMS has a larger dictionary (with words up to 27 letters long), and has the ability to find "interesting" anagrams (i.e. anagrams which contain at least one "interesting" word).

HOW ANAGRAMS WORKS

Given a phrase (usually someone's name), ANAGRAMS reads all the candidate words from its dictionary. A candidate word is one whose letters are all in the phrase you want to anagrammize. For example, if you're anagrammizing COMPUTER, then CUTE is one of the candidate words. COOP is not a candidate word, though, because it contains two O's, whereas COMPUTER contains only one.

ANAGRAMS then checks all combinations of the candidate words it just read, and displays those combinations whose letters make up an anagram of the phrase you're anagrammizing.

Because anagrams which contain at least one long word are usually more interesting than those which contain only short words, ANAGRAMS first looks for anagrams which contain the longest candidate words, then progresses to anagrams which contain only shorter candidate words.

When it finds an anagram, ANAGRAMS displays the candidate words which make up the anagram. The longest candidate words will be displayed first, and the shortest will be displayed last. Words that are the same length are displayed in alphabetical order. For example, an anagram for KIM MOSER is ROM SKI ME. Note that the three-letter words are displayed before the two-letter words, and the two three-letter words (ROM and SKI) are displayed in alphabetical order.

It's up to you to rearrange the words within an anagram to find meaningful phrases. For example, an anagram for JOHN FITZGERALD KENNEDY is TOKING JENNY HARD FED LEZ. This makes more sense when rearranged into HARD-TOKING JENNY, LEZ FED. (Okay, it makes only marginally more sense, but you get the idea.)

HOW TO USE ANAGRAMS

Invoke ANAGRAMS from the DOS command line as follows:

ANAGRAMS [-option ...] <phrase>

<phrase> must contain only alpha characters ('A' through 'Z'), which may be upper- or lowercase. Spaces (' ') are not allowed.

The following command line options may be used:

OPTION MEANING
-b<wrd> Begin with word <wrd> (useful for restarting)
-c Show just the candidate words (no anagrams) (note: only the registered version of ANAGRAMS supports this option)
-d Disallow duplicate words in an anagram
-e Echo anagrams to stderr, too
-i find only interesting anagrams (note: only the registered version of ANAGRAMS supports this option)
-r Tell ANAGRAMS not to create a range table.
-s<n> Set status level to <n> (0=off, 1=outermost word, 2=% done, 3=# out)
-m<min> Minimum word length = <min>
-a<max> Maximum word length = <max>
-w<min> Find anagrams which contain at least <min> words
-x<max> Find anagrams which contain at most <max> words
-fi Flag interesting anagrams (note: only the registered version of ANAGRAMS supports this option)
-fw<min> Flag anagrams which contain at least <min> words
-fw<max> Flag anagrams which contain at most <max> words
-pn<nnn> Format output into <nnn> columns
-pw<nnn> Columns will be <nnn> characters wide
-pp<nnn> Page is <nnn> characters wide

ANAGRAMS's options are case-insensitive; you may specify them in either upper- or lowercase.

Here are some examples:

ANAGRAMS KimMoser
finds all anagrams for KimMoser.

ANAGRAMS -m3 KimMoser
finds only those anagrams for KimMoser which contain words that are at least 3 letters long.

ANAGRAMS -m3 -a4 KimMoser
finds only those anagrams for KimMoser which contain words that are at least 3 letters and at most 4 letters long.

ANAGRAMS -w2 -x3 KimMoser
finds only those anagrams for KimMoser which contain at least 2 words and at most 3 words.

ANAGRAMS -w2 -x2 KimMoser
finds only those anagrams for KimMoser which contain exactly 2 words.

THE -B OPTION

If you ever have to stop ANAGRAMS in the middle of anagrammizing a phrase, you can use the -B option to restart ANAGRAMS where it left off. You must specify the candidate word that ANAGRAMS was up to when it was stopped. For example, if you stopped ANAGRAMS in the middle of finding anagrams for InternationalBusinessMachines, and the candidate word it was up to was SENSATIONALISTS, then you can restart it like this:

ANAGRAMS -bSENSATIONALISTS InternationalBusinessMachines

The candidate word may be specified in either upper- or lowercase. If the word which you specify is not a candidate word, ANAGRAMS will start with the first (longest) candidate word.

You'll probably want to restart ANAGRAMS with all the other command line options that you were using previously, but you don't have to.

THE -C OPTION

Only the registered version of ANAGRAMS supports the -C option. The -C option causes ANAGRAMS to show just the candidate words; anagrams are not generated. Candidate words are shown longest to shortest.

THE -D OPTION

Use the -D option to prevent ANAGRAMS from finding anagrams which contain duplicate words. For example, if you're anagrammizing the phrase BE NO BONE, the -D option will prevent the anagram NOON BE BE from being found because the word BE is duplicated. Likewise, BONE BONE won't be found, either.

Note that if the phrase you're anagrammizing has no duplicate letters, then ANAGRAMS will automatically invoke the -D option for you, since it knows that none of the anagrams will contain any duplicate words. Also, invoking the -D option speeds up ANAGRAMS's calculations a bit.

THE -E OPTION

Normally, ANAGRAMS sends all the anagrams it finds to the standard output device (usually the screen). You can redirect its output to a file, like this:
ANAGRAMS WHATEVER >OUT.TXT

This will create the file OUT.TXT, which will contain the anagrams for WHATEVER. When ANAGRAMS is working, though, you won't be able to see the anagrams it comes up with, because they're being redirected to a file.

The -E option tells ANAGRAMS to send the anagrams to stderr (always the screen) as well. This lets you see anagrams as they're generated, even if ANAGRAMS's output is redirected to a file.

While ANAGRAMS is running, you can press the 'E' key to turn the -E option on and off. (See below for more information on valid keystrokes while ANAGRAMS is running.)

THE -I OPTION

Only the registered version of ANAGRAMS supports the -I option. The -I option causes ANAGRAMS to display only "interesting" anagrams.

An "interesting" anagram is one which contains at least one "interesting" word. An "interesting" word is one which I marked as "interesting" when I created ANAGRAMS's dictionary. Most of the "interesting" words are related to politics, religion, or sex.

THE -R OPTION

The -R option tells ANAGRAMS not to create a range table. Normally ANAGRAMS creates a range table in memory to speed up its calculations, but when the phrase to be anagrammized is long it can take an inordinate amount of time to create the range table. In such cases, it's most efficient to use this option to tell ANAGRAMS not create a range table.

THE -S OPTION

Use the -S option to set the status level.

LEVEL EFFECT
0 The status is shut off completely. (If the -S option is not specified, this is the default status level).
1 ANAGRAMS shows the outermost candidate word that it's up to.
2 ANAGRAMS shows everything that it does in level 1, as well as how many candidate words it has checked, how many remain to be checked, and what percentage it's done.
3 ANAGRAMS shows everything that it does in level 1 and 2, as well as how many anagrams it has found so far.

As it checks each candidate word, ANAGRAMS will display the current status. The more candidate words that were read in, the longer it will take for ANAGRAMS to display the status.

Note that while ANAGRAMS is running, you can press '?' to see the current status. Hitting '?' causes ANAGRAMS to show you everything that you would see if the status level was set to 3.

THE -M OPTION

Use the -M option to tell ANAGRAMS the minimum candidate word length that it should use. For example, if you want to see anagrams which contain only words that are at least 4 characters long, invoke ANAGRAMS as follows:

ANAGRAMS -m4 WHATEVER

Of course, the minimum word length you specify must be no longer than the phrase for which you want to find anagrams. For example:

ANAGRAMS -m8 TEST

is not allowed because TEST contains only 4 characters; the longest candidate word, therefore, won't be longer than 4 characters, so limiting it to 8 characters is meaningless. Also:

ANAGRAMS -m5 KimMoser

is not allowed because no combination of 5-letter words (or longer) can generate an anagram which contains 8 letters.

THE -A OPTION

The -A option is similar to the -M option, but is used to tell ANAGRAMS the maximum candidate word length that it should use. For example, if you want to see anagrams which contain words that are at most 4 characters long, invoke ANAGRAMS as follows:

ANAGRAMS -a4 WHATEVER

Of course, if the maximum candidate word length that you specify is longer than the phrase you're anagrammizing, ANAGRAMS will ignore the maximum word length that you requested.

When using both the -M and the -A options, the minimum candidate word length that you specify must be less than or equal to the maximum candidate word length that you specify. For example:

ANAGRAMS -m3 -a4 WHATEVER

is acceptable, but:

ANAGRAMS -m4 -a3 WHATEVER

is not.

THE -W OPTION

Use the -W option to tell ANAGRAMS the minimum number of words an anagram must contain for it to be displayed. If you don't use the -W option, all anagrams are displayed, regardless of how few words they contain.

THE -X OPTION

Use the -X option to tell ANAGRAMS the maximum number of words an anagram may contain for it to be displayed. If you don't use the -X option, all anagrams are displayed, regardless of how many words they contain.

If you use both the -W and the -X option, then the number that you specify with the -W option must be no larger than the number you specify with the -X option. For example,

ANAGRAMS -w2 -x3 KimMoser

means "display all anagrams which contain at least 2 and at most 3 words," which is acceptable. But,

anagrams -w3 -x2 KimMoser

means "display all anagrams which contain at least 3 and at most 2 words," which is not acceptable.

THE -FI OPTION

Only the registered version of ANAGRAMS supports the -FI option. This option causes ANAGRAMS to flag "interesting" anagrams with asterisks ('*').

At the end of each "interesting" anagram, an asterisk will be printed for every "interesting" word in the anagram. The more interesting words the anagram contains, the more asterisks will be printed.

THE -FW OPTION

Use the -FW option to specify the minimum number of candidate words an anagram must contain for it to be marked. If an anagram contains at least that many words, it will be marked with plus signs ("+").

See the description of the -FX option for more information on how anagrams are marked.

THE -FX OPTION

Use the -FX option to specify the maximum number of candidate words an anagram may contain for it to be marked. If an anagram contains no more than that number of words, it will be marked with plus signs ("+").

For each word in the anagram being marked, a plus sign will be printed at the end of the anagram. A three-word anagram, for example, will be marked with "+++" (three plus signs).

If neither the -FW nor the -FX option is used, no anagrams will be marked with plus signs.

THE -PN OPTION

Use the -PN option to specify how many columns the anagrams (or candidate words, if you used the -C option) should be printed into.

Based on the length of the phrase you're anagrammizing, ANAGRAMS will make its best guess as to how wide the columns should be so that the longest anagram (or candidate word, if you used the -C option) will fit.

THE -PW OPTION

Use the -PW option to specify how wide the columns will be.

THE -PP OPTION

Use the -PP option to specify the width of each "page." Based on the length of the phrase you're anagrammizing (or the longest candidate word), ANAGRAMS will calculate the number of columns and the width of the columns for you.

Of course, you can override ANAGRAMS by specify either the number of columns (with the -PN option) or the column width (with the -PW option).

The -PN, -PW, and -PP options work together like this:

For example, if you specified a page width of 80 characters, and a column width of 12 characters, ANAGRAMS will set the number of columns to 6.

Likewise, if you specified a page width of 80 characters, and the number of columns at 5, ANAGRAMS will set the column width at 16 characters.

Note that when ANAGRAMS has to calculate the column width, it can only make an educated guess. This is because it hasn't yet generated any anagrams, so it doesn't know how wide the longest anagram will be.

While ANAGRAMS is finding anagrams, it accepts the following keystrokes:

KEY EFFECT
Q Quits ANAGRAMS, returning you to DOS
N Skip to next leading candidate word
E Toggle -E option (echo anagrams to screen)
P Pause ANAGRAMS
S Change the status level
? Show status

If you hit any other key, ANAGRAMS will display the list of valid keys.

Hitting 'Q' will stop ANAGRAMS, returning you to DOS.

Hitting 'N' stops ANAGRAMS from looking for anagrams which begin with the candidate word that it's up to, and causes it to look for anagrams which start with the next candidate word. Think of this as the "fast forward" key. It will cause you to miss some potential anagrams, but it lets you jump quickly to the next candidate word.

Hitting 'E' will toggle the -E option: if the -E option is on, it will be turned off; if it is off, it will be turned on. If you've redirected ANAGRAMS's output to a file, you can use the -E option to take a peek at the anagrams that are being generated.

Hitting 'P' pauses ANAGRAMS and writes a message telling you to hit any key to continue.

Hitting 'S' causes ANAGRAMS to change the status to the next highest level (or to 0 if the status level is already set to 3).

Hitting '?' shows you which candidate words are being worked on, how many candidate words were read in, how many candidate words have been checked, what percentage is done, and how many anagrams have been found so far. This is exactly what you see when the -S option was used to set the status level to 3.

Note that ANAGRAMS checks for and processes keystrokes only AFTER it finds a candidate word that fits in the anagram that it's checking. This usually happens dozens of times a second, so your keystrokes are usually acted on almost immediately.

Sometimes, though, it will take ANAGRAMS a long time to find the next word that fits in the anagram. This usually happens when you're anagrammizing a particularly long phrase, or one which contains very few (or no) duplicate letters. When this happens, your keystrokes will be ignored until ANAGRAMS finds the next word that fits.

When ANAGRAMS doesn't respond to your keystrokes, you can either wait patiently for it to respond, or you can hit Ctrl-C (or Ctrl-Break) to stop it and return to DOS.

HINTS, TRICKS, AND TIPS

Reducing the Number of Anagrams

Undoubtedly you'll want to use ANAGRAMS to anagrammize the names of your relatives, friends, and enemies. You'll find that some names yield a few hundred anagrams, some yield a few thousand, and others yield a few million. As you'd expect, long names generally yield more anagrams than do shorter names.

But nobody wants to pick through the millions of anagrams for John Fitzgerald Kennedy, just to find a juicy one like JOHN LED NAZIFY KEG TREND. Here are some suggestions to cut down on the number of anagrams that ANAGRAMS generates:

Jumbles: Using Anagrams to Unscramble Words

You can use ANAGRAMS to help unscramble words. For example, if you're given the scrambled word MELCARBS, you can find which words its letters can be rearranged into. Invoke ANAGRAMS as follows:

ANAGRAMS -m8 MELCARBS

The -m8 option will cause ANAGRAMS to use only candidate words that are at least 8 characters long. But because MELCARBS is exactly 8 characters long, only candidate words that are exactly 8 characters long will be considered. Anagrams will print the words CLAMBERS and SCRAMBLE.

Speeding Up Anagrams

If ANAGRAMS takes an inordinate amount of time to create the range table, try using the -R option.

ERROR MESSAGES

Under certain circumstances, ANAGRAMS writes the following messages:

fopen() failed for word file '<word_file>'.
ANAGRAMS was unable to open the dictionary file named <word_file>. You should make sure that <word_file> is in your currently logged directory.

fclose() failed for word file '<word_file>'.
ANAGRAMS was unable to close the dictionary file named <word_file>. This error should never happen. If it does, it might have been caused by the disk which contains <word_file> being removed before ANAGRAMS was done reading words from the file.

Dictionary file '<word_file>' has bad header.
The dictionary file named <word_file> is corrupt. This error should never happen. If it does, it might be because you mistakenly used an old version of <word_file> with a newer version of ANAGRAMS.

Wrong number of words read from file '<word_file>'.
ANAGRAMS didn't read all the candidate words from <word_file> that it expected to find. This error should never happen. If it does, it's possible that either ANAGRAMS.EXE or <word_file> is corrupt.

(Word '<word>' not found; beginning with optimum word.)
This is more of a warning than an error. It's a warning that the word you specified to restart with (via the -B option) is not a candidate word, so ANAGRAMS will start with the first (longest) candidate word.

Sorry, too few candidate words found to generate any anagrams.
Based on its preliminary optimizations, ANAGRAMS didn't find enough candidate words to generate any anagrams. This can happen when the phrase you're anagrammizing is particularly short, or contains no vowels. For example:
ANAGRAMS XXXX
generates this error because no candidate words will be found which are contained in XXXX.

Sorry, the minimum word length is too restrictive to find any anagrams.
This happens when you use the -M option to restrict the candidate word length to too small a range. For example:

ANAGRAMS -m5 ABCDEFGHI

will generate this error because no combination of 5-letter (or longer) candidate words can generate a 9-letter anagram.

Make sure that the minimum candidate word length that you specify is either shorter than (or equal to) half the length of the phrase you're anagrammizing, or exactly as long as the phrase.

In other words, if you're anagrammizing a phrase that's 8 letters long, the minimum candidate word length must be less than or equal to 4 letters, or exactly 8 letters. It may NOT be between 5 and 7 letters long (inclusive).

Checksum error <n>. <d:\path\>ANAGRAMS.EXE is corrupt.
This error should never happen. If it does, it means that your copy of ANAGRAMS.EXE is corrupt. You should delete your copy of ANAGRAMS and reinstall it from the original archive. If, after doing so, you continue to get this error, then most likely either your archive contains a corrupt version of ANAGRAMS, or your PC contains a virus that is altering ANAGRAMS.EXE.

malloc() failed for <some>ARRAY.
ANAGRAMS couldn't allocate enough memory for temporary storage. Sometimes this can be fixed by freeing more memory.

readwords(): calloc() failed for WORDS[<n>].
ANAGRAMS was unable to allocate enough memory for the candidate words of length <n>. Sometimes this can be fixed by freeing more memory.

computerangetable(): malloc() failed." or "computerangetable(): malloc() failed for RANGETABLE[<n>].lens.
ANAGRAMS didn't have enough memory to perform preliminary optimization. This error is likely to happen when the phrase you're anagrammizing is particularly long. Sometimes this can be fixed by freeing more memory.

One way to free more memory is to remove unnecessary TSRs from RAM. If you still need more memory, try removing unnecessary device drivers from CONFIG.SYS, then rebooting. ANAGRAMS uses as much of your machine's base RAM as it finds available (but only within the first 640k), so if your machine has, say, 512k, installing more memory to bring it up to 640k should help.

If ANAGRAMS's memory errors persist, try anagrammizing a shorter phrase. Or, use the -M and/or -A options to restrict the minimum and/or maximum candidate word length. Or, if you have the registered version of ANAGRAMS, don't use the -I or -FI options. While none of these solutions is guaranteed to work, they might help.

ABOUT ANAGRAMS' DICTIONARY

Some of the words in ANAGRAMS's dictionary were provided by Public Brand Software. PBS's licensing agreement is as follows:

This collection of words has been provided by and is copyrighted by Public Brand Software, P.O. Box 51315, Indianapolis IN 46251. We reserve all rights to this collection. You, having bought it from Public Brand Software or received it from any other source are permitted, by license, to give this collection to anyone else as long as it is intact with this document file and that Public Brand Software is given credit for the compilation both in any documentation and in any advertising.

A further license to use, distribute, and sell this collection of words either intact or as a derivative work is granted if you send a copy of the finished product to Public Brand Software at the above address and if Public Brand Software is given credit for the compilation both in any documentation and in any advertising.

We will respect your copyrights of any finished product sent under the above conditions, but we do encourage you to put your finished product into the Public Domain or make it available for User Supported distribution.

In accordance with their licensing agreement, a registered version of ANAGRAMS has been sent to PBS.

REVISION HISTORY

04/14/1991: Version 1.2: First public release.

05/10/1991: Version 1.3: Added ability to change -E and -S options on the fly; added -FW and -FX options to shareware version; made shareware version work on phrases of unlimited length, but with maximum candidate word length of 6 letters; replaced -R option with -I and -FI in registered version.

05/13/1991: Version 1.4: Added recap which summarizes options selected; added -C option to registered version.

10/03/1991: Version 1.5: Added -PN, -PW, and -PP options for formatting output; added check in main anagrams() function to speed up processing when anagram being checked contains too many words.

06/19/1996: Version 1.5.2: Recompiled with Microsoft Visual C++ 1.5, created WWW page, converted documentation from WordPerfect to MS Word.

03/11/1997: Version 1.6: Added -r option to bypass use of range table, thus speeding up computation. (This option is useful when the phrase to be anagrammized is particularly long, in which case computing the range table takes a long time.)

WARRANTY

ANAGRAMS is provided "as is," and the author does not guarantee its performance. By using ANAGRAMS, you agree to not only bear all responsibilities for its actions, but also to hold the author of ANAGRAMS free of responsibilities for the performance of ANAGRAMS. In other words, the author is not responsible for what you do with ANAGRAMS, even if the program doesn't do what you expected.

REGISTERING ANAGRAMS

Although ANAGRAMS is a copyrighted program, you may give the SHAREWARE version to your friends (and enemies) provided you neither alter it in any way nor accept payment for it.

The REGISTERED version of ANAGRAMS may NOT be duplicated without the author's permission.

If you find ANAGRAMS useful and/or amusing, please send $5.00 to the author. Doing so will provide me with the incentive to continue to upgrade the program.

For a REGISTERED version of ANAGRAMS, please send $10.00. This will get you a version of ANAGRAMS with:

DONATIONS

I have spent quite a bit of time making ANAGRAMS easy to use, and donations of any amount are welcome. You can donate via Paypal by clicking on the "Donate" button below:

Whether you donate or not, feel free to drop me an email to let me know if you found ANAGRAMS useful or entertaining.


Return to
Kim Moser's Generic Home Page.
Copyright © 2014 by Kim Moser (email)
Last modified: Tue 07 September 2010 05:55:50