[math-fun] Sudoku difficulty "levels"
I programmed my current "level 1" solving ability (in Lisp, of course!), so that I could test it against a number of Sudoku puzzles. The idea is to come up with a uniform definition of level of difficulty. I represent the entire board as a single (positive) integer, so that I can use the Lisp logical functions on integers (as bit strings). This also makes a later extension to backtracking completely trivial, as the entire state is a single integer quantity. The square at (i,j) is the block of 9 bits at position 9*(9*i+j) in the integer. The 9 bits for each square represents the possibilities for each of the 9 digits in that square. When I print out the number in Sudoku form, the digit in square (i,j) prints only if it is a singleton set. If an empty set ever appears in any square, then the entire Sudoku is inconsistent. Notice that as the Sudoku is being solved, the number of bits goes monotonically down -- a completely empty Sudoku is the integer 2^(9*9*9)-1, which has the most number of bits. Notice that simply entering the given digits into the system in this form sometimes produces additional digits (due to only one digit being allowed in that particular square). When I first saw this, I thought it was a bug, because more digits were being printed out than were typed in, but this is one advantage of this representation. To solve the Sudoku, I check for "forcing moves" in rows, columns and blocks. A forcing move for a digit d in a row i is the fact that only one bit in the digit position for d shows up in the entire row. This means that the location of that single bit can be forced to be digit d. Forcing digit d into this position causes the d-bits in the row, column & block to be removed (of course, the row bits are already zero). A forcing move for row i considers all digits for that row. Ditto for columns and 3x3 blocks. We now keep iterating on rows, columns & blocks until no change is found. I've found that these simple forcing moves are sufficient to solve almost every Sudoku in the book "Mensa Sudoku", but only the "Gentle" and most "Moderate" Sudoku's in the LATimes. (So much for "Mensa" class intelligence!) This level can't solve any of the Sudoku's in "Sodoku Genius" by Tom Sheldon. I would claim that these simple forcing moves, which consider only a single row, column or block at a time, is a reasonable definition of "level 1" Sudoku. I think virtually everyone would consider these moves to be of the "non-lookahead" variety.
Henry Baker wrote:
I programmed my current "level 1" solving ability (in Lisp, of course!), so that I could test it against a number of Sudoku puzzles. The idea is to come up with a uniform definition of level of difficulty.
Your definition is indeed the agreed-upon standard for "easy" sudoku. Most people phrase it as allowing two different rules: 1) If a certain square S can only hold one digit d, put d in S. 2) If a certain digit d can only show up in one square S of some 9-block region, put d in S. Your representation gives you rule 1 "for free" -- well, once you enforce the definitional "rule 0", that putting d in S means you eliminate d as a choice for all other squares in all regions containing S. I should point out that what Wayne Gould did to start the sudoku craze was precisely write a program that solved them according to a bunch of well-defined rules with a uniform definition of difficulty (and generated random ones to feed into the solver). The early sudoku analysis spent time trying to figure out precisely which solving rules Gould's program used, in which order and with which difficulty tags, based on the ratings that ran with his puzzles in major papers around the world. But the creation market soon became glutted with upstarts entirely lacking in standards, hence the situation as it is today. --Michael Kleber -- It is very dark and after 2000. If you continue you are likely to be eaten by a bleen.
participants (2)
-
Henry Baker -
Michael Kleber