This is the traditional method to solve the Sudoku.
Checking the number in every two different position can decide the number in other box which does not have the number yet Parameters: groups: [((x,0)|(0,y), [(x1,y1),(x2,y2)...]),...]
Checking the every number in every two different position can descide the number in other box which does not have the number yet
Checking every number with only one assigned numer or a group number to decide the number in other box which does not have the number yet
Checking the position which only has one possible value
Check if there is only one number left in the same x, y or box
Checking the same positions is only one possible for the number
Check two emulate result records from a number only have two possible position in a box, line; or a postion only have two possible numbers, if they have same record or not!
emulate the pos to be set v, then start to use some basic methods to try to solve it will stop when and return:: 1: one of the targets have been set the checkval 2: isDone -1: error is True 0: all basic methods have been tested, and can’t solve and the result matrix
Getting a box’s all position method: a: all, s: all assigned, u: all un-assigned num: 0(1-9), if method=”u”, if the num is 1-9, it will only take the positions that is possible be filled by the num diff: the posithon in diff must be excluded
Get all other possition of line from x = idx than those in diff method: a: all, s:has assigned, u:not assigned num: if method is u and set the number to 1-9, will get all possible pos which are possible to be assigned the num
Get all other possition of line from y = idx than those in diff method: a: all, s:has assigned, u:not assigned num: if method is u and set the number to 1-9, will get all possible pos which are possible to be assigned the num
get the postions in a box(b) which can not be seen in position p1 and p2 which are in the same box and those positions are not filled p1, p2 must be in different x and y, p1, p2 sometime as the form (x,0)|(0,y)
Get numbers Chains from a Pos list return: [([num1, num2,...], [pos1, pos2,...]),...]
get Boxes Position(i, j) list from two positions which will effect these boxes
get Boxes Position(i, j) list by one positions which will effect these boxes
get Boxes Position(i, j) list by one group which will effect these boxes
get Boxes Position(i, j) list from one position and one group which will effect these boxes but only get same x or same y box grp: (x,0)|((0,y)
get Boxes Position(i, j) list by two directed group which will effect these boxes p1, p2: any position of those groups to make sure the whichbox d1, d2: format like (x,0) or (0, y) to say the group’s direction
Get the number Groups which are formed natually in a box because the remain possible positions can at the same line
Get Indirect Number Group in a box by possible positions of a number judge by if all ther possiblePos has a same direction, means that those have same x or y if so, it will return (x, 0) or (0, y), otherwise will return (0, 0)
get the other postions in a box which there is a postion of x, y
Reduce Method #1: Reduce by the group number in a box
Reduce numbers of positions of pos which other than positions of chainpos
Reduce v from some postions by emulate result m1
Reduce By Line chain direction: x: the same x postions, y: the same y positions
Reduce by two postions which in the same box or same line, and have a common possible number which only be possible in these two different positions we assume the position set the first, then test the second number where the first number in of the same box, samy x, and same y if we can get the number in the other position, we can make sure that in the other positions will not have the first number because both of two possible number have been tested. return: reduces, sets
Reduce by two postions which in the same line, and have a common possible number which only be possible in these two different positions we assume the position set the first, then test the second number where the first number in of the same box, samy x, and same y if we can get the number in the other position, we can make sure that in the other positions will not have the first number because both of two possible number have been tested. return: reduces, sets
Reduce by a postion’s two possible number we assume the position set the first, then test the second number where the first number in of the same box, samy x, and same y if we can get the number in the other position, we can make sure that in the other positions will not have the first number because both of two possible number have been tested. return: reduces, sets
Get unassign position’s possible number list, format is [(p1,[n1,n2,...]),(p2,[n1, n2,...]),...] and Sorted By the possible numbers possibles: 0 for all, >=2, mean get only the possible numbers for it
init the matrix return:: m: matrix map n: the number’s position, the first element save the numbers p: the possible numbers in every position
Check if the value v is possible at pos(x, y)
Check the same box if the value v is possible at pos(x, y)
Check the same x if the value v is possible at pos(x, y)
Check the same y if the value v is possible at pos(x, y) if group number has passed, should check box group number
Reading the Matrix form a define file, the format must be as x,y,v Save the file by the Unix text format