PVN - The CrossWord Puzzle Generator Page

The CrossWord Puzzle Generator


Sample Puzzle Results



You may download and install the CrossWord Puzzle Generator by clicking on the link below. To run it, unzip the file to your computer, and click on CrossWords.exe. Then follow the Instructions on this page.

CrossWords.zip

Note: this program is stored and downloaded from a secure server location. Nevertheless, you, the user, assume all risks in downloading, installing, and running the program on your computer.

The CrossWord Puzzle Generator attempts to solve a crossword puzzle using words in a dictionary file for reference. You specify the puzzle size, generate the initial grid either automatically or manually, optionally enter letters and words in cells as seed values, and start the puzzle generation process. The CrossWord Puzzle Generator produces an initial solution, usually with 60% to 75% of puzzle words correct. You can update to find a better solution. You can make additional manual changes to the puzzle at any point.

Instructions (with Examples)


Click the various buttons in the steps below to observe how the CrossWord Puzzle Generator attempts to solve the sample puzzle grids at left).

Step 1: Specifying Puzzle Setup Parameters

Click the CrossWord Puzzle Generator icon to launch the application. The initial screen gives you the opportunity to define the puzzle layout and other settings.

  • Choose a puzzle grid size (number of squares going across and down). For example, choose 13 (easy) to set up a grid, or choose 21 (difficult) to set up a grid. In the first example, the CrossWord Puzzle Generator creates a "random" grid from a small library of grid layouts (Random Grid is the default grid layout type). You may select White Grid to start with a grid of all white squares. Or you can select Black Grid to start with all black squares (as in the second example). The next Step describes how you can modify the grid you select. (Click to return to the Setup image).
  • Choose how many times the CrossWord Puzzle Generator attempts to find a solution, using the two slider bar settings:
    • MAX Initial Attempts - This value is used to limit the number of attempts to find random word combinations that result in a good initial approximation at a puzzle solution. This Generate process is described in Step 3 below. The combination that results in the best puzzle score is saved. The default value for this setting is 10, but can range between 1 and 20.
    • MAX Revision Attempts - This value is used to limit the number of attempts to refine the initial puzzle solution. This Update process in described in Step 4 below. Each successful update results in a higher puzzle score. The default value for this setting is 50, but can range between 0 and 100.
  • Choose a Dictionary to look up puzzle words. The CrossWord Puzzle Generator provides a Standard dictionary of common English words and phrases (see Documentation, below). You may also specify a Custom Dictionary, which contains a list of words (and optional definitions) that you want the CrossWord Puzzle Generator to use. This is a handy way to allow words, phrases, etc, not commonly found in a Standard Dictionary, or to list words that pertain to a puzzle topic or theme.

    The checkboxes labeled Use Standard Dictionary and Use Custom Dictionary govern the Lookup Rules for word access:

    • Select Use Standard Dictionary and deselect Use Custom Dictionary to use the default Standard dictionary exclusively.
    • Deselect Use Standard Dictionary and select Use Custom Dictionary to use your Custom dictionary exclusively.
    • Select both Use Standard Dictionary and Use Custom Dictionary to use your Custom Dictionary as the first lookup, and the Standard Dictionary as the alternate. In this case the CrossWord Puzzle Generator attempts to fit a word from the Custom Dictionary first, and if one isn't found, the Standard Dictionary is accessed.

    If you select the Use Custom Dictionary checkbox, you are presented with a window from which you identify your Custom Dictionary.

    NOTE: A Custom Dictionary must conform to a specific format, as defined in the Rules section below.

    The Custom Dictionary file is displayed.

    Once you have made your selections, click the Go button to display the initial layout.

Step 2: Setting the Puzzle Layout

Once the initial grid layout is presented based on your Setup inputs, you can make some to the grid layout. You can toggle a square between white and black by clicking in the small grey area at the top of each square. You can enter letters that you want to remain fixed throughout the puzzle generation process. If you enter an entire word, that word stays fixed, whether the word is in the puzzle dictionary or not. For example, you may input a multi-word combination, or an acronym not recognized by the dictionary, to force the CrossWord Puzzle Generator to count your word as valid.

Once the initial layout has been defined, click the button to set the puzzle grid, with any fixed letters/words. The status area at the bottom of the puzzle displays the number of valid words (green box), the number of invalid words (red box), and the total number of words (blue box) in the puzzle. The Puzzle score is calculated by summing the lengths of every word in the puzzle. The maximum score attainable is displayed in the total score area (blue box).

Step 3: Generating An Initial Puzzle Solution

Now click the button. The CrossWord Puzzle Generator attempts to generate the best initial solution, based on your seed letters and dictionary words that fit the blank squares. On the first attempt, a solution is displayed. Each successive attempt (up to the MAX Initial Attempts Setup value) that results in a higher score updates the puzzle grid and score settings. At the end of the generation process, the highest score solution is displayed in the puzzle grid. The number of valid and invalid words is updated, and the current score (white box) is displayed.

In the Random Grid example at the top, 49 out of a total of 68 words are valid; the rest will need to be corrected either manually or by Updating the result, as explained in the next step. In the Black Grid example on the bottom, a complete solution was achieved on the first try (all 16 puzzle words are valid). In this example, words from the Custom Dictionary have been used (OCEANICRIDGE, MIDOCEANRIDGES); the Standard Dictionary has been used to complete the puzzle).

Step 4: Updating A Refined Puzzle Solution

In nearly all cases the Generation process results in a puzzle that contains invalid words. These words are displayed in red. The Update process attempts to revise any invalid words while retaining as many existing valid words as possible. Before each Update, you can make manual changes to puzzle words, as described in Step 5, or you can click the Clear button to clear all generated letters and start over (Step 3).

Click the Update button to start the Update. Calculations are performed in the background, so you will not see any puzzle updates until a higher score has been found. The checkerboard icon spinner to the right of the action buttons is highlighted during the search process. In the following example, the Random Grid puzzle at the top shows the result of the first update - 57 words are now valid. The Black Grid puzzle below shows the result of clicking the Clear button and Generating a completely different solution:

If the puzzle is not complete, as in the Random Grid example, continue to refine it by clicking the Update button, and waiting for the CrossWord Puzzle Generator to find (59 words are valid) and (61 words are valid) solutions.

Step 5: Making Manual Inputs

Most of the time, you will need to intervene to manually update invalid words to get to a solution. You can do this when an update has completed, or you can the update by clicking on the spinning checkerboard icon. You make manual inputs by overtyping letters (including black letters, red letters, or those squares colored green that contain fixed letters you have entered previously). Your letter entries are shown with a blue background.

After making manual changes to the puzzle, click the button again. The CrossWord Puzzle Generator updates the scores based on your changes, then continues to look for a more refined solution. In the top example, Across words 5, 9, 14, 16, and 17, along with Down words 10 and 11 were changed manually. (The valid word count is now 64).

Squares containing manually entered letters will remain fixed on successive updates unless overtyped with a blank. If you overtype an entire word, that word is treated as valid, whether it is in a Dictionary or not. In the bottom example, several manual changes are being made to the puzzle (squares with a blue background). Letter entries that you made on previous Updates are highlighted in green.

Step 6: Finalizing the Solution

As you get closer to a complete solution (a perfect score), the search algorithms take longer to find it. This may seem counter-intuitive, but is a result of the fact that small changes ripple through the puzzle, and usually create more invalid words, resulting in a lower score. The CrossWord Puzzle Generator discards these solutions, of course. Also, the dictionary search may only find a limited number of valid words (candidates) that meet the puzzle constraints, resulting in repetition in the puzzle iterations. The CrossWord Puzzle Generator uses some more drastic techniques to find a better solution, but in the end may run out of updates, and give up.

Sometimes you can figure out a simple fix to complete the puzzle; in the example, changing 22 Down CHEF to CALF and 23 Down ALGA to AREA results in a solution.

Interrupting the Generator

You can halt an on-going operation when the checkerboard icon is visible and spinning in the lower right corner of the screen. You can then make manual changes to the puzzle and click the Generate or Update button to restart the halted process.

Casting

You can use the Cast button to mark the valid words in the puzzle. Each marked square is treated as fixed by the CrossWord Puzzle Generator, and is displayed with a green background. A fixed square is not eligible for update unless you clear it by deleting the letter in the square. Casting is useful if you want to "lock in" the current puzzle state, so that the CrossWord Puzzle Generator works on only the squares that are not in valid words. Note that this may limit the possibility of a successful update, since there will be fewer word options to consider. Clicking the Cast button again turns off the previous Cast operation; the button acts as a toggle.

Clearing or Resetting a Puzzle

You can start over with the current puzzle parameters by clicking the Clear button, or regenerate an entirely new grid, by clicking the Reset button.

Documentation

The CrossWord Puzzle Generator can search for words in text files and Excel Spreadsheet files, provided the files conform to a specific format. I've used two source word lists in the CrossWord Puzzle Generator.

  • The Merriam-Webster 9th Collegiate Dictionary in the form of a publicly available list of 121,000 words that has been sorted according to word size. In addition to most common English words, the list contains some common phrases without intervening blanks (for example, lionsshare, earnedrunaverage). The format of the file is a single column of words sorted alphabetically by word length.
  • An Excel Spreadsheet of approximately 78,000 words. The format of the file is a list of words of a given length sorted alphabetically in each column: two-letter words in Column 1, three-letter words in Column 2, etc.

See the Technical Details page for a discussion of how the application was developed, along with a link to the software documentation, and a list of known issues.

Comments, New Bugs, etc.

Please direct all comments, bug findings, etc. to webmaster@pnautilus.net