1 / 24

Sudoku Michael George Dept. of Physics Southwestern College

Sudoku Michael George Dept. of Physics Southwestern College. Outline. 1. Introduction 2. Creating a Sudoku pattern 3. Solving a Sudoku puzzle 4. Constructing a Sudoku puzzle 5. Conclusions. The Goal for This Talk. Our goal: to give some indication both of

ranger
Download Presentation

Sudoku Michael George Dept. of Physics Southwestern College

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SudokuMichael GeorgeDept. of PhysicsSouthwestern College

  2. Outline • 1. Introduction • 2. Creating a Sudoku pattern • 3. Solving a Sudoku puzzle • 4. Constructing a Sudoku puzzle • 5. Conclusions

  3. The Goal for This Talk • Our goal: to give some indication both of • 1. how to solve typical puzzles, and • 2. how to hand-craft puzzles of one’s own. • It is somewhat more difficult to create a Sudoku puzzle than to solve a puzzle for two reasons: • 1. One must prove that there is a unique solution for the puzzle, and • 2. It is advisable to estimate the level of difficulty of a puzzle. • To a large extent, the same techniques can be used both to solve or to create a puzzle.

  4. 1. Introduction • Sudoku is a popular puzzle game that is (in modest ways) similar to chess, in that a rather high attention to detail is required initially, while a certain strategic ability is required in much of the “middle game”. • The game takes several hours (or perhaps days) to master at an average level, and the difficulty of the games range from straightforward, to average, to games that seem to be actually beyond human capabilities to solve.

  5. The Nature of the Puzzles • 9x9 grid (81 cells) • Subdivided into 9 3x3 grids • Usually about 20 – 30 of the available cells (scattered throughout the grid) in the 9x9 grid have an initial placement of digits 1 – 9 • Goal: obtain 1, 2, 3, … 9 in each 3x3 grid of the subdivision and each row and each column, without altering the initial configuration of digits • There is just a unique solution for each puzzle.

  6. Why Is Sudoku So Popular? • It has some of the same attractions as chess, but is much easier to master and is a solitary game that exhibits (intrinsically) none of the psychological tension that one sees with chess (noting that it is precisely the emotional tension in chess that appeals to some). • It is fairly easy to mechanically produce (using computer programs) numerous puzzles over a fairly broad range of skill levels.

  7. 2. Creating a Sudoku Pattern • We refer to the pattern of digits 1 – 9, in each 3x3 subdivision, in each row, and in each column, as a Sudoku pattern. • In the course of creating a puzzle, one must at some point generate such a pattern as the unique solution of the puzzle. • How hard is it to generate a Sudoku pattern?

  8. A Simple Sudoku Pattern • There are simple patterns that are very easy to generate. • Here is an example: • Write the digits 1 – 9 in order along the top row. • In the second row, start with 9, and then 2 – 8 in order. • In the third row, start with 8, 9, and then 3 – 8 in order. • Continue in this fashion until all nine rows are filled with digits • The rows can be simply interchanged to yield a Sudoku pattern. • We leave it to you to work this out. • Notice that the 9x9 array in the example has each of the digits 1 – 9 in each row and 1 – 9 in each column. • Such a pattern is referred to as a latin square, and the Sudoku patterns themselves are special types of latin squares.

  9. More Complex Sudoku Patterns • The process of obtaining more complex Sudoku patterns can be much more involved. • In hand-crafting a puzzle, we will see one way to generate new and fairly complex Sudoku patterns.

  10. Counting Patterns • If we think of the 4x4 analogue to the Sudoku puzzle (with four 2x2 subdivisions), it is very straightforward to count 288 possible Sudoku-like patterns, i.e. 1,2,3,4 along each row, each row and in each subdivision. • It therefore comes as a bit of a shock when one finds that counting Sudoku patterns (on the 9x9 grid) is not nearly so easy, and that there are a total of 6,670,903,752,021,072,936,960 such patterns. • Of course, each such pattern is not necessarily very different from others as we can perform various symmetry operations (such as rotate the 9x9 grid by 90 degrees) that leaves the essential characteristics of a pattern invariant. • Taking into account such symmetries, there are only 5,472,730,538 distinct (nonequivalent) Sudoku patterns.

  11. Comment on Generating Sudoku Patterns • Considering the vast number of Sudoku patterns, one would think that it would be very straightforward to produce such a pattern. • In a way, this is plausible, but one needs to maintain perspective with the total number of possible patterns, using nine 1’s, nine 2’s, etc. • This can easily be seen to be very vast, and not too different from 981 • In comparing with such a number, we are able to recognize that finding a Sudoku pattern, except for certain very special cases, is like finding a particular planet in the ocean of the universe.

  12. 3. Solving a Sudoku Puzzle • We can consider the solution of a Sudoku puzzle in the decision tree for the puzzle. • From the root node of the tree, we have 60 or so grid spaces (the empty spaces of the 9x9 grid), and in each space we are allowed to place a digit 1 – 9. • This defines the nodes for the first decision, and from each of these nodes we can make other decisions, and so on, generating an entire graph: the decision tree, as a directed graph. • Each sequence of decisions (until all empty spaces are filled) defines a decision pathway. • There will be (for about 60 spaces) essentially about 960 decision pathways, which seems to suggest that solving a Sudoku puzzle is hopeless.

  13. Complexity Collapse • We refer to this expansive decision tree as a complexity explosion, viewing complexity algorithmically in terms of the number of steps that we must consider (based on our current level of knowledge) • Anytime one inserts new information, or obtains new knowledge, the complexity can decrease substantially • We refer to such a process as complexity collapse. • Notice that this does not relate closely to the actual number of steps in an algorithm, but only to our sheer ignorance.

  14. Decreasing the Complexity • There are various approaches that will decrease complexity substantially • In programming to solve a Sudoku puzzle, the rapidity with which configurations can be evaluated implies that a “brute force” approach can be substantially successful. • Human solvers can easily devise a rather pedestrian approach to solving the puzzles by considering consistency with a Sudoku pattern, when the next decision is made.

  15. Consistency Decisions • A common approach for setting up a Sudoku puzzle to make consistency decisions is to write down, for each empty cell in the grid, all of the numbers from one to nine in that cell that, if chosen for the next step, will lead to a pattern in which there are no repeating digits in any of the 3x3 subdivisions, nor any in each row, nor any in each column. • Such a strategy, i.e. to select one of such choices, after all have been written down, cuts down on the decision tree (we say “reduces”) significantly, but also leaves, usually, an overwhelmingly immense number of decision pathways.

  16. Other Strategies • An experienced Sudoku player has other strategies, besides the simple one we have introduced. • Even so, all decisions are not usually reduced to the those decision pathways that will lead to the goal Sudoku pattern, and, generally speaking, assuming that one does not make a mistake and that special pathway is not eliminated from consideration, there will remain numerous possible pathways.

  17. Frustrated Patterns • Even when one does not make a mistake and accidentally eliminate the unique goal Sudoku pattern (which may often be reached by many different pathways), one frequently (especially with the difficult puzzles) must consider decisions intentionally (on a provisional basis) which might eliminate these pathways. • If these pathways are eliminated, and this is recognized at any stage in decisions, we say that a frustrated pattern has been reached.

  18. Finding the Sudoku Pattern • One will often (unintentionally or intentionally) need to consider pathways that will lead to frustration, and somewhat clever considerations, beyond what we have discussed. • Since this is the case, by examining the various devices that led to a complexity collapse to the solution, an expert player is frequently able to assess the difficulty level of a puzzle (at least for a human player). • Of course, even an expert may miss some very clever approach that will lead to the final complexity collapse rather easily, so that the complexity levels (surely relative when considering different categories of solvers such as humans and computers), is also to a certain extent relative among human solvers.

  19. 4. Constructing a Sudoku Puzzle • The construction of a Sudoku puzzle by hand requires some awareness of approaches to solving the puzzle. • We can therefore appreciate the difficulty involved in constructing the first Sudoku puzzles (which lore has it was the work of an American architect in the 1970s).

  20. Some Comments • Showing all of the details of constructing a puzzle is perhaps not as constructive as outlining the approach. • We have written a paper that shows numerous details, both for solving a Sudoku puzzle in a more sophisticated manner than we have discussed, and for creating a puzzle. • This paper will be freely available among my Ising games (Sudoku is “nearly” an Ising game) papers at the MSE Teaching Resources website.

  21. Initial Considerations • For the game I construct in my paper, I used a distribution (rather evenly among each of the 3x3 subdivisions) of 28 digits for the initial configuration (all consistent with a Sudoku pattern, of course). • This is close to a major complexity collapse area (somewhat more than simply subjective) in developing Sudoku games. • One might say that there is a major “phase transition” that one encounters, in going from initial distributions with few digits to large numbers of digits, where (close to the transition point) the actual complexity of the game is so reduced that there will be relatively few (but in human terms, still possibly many) final Sudoku patterns possible.

  22. The Challenge • The challenge to constructing the puzzle is to reduce the number of possible Sudoku patterns that can be reached by decision pathways from the initial configuration. • Setting up the initial configuration like typical Sudoku games implies that one can do this by merely using the standard human methods for solving the games, being very careful never to neglect pathways that will lead to final Sudoku patterns.

  23. What We Find • If one selects an initial configuration in the “safe” region (it would be interesting to investigate this in more depth), one finds that the resulting final patterns leaves one with choices that need to be made to achieve a unique pattern. • The final positions result in “molecular” patterns, that give one certain options. • The molecular patterns in themselves are interesting to consider, as they demonstrate how a “complexity explosion” can be achieved, and how “complexity collapse” leads to a “molecular configuration”. • We do not discuss this in our paper, as this would be a major distraction from the focus of the paper.

  24. 5. Conclusions • In conclusion, it is surprisingly straightforward to construct a Sudoku puzzle of average difficulty. • For the human player, one can, fortunately, apply mostly the same methods to create a game as to solve one, and reducing to a unique final Sudoku pattern does not prove to be difficult. • There are a number of interesting complexity issues, which are worth exploring in considering the evolution of a Sudoku game, but this is a whole subject in itself, beyond Sudoku.

More Related