Sudoku: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ### About | |
| 2 | 2 | ||
| 3 | 3 | There is very little to tell about this program. It is just an attempt to make a program which solves Sudoku puzzles. | |
| 4 | 4 | ||
| 5 | 5 | ### License | |
| 6 | 6 | ||
| 7 | 7 | See the sources. I just hope it is a useful demo. Useful as in you can learn something from it. | |
| 8 | 8 | ||
| 9 | 9 | ### Author | |
| 10 | 10 | ||
| 11 | 11 | Matthijs Willemstein\ | |
| 12 | 12 | Modifications by Bart | |
| 13 | 13 | ||
| 14 | 14 | ### Download | |
| 15 | 15 | ||
| 16 | 16 | The sources can be found at the Lazarus-CCR repository and can be obtained via svn: | |
| 17 | 17 | ||
| 18 | 18 | `svn co `[`https://svn.code.sf.net/p/lazarus-ccr/svn/applications/sudoku/`](https://svn.code.sf.net/p/lazarus-ccr/svn/applications/sudoku/)` local/path/to/sudoku` | |
| 19 | 19 | ||
| 20 | 20 | Alternatively you can view the sources through viewcv: | |
| 21 | 21 | ||
| 22 | 22 | <https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/applications/sudoku/> | |
| 23 | 23 | ||
| 24 | 24 | ### Usage | |
| 25 | 25 | ||
| 26 | 26 | If you run the program you will see a grid, and two buttons. If you press the "Edit" button, you are able to edit the grid and place the numbers in the grid according to your puzzle.\ | |
| 27 | 27 | If you press the "Clean" button, the grid will be cleared.\ | |
| 28 | 28 | When you are finished entering the digits press "Solve" and the grid will be filled with the solution. | |
| 29 | 29 | ||
| 30 | 30 | If the program is unable to completely solve the Sudoku, a ScracthPad form will pop up.\ | |
| 31 | 31 | This form shows for each cell what possible options are left.\ | |
| 32 | 32 | Solved cells will contain a single number, unsolved will have a range of possibilities, shown as commaseparated values enclosed in brackets, arranged in rows of three:\ | |
| 33 | 33 | ||
| 34 | 34 | |1 | | |
| 35 | 35 | | 4 | | |
| 36 | 36 | |7 9| | |
| 37 | 37 | ||
| 38 | 38 | In the above example, the numbers 1, 4, 7, and 9 are in the range of possibilities.\ | |
| 39 | - | ||
| 39 | + | ||
| 40 | 40 | You can edit the grid and copy the values back to the main form, then try to solve it again.\ | |
| 41 | 41 | (Note: only cells that contain a single digit will be copied back to the main form.) | |
| 42 | 42 | ||
| 43 | 43 | The program also has the option to load and save sudoku files.\ | |
| 44 | 44 | A sample sudoku file is incuded in the svn repository. The file format is a simple textfile, it is explained in the sources. | |
| 45 | 45 | ||
| 46 | 46 | #### Example for using the ScratchPad functionality | |
| 47 | 47 | ||
| 48 | 48 | The sample file "*unsolvable.sudoku*" (included in the repository) cannot be solved by the program.\ | |
| 49 | 49 | If you load it and then click Solve, the ScratchPad will pop up.\ | |
| 50 | 50 | Now click on the second cell in the bottom row.\ | |
| 51 | 51 | An editor will pop up.\ | |
| 52 | 52 | The editor has 9 checkboxes. In this example the checkboxes for "2" and "6" should be checked.\ | |
| 53 | 53 | You can toggle a checkbox's state by either (as usual) clicking ont it, or pressing the number ("1".."9") on the keyboard.\ | |
| 54 | 54 | Pressing the Enter key will write back the changes to the ScratchPad, pressing Escape will discard the pop-up form.\ | |
| 55 | - | ||
| 55 | + | ||
| 56 | 56 | \ | |
| 57 | 57 | In the example, if now uncheck "6" (leave the "2") and click Ok, then click the "Copy only values back..." button.\ | |
| 58 | 58 | The changes are propagated back to the main form.\ | |
| 59 | 59 | Again click the "Solve" button.\ | |
| 60 | 60 | The program now **will** be able to solve the Sudoku. | |
| 61 | 61 | ||
| 62 | 62 | ### Description | |
| 63 | 63 | ||
| 64 | 64 | The programs solves all Sudoku puzzles that can be solved by logic. It will not solve the puzzle where you need to guess for a solution. | |
| 65 | 65 | ||
| 66 | 66 | So it follows these rules (taken from [WebSudoku](http://www.websudoku.com/)): | |
| 67 | 67 | ||
| 68 | 68 | The rules of Sudoku are simple. Enter digits from 1 to 9 into the blank spaces. Every row must contain one of each digit. So must every column, as must every 3x3 square. Each Sudoku has a unique solution that can be reached logically without guessing. | |
| 69 | 69 | ||
| 70 | 70 | ### Related Sites | |
| 71 | 71 | ||
| 72 | 72 | [Sudoku Solver](http://sudokusolver.info/) Online Sudoku Solver Released Under The GNU public license. | |
| 73 | 73 | ||
| 74 | 74 | --- | |
| 75 | 75 | *From the Free Pascal wiki, page "Sudoku", as it stood on 2020-01-10 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 76 | 76 | Category: Example programs | |
| 77 | 77 | Category: Game Development |
