Method and software for making number place puzzles

A method and computer software are provided for making number place puzzles. Numbers and unknown are represented by variables that are assigned values such as in a plurality of nested loops. Instructions within each loop limit access to embedded loops until all assigned values form a valid solution. When some of the variables are pre-assigned values to create a number place puzzle, the output will be all valid solutions, if any. Multiple solutions provide information that assists in modifying the pre-assigned values to obtain a single solution.

This application includes a computer program listing, submitted electronically as a txt file named NP.txt, incorporated by reference herein.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This application relates to methods and computer software for creating games, such as creating puzzles.

2. Description of the Related Art

Number place puzzles are readily available in the market place although little or no information if available regarding how the puzzles were created. Software that assists with solving number place puzzles is also available although software that actually solves the puzzles is not widely distributed if available. Of course, software that can solve number place puzzles would be most valuable in creating number place puzzles.

The absence of software to create number place puzzles indicates a need for public disclosure of a suitable method and software for making number place puzzles to promote development of useful arts.

SUMMARY OF THE INVENTION

A method and computer software are provided for making number place puzzles. Numbers and unknowns are represented by variables that are assigned values such as by a plurality of nested loops. Instructions within each loop limit access to embedded loops until all assigned values form a valid solution. When some of the variables are pre-assigned all known values from a number place puzzle having only one solution, the output of the software would be the solution of the puzzle. However, when the variables are pre-assigned values while creating a number place puzzle, the software output will be all valid solutions, if any. Multiple solutions provide information that assists in modifying the pre-assigned values to obtain a single solution.

DETAILED DESCRIPTION

FIG. 1shows a number place puzzle having a 9×9 array of boxes typically used in classic Sudoku™ puzzles. The array forms 9 rows of 9 boxes labeled A through F and 9 columns of 9 boxes labeled 1 through 9. Pre-assigned values have been selected to illustrate making a number place puzzle. The values can be pre-assigned in any manner as long as the rules of the number place puzzle are obeyed, e.g. each row, column, and nonet (3×3 array) has no duplicate numbers for a classic Sudoku™ puzzle. The values can be pre-assigned before the program is executed as shown in the following Figures. Alternatively, the program can assist in selecting variables using graphics and dropdown windows.

Each box in the example puzzle ofFIG. 1is readily identified by the row and column, e.g. box A1is preset at 1. For use in the following description, each nonet inFIG. 1is labeled in the top center boxes N1, N2, N3, N4, N5, N6, N7, N8, and N9. The selection of pre-assigned values inFIG. 1was assisted by the computer program listing (NP.txt) filed with this application although selection can be done manually.

FIG. 2shows a diagram of a computer program for making number place puzzles according to an embodiment of the present invention. The source code for one such program written in BASIC is shown in the computer program listed. The BASIC program was written using JUSTBASIC 1.01 which is freeware available at www.justbasic.com. The attached BASIC program is not free for use in making number place programs if one or more claims below are granted. The computer program can be written in any program language and for any number place puzzle.

The embodiment shown inFIG. 2uses eighty-one (81) nested loops to assign each of the eighty-one (81) variables in the 9×9 number place puzzle ofFIG. 1as described in more detail forFIG. 4. Pre-assigned values are entered21and are processed by limiting selection of each variable to the corresponding pre-assigned value as described in more detail forFIG. 3. After a value is selected for each variable, such as selection of a value for A122, the value is compared23to relevant pre-assigned values and relevant values previously assigned to the variables by the nested loops. The value is not compared to variables that are to be assigned in any loops that are embedded in the loop that assigned the value because the embedded variables are not yet assigned a value for comparison. However, comparison of the value to embedded variables will occur when each embedded variable is subsequently assigned a value.

When the selected value for a variable is the same as a compared value, embedded loops are bypassed24for selection of another value for the same variable. If the selected value if different from all compared values, the value of the next variable is selected, such as selection of A225. The selection of successive variables continues as long as each new value satisfies the comparisons. When no value satisfies the comparisons for a variable, processing returns to selection of the prior variable, e.g. selection of A2exits26to selection of another value for A1.

When all selected variables satisfy the comparisons, the variables are printed27. Thus, the comparison instructions within each loop limit access to successive loops that would print the variables. The computer program ends28after the possible combinations of the variables have been tested, such that all possible solutions are printed absent limitation on the number of printed solutions. When the computer program listing (NP.txt) is executed with JUSTBASIC 1.01, up to 50 solutions (when NPMAX=50) are printed to a window and can be saved in a file or printed.

FIG. 3shows lines from the computer program listing which illustrate entry of pre-assigned values31, limitation of variables from A1to F9to any preset value32, and selection of variables from A1to F633using For/Next statements. In the computer program listing, selection of variables begins with N1ofFIG. 1and progresses through N6, N8, N2, N4, N9, N3, N7, and N5. The order of the nonets for selection of values was chosen to assist in writing the program by having a sequence wherein selected values in Nonet1inFIG. 2(N1) were not comparable to values in Nonet2(N6) or Nonet3(N8) and selected values in Nonet4(N2) were not comparable to values in Nonet5(N4) or Nonet6(N9). The same result would be achieved by similar sequences such as the reverse sequence N5, N7, N3, N9, N4, N2, N8, N6, and N1.

After successful selection of all variables without duplicates, the computer program listing prints a header34that keeps count of the solutions and prints all variables35. When a variable such as A1of F6is a duplicate to a pre-assigned value or a previously selected value, processing jumps to a label positioned before the corresponding Next statement36. After all combinations are processed, the final commands print “End”37to show that processing is completed unless the program terminated by setting NPMAX to a number less than the number of solutions.

FIG. 4shows additional lines from the computer program listing to illustrate how comparison of variables is completed for N1and N4inFIG. 1. For each variable, the selected value is compared to pre-assigned values and previously selected values in the same row41, pre-assigned values and previously selected values in the same column42, and then pre-assigned values and previously selected values for remaining boxes in the same nonet43. As shown inFIG. 4, subsequent comparisons45,45,46include more previously selected values and fewer pre-assigned values than the prior comparisons because the previously selected values would be identical to any pre-assigned value for the same variable.

When multiple solutions are obtained, further pre-assignment of values may be assisted by comparing the multiple solutions. For example, the pre-assigned values shown inFIG. 1have the four solutions shown inFIG. 5(which shows the result of executing the computer program listing NP.txt filed with this application). Comparing the solutions, only Solution1has a value of 2 at A651and a value of 6 at I452, thus pre-assignment of both values would result in a single solution for the corresponding puzzle61shown inFIG. 6. Similarly pre-assignment of both A653and I454in Solution2would result in a single solution. Assignment of I7in Solution1or assignment of I7in Solution4would also result in unique solutions although less symmetrical.

Puzzles having a single solution can be modified to be more symmetrical as shown inFIG. 6. The puzzle61created in the description above was modified by removing the pre-assigned values for F4and D6. Execution of the computer program listing (NP.txt) after modification resulted in 26 solutions and only the first solution resulted in the value 8 for E5. Thus, a more symmetrical puzzle62was obtained by pre-assigning the value 8 to E5. Whenever no solution remains, removal of one pre-assigned value can also result in a single solution or a different set of multiple solutions that can be examined for a single solution.