Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 9 / SEPTEMBER 1983 / PAGE 252

Crossword puzzle pattern generator. Robert E. Kennedy; Curtis N. Cooper.

Many people enjoy working the crossword puzzle in the daily newspaper. It is also fun and a good challenge to develop this type of word puzzle yourself. The actual construction of the puzzle pattern, however, can be very tedious and time-consuming.

The following program will speed up this part of the puzzle-making process. This will free your time for what we consider the most enjoyable and creative part of crossword puzzle development: you can spend your time searching for appropriate and interesting words and their definitions to use in a particular crossword puzzle pattern.

Here, we emphasize the construction of a 15 by 15 square crossword puzzle with the restriction that no less than 25% of the puzzle be composed of black squares. It should also be mentioned that the usual symmetry of crossword puzzle patterns is about the middle square. This means that the puzzle looks the same upside-down as rightside-up.

This program gives you two possible options. If you wish to construct a particular crossword puzzle pattern, you can do so. If, on the other hand, you wish to let the computer generate a pattern for you, this option is available.

Even though a puzzle pattern is randomly generated (at least with respect to the random number generator of a particular computer), some restrictions must be imposed to obtain a "good" crossword puzzle pattern. For example, we feel that such a pattern should have at least two black squares in each row and each column. In addition, an effort should be made to keep a group of white squares from being surrounded by black squares. However, in the final analysis, you are the judge of the utility of the crossword puzzle pattern that your computer generates. You might decide that a particular output could be improved by darkening some additional squares or by changing some black squares to white. Regardless of how you modify the puzzle pattern, we think that your enjoyment and understanding of crossword puzzle construction will be increased. The following program notes should help you understand the program and modify it for your particular needs. Program Notes

This program is written in North Star Basic and is offered in "menu form" with six subroutines which give some structure to the program.

Backwards slashes (line 1120) indicate the end of a statement and give the option of a line with multiple statements.

The device number for the printer in this particular setup is (line 1800). Your system setup may be different.

The North Star dialect of Basic has an EXIT statement. Here, it is used to exit from a FOR-NEXT loop before the loop is completed (lines 1440) and 1490).

The array A is used to store the 15 by 15 crossword puzzle pattern.

Since two-dimensional arrays are not available in this Basic, the entry in the Ith row and the Jth column is determined by the formula: A(15.sup.*.(I-1)+J). See, for example, line 1320.

The range of from 27 to 32 black squares determined by Subroutine I affords a range of from 54 to 64 black squares in the total crossword puzzle pattern. This range can be adjusted by modifying line 1210.

An "enhancement" is implemented by Subroutine IV in an effort to avoid having a group of white squares completely surrounded by black squares or borders. If this should occur, you will probably wish to darken any such white squares. Thus, every white square should be accessible to every other white square by horizontal and vertical paths.

In Subroutine III, the number of black squares in a pattern before enhancement has a range of 2 to 5 in each row and each column. Thi sis just a personal preference which can be changed by modifying lines 1440 and 1490.