huang's profilehuang---my little wordPhotosBlogListsMore Tools Help

Blog


    February 25

    Sudoku

    Sudoku is very popular in france, the MCM of this year is just about Sudoku , a friend of mine in chine took this concours , here is his solution ,wish he will win the price of this competition .The website is http://lintaoran.spaces.live.com/Blog/cns!68E3A07621E391DA!390.entry   And I will give some solutions of programming in the next paper, that's my anothor friend and me did. .
     
     
    1. What is Sudoku? 2. How to solve Sudoku puzzles using inference techniques? 3. How to solve Sudoku using a computer? 

     

    What is Sudoku?

     

    Sudoku is a logical puzzle of filling a 9 by 9 grid satisfying the following requirements:

    l         Only digits of 1~9 can be filled in each cell.

    l         Each digits can appear only once in each row, each column and each box. (see the following Figure)

    Box” in the above line refers to the nine three-by-three building blocks of the gird. Those who happen to be familiar with relevant mathematics will realize that such a so-called Sudoku puzzle is just a special form of Latin grid with the additional requirement of each box.

    Figure 1Figure 1

     

     

    How to solve Sudoku puzzle using inference techniques?

     

    There are numbers of inference techniques developed for a human in solving Sudoku puzzles. However, most of them are based on the mark-up techniques.

     Figure 2Figure 2 Illustration for mark-up

     

    Such technique is illustrated above. Observe the rows, columns and boxes, see what digits left can be filled and mark the cell with such numbers. For example, for the left-top cell, by observing the first row, digits of 8, 6 and 4 can be filled into this cell, and by observing the first column, digits of 9, 3 and 4 can not be filled, and finally by observing the left-top box, digits of 8, 9 and 5 can not be filled. So we mark the cell with digits left, that is, digits of 1, 2 and 7. Do the process one cell after another for all the cells remained blank, and get a grid as illustrated in Figure 2.

    To facilitate presentation, I will call the digits filled in the mark-up process as candidates, meaning possible digits for the cell.

    Getting this ready, we are at a position to use the following inference techniques:

    1.       Naked Single

    Observe possible candidates in each cell. If there is only one candidate, then the cell can be completed by filling the candidate. For example, candidate in row 4 column 8 and candidate in row 8 column 3.

    Figure 3Figure 3 Illustration of Naked Single

     

    2.       Hidden Single

    Observe possible candidates in cells of each row, column and box. If there is only one candidate bearing a particular digit which appears only once in its row, column or box, then this candidate can become the solution of the cell. For example, in the cell of row 7 column 9, candidate 4 appear only once in its row. So 4 is the solution of its cell.

    Figure 4Figure 4 Illustration of Hidden Single

     

    3.       Naked Pair

    If two double-candidate cells in the same row, column or box contain identical candidates, neither of these two digits can serve as a candidate for the other cells in the same row, column or box. For example, two cells of row 1 and row 2, column 7, have the only two identical candidates. Then all the 7’s in candidates in the top-right box and in the 7 column must be “disqualified”. The reason for this is: for the two double-candidate cells, the two candidates must serve for the final choices of the cells, one for each cell, though which one for which is not clear yet. But after the selection is made, other candidates in the same row, column or box are disqualified.

    Figure 5Figure 5 Illustration of Naked Pair

     

    4.       Hidden Pair

    If all the candidates of two digits appear only in two cells in the same zone, then all the other candidates in these two cells can be deleted. I will leave it as an exercise to the reader to think about why this process is reasonable.

    Figure 6Figure 6 Illustration of Hidden Pair

     

    And it seems that there are many more techniques in solving the puzzle (dozens of them).

    Here is a list of some of them (but I will not provide explanations and illustrations for them due to lack of familiarity).

    Locked Candidates

    A) If a certain digit of all the candidates in a box appears in the same row (column), then all the other candidates in the same row (column) can not be this certain digit..

    B) If a certain digit of all the candidates in a row (column) appears in the same box, then all the other candidates in the box can not be this certain digit..

    Naked Triple

    If three cells in the same zone contain only the subset of three digits, neither of these three digits can serve as a candidate for the other cells in the same zone.

    Naked Quad

    The same as Naked Triple except that the number of cells in question extends from three to four.

    Hidden Pair

    If all the candidates of two digits are only in two cells in the same zone, then all the other candidates in these two cells can be deleted.

    Hidden Triple

    If all the candidates of three digits only appear in three cells in the same zone, then all the other candidates in these cells can be deleted.

    Hidden Quad

    The same as Hidden Triple except that the number in question extends from three to four.

     

    You are encouraged to master some of them to solve puzzles yourself.

     

    How to solve Sudoku using computer?

     

    The computer can solve a given puzzle with considerable ease using searching method.

     

    Codes can be found in internet.

     

    In the end, the solution of the first puzzle is provided:

     

         2     8     1     3     6     5     7     4     9

         9     5     6     1     4     7     3     2     8

         7     3     4     8     9     2     6     1     5

         1     4     7     5     2     8     9     6     3

         5     2     9     7     3     6     4     8     1

         3     6     8     4     1     9     2     5     7

         6     1     5     2     7     3     8     9     4

         4     7     2     9     8     1     5     3     6

         8     9     3     6     5     4     1     7     2

     

    This is the end of the article.

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    威 花wrote:
    怎么突然就连入你的空间了……
     
    Feb. 25

    Trackbacks

    The trackback URL for this entry is:
    http://cid-8e04f0ceab9597cd.spaces.live.com/blog/cns!8E04F0CEAB9597CD!132.trak
    Weblogs that reference this entry
    • None