NUMBER PLACE PUZZLES HAVING TRIADS AND USE AS INTERMEDIATES TO MAKE NUMBER PLACE PUZZLES HAVING NONETS
Methods and computer software are provided for making number place puzzles having nonets or number place puzzles having triads. For number place puzzles having triads, no object appears more than once in each row and in each column, and each triad contains no more than one object from each of three distinct groups of objects. The software comprises instructions within each of multiple nested loops that limit access to embedded loops until all selected objects form a valid solution. Multiple solutions provide information for modifying the pre-assigned objects to obtain a single solution.
This application is related to U.S. patent application Ser. No. 12/615,199, filed on Nov. 9, 2009, and includes a computer program listing, submitted electronically as a text file named NPFAST.txt, which text file is incorporated by reference herein.
BACKGROUND OF THE INVENTION1. Field of the Invention
This application relates to number place puzzles and methods and computer software for creating number place puzzles.
2. Description of the Related Art
Prior application Ser. No. 12/615,199, entitled “METHOD AND SOFTWARE FOR MAKING NUMBER PLACE PUZZLES”, specifically describes making a conventional number place puzzle having nine lines, nine columns, and nine 3×3 regions known as “nonets”. The method and software use multiple loops and early bypass of loops to show all possible solutions to a partial puzzle in a reasonable amount of time. However, for partial puzzles having less than twenty pre-assigned numbers, the processing time can exceed eight hours. Optimization of the software and the puzzle is capable of reducing the processing time for each partial puzzle. For example, the software can be optimized to initially assign missing numbers in complete rows or columns and the partial puzzle can be modified by moving complete rows or columns of nonets to place the largest number of pre-assigned numbers in the rows or columns that are processed early in the multiple loops. Although the processing time is reduced, the time required for showing all solutions may still exceed several hours.
Improvement beyond optimization is needed to make number place puzzles having less than 20 starting numbers in a more reasonable period of time.
SUMMARY OF THE INVENTIONA new type of number place puzzle is provided. In a first embodiment, the number place puzzle comprises nine columns and nine rows defining eighty-one boxes, wherein each row or each column is divided into three triads, and sufficient pre-assigned objects, such as numerals, to form a single solution provided that no object appears more than once in each row and each column, and that each triad contains no more than one object from each of three distinct groups of objects.
Methods and computer software are also provided for making number place puzzles. In a second embodiment, a computer readable medium comprises one or more instructions for sequencing of lines of a partial or complete number place puzzle having triads, one or more instructions for printing a finding of one complete solution or more than one complete solution for the number place puzzle having triads, and a plurality of instructions at a plurality of locations for limiting access to the one or more instructions for printing prior to finding a valid solution to the number place puzzle having triads.
In a third embodiment, the computer readable medium comprises the instructions of the second embodiment and further comprises instructions to convert a number place puzzle having nonets to the number place puzzle having triads and instructions to print all solutions for the number place puzzle having nonets.
So that the manner in which the above-recited features of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the figures. It is contemplated that elements disclosed in one embodiment may be beneficially utilized on other embodiments without specific recitation.
DETAILED DESCRIPTIONUnlike number place puzzles having nonets, the objects in the number place puzzles have triads are not interchangeable. For example, each “9” in a number place puzzle having nonets can be swapped with each “1”, or replaced with “1” if the number place puzzle does not initially contain a “1”. A similar swap of numerals in a number place puzzle having triads may result in a different puzzle that may have multiple solutions or no solution unless “1” and “9” are also swapped within the three distinct groups of numerals. One reason for this difference is that every number place puzzle having nonets can be converted to a number place puzzle having triads in a manner whereby each object in the number place puzzle having triads no longer represents a single object in the number place puzzle having nonets. In effect, each object in the number place puzzle having nonets is represented by a row or column in the number place puzzle having triads and the numerals or symbols in the number place puzzle having triads represent rows or columns in the number place puzzles having nonets.
For example, the partial pre-assigned numerals in
An advantage of converting number place puzzles having nonets to number place puzzles having triads is that each row or column having triads in the number place puzzle having triads is interchangeable with each other row or column having triads, just like each object in the number place puzzle having nonets is interchangeable with each other object. Thus, each row in present
For example, Row D in current
The pre-assigned numerals in
The embodiment shown in
Pre-assigned numerals are entered 20 and converted 21 from nonets to sequenced triads or from non-sequenced triads to sequenced triads as described in more detail for
When the selected numeral for a variable is the same as a compared numeral, embedded loops are bypassed 24 for selection of another numeral for the same variable. If the selected numeral is different from all compared numeral, a numeral is selected for the next variable. After selection of two or more numerals in a triad, the comparison 25 includes confirming that no more than one numeral in the triad is within each group of numerals 1-3, numerals 4-6, and numerals 7-9. The selection of numerals for successive variables continues as long as each previously selected numeral satisfies the comparisons.
When no numeral satisfies the comparisons for a variable, processing returns to selection of another numeral for the prior variable, e.g. selection of A2 exits 26 to selection of another numeral for A1.
When all selected numerals for all variables satisfy the comparisons, the results are converted 27 back to nonets or non-sequenced triads and then printed 28. Thus, the comparison instructions within each loop limit access to successive loops that would print the results unless all comparisons are satisfied. The computer program ends 29 after the possible combinations of selected numerals for the variables have been compared, such that all possible solutions are printed absent limitations on the number of printed solutions.
When the computer program listing (NPFAST.txt) is executed with JUSTBASIC 1.01, up to 200 solutions (when NPMAX=200) are printed to a window and can be saved in a file or printed. Alternatively, after printing a selected number of solutions (which could be 0), further solutions could be indicated by printing only a finding of one complete solution or more than one complete solution. Printing of some solutions is preferred to assist in entry of additional pre-assigned numerals even if there are too many solutions to readily identify a single solution to the number place puzzle.
Data arrays are used in the current computer program to facilitate conversion of variables from nonets to sequenced triads and from non-sequenced triads to sequenced triads. Conversion from nonets to sequenced triads begins by calculating 32 the total number of appearances for each numeral in an initial data array, A(x,y), while initially assigning each numeral to a variable, LN(x), which represents a line in an intermediate data array, P(x,y). Then, the lines and associated total appearances are sequenced 34 by repeatedly swapping two selected lines that are not in the desired sequence wherein LN(1) is a row having the highest number of pre-assigned numerals and LN(9) is a row having the lowest number of pre-assigned numerals. The pre-assigned numerals are then transferred 35 from the initial data array to the appropriate numeral and appropriate position in the intermediate data array.
Although the value of each LN(x) may be repeatedly changed during the sequencing of lines, LN(x) is a one-dimensional array that keeps track of the position of each line in the intermediate data array. For example, if LN(1) equals 4 after sequencing is completed, then the fourth line in the intermediate data array after sequencing corresponds to the first line in the intermediate data array before sequencing occurred. Thus, LN(x) records important information needed to convert each solution back to the form of the initial data array.
When starting with non-sequenced triads in the initial data array, A(x,y), the total number of appearances for each numeral in each line of the initial data array is obtained by summing 33 the total number of appearances in each line and then sequencing 34 the lines and associated total appearance as described for conversion from nonets. The pre-assigned numerals are then transferred 36 from the initial data array to the appropriate line in the intermediate data array.
In the computer program listing, NPFAST.txt, selection of numerals for variables for a first results array, Q(x,y), begins with Row A of the intermediate data array, P(x,y), and progresses through rows B through I because the pre-assigned numerals in the intermediate array have already been moved toward the rows that are processed earliest. Although partial number place puzzles having substantially more than 20 pre-assigned numerals typically do not need the advantage of using triads, changing the sequence of triad rows or columns can reduce processing time from many hours to less than one minute for partial puzzles having less than 20 pre-assigned numerals.
After successful selection of numerals for all variables in the triads without duplicates or multiple numerals in any group of numerals, the computer program uses the data from the line variables, LN(x), to convert the first results array, Q(x,y), to a final results array, R(x,y). When the initial data array is based on nonets, each numeral in the first results array is converted 44 to the original nonet format using data from the line variables to reverse the prior sequencing of lines. When the initial data array is based on triads, the rows of numerals in the first results array are converted 45 to the original positions in the initial data array using data from the line variables to reverse the prior sequencing of lines.
If desired, the intermediate array, P(x,y), for a complete number place puzzle having nonets can be printed 45 after conversion of the nonets to triads without sequencing or further processing to form a new number place puzzle having triads. The new puzzle would not be a direct conversion to triads if line sequencing occurred but would have one solution and exchanging of two or more numerals.
After all solutions, if any, are counted or printed, the computer program ends. Alternatively, the program can end after determining whether the is no solution, one solution, or more than one solution. When multiple solutions are obtained, further pre-assignment of numerals may be assisted by comparing the multiple solutions. For example, the pre-assigned numerals shown in
While the foregoing is directed to embodiments of the invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof.
Claims
1. A computer readable medium having instructions for making a number place puzzle, comprising:
- one or more instructions for sequencing of lines of a partial or complete number place puzzle having triads;
- one or more instructions for printing a finding of one complete solution or more than one complete solution for the number place puzzle having triads; and
- a plurality of instructions at a plurality of locations for limiting access to the one or more instructions for printing until all assigned values form a valid solution to the number place puzzle having triads.
2. The computer readable medium of claim 1, further comprising one or more instructions for converting the partial or complete number place puzzle having nonets to the partial or complete number place puzzle having triads.
3. The computer readable medium of claim 2, further comprising instructions for printing one or more complete solutions for the number place puzzle having triads or one or more complete solutions for the number place puzzle having nonets.
4. The computer readable medium of claim 3, further comprising instructions for converting the one or more complete solutions for the number place puzzle having triads to the one or more complete solutions for the number place puzzle having nonets.
5. The computer readable medium of claim 4, wherein the plurality of instructions at a plurality of locations for limiting access comprise one or more instructions for bypassing embedded loops.
6. The computer readable medium of claim 5, wherein the one or more instructions for bypassing the embedded loops do not process objects that are selected in embedded loops.
7. The computer readable medium of claim 6, wherein no object appears more than once in each row and in each column, and each triad contains no more than one object from each of three distinct groups of objects.
8. The computer readable medium of claim 7, wherein the three distinct groups of objects are numerals 1-3, numerals 4-6, and numerals 7-9.
9. A method for making a number place puzzle, comprising:
- determining multiple solutions for pre-assigned objects using the computer readable medium of claim 1; and
- using the multiple solutions to modify the pre-assigned objects to obtain number place puzzle having a single solution.
10. A number place puzzle, comprising:
- nine columns and nine rows defining eighty-one boxes, wherein each row or each column is divided into three triads; and
- sufficient pre-assigned objects to form a single solution provided that no object appears more than once in each row and each column, and that each triad contains no more than one object from each of three distinct groups of objects.
11. The number place puzzle of claim 10, wherein the three distinct groups of objects are numerals 1-3, numerals 4-6, and numerals 7-9.
Type: Application
Filed: May 13, 2010
Publication Date: Nov 17, 2011
Inventor: Keith Martin Tackett (Houston, TX)
Application Number: 12/779,855
International Classification: A63F 9/24 (20060101);