Sudoku: Difference between revisions

152 bytes removed ,  14 years ago
Line 615:
def permissible(matrix, i, j)
ok = [true,true,true,true,true,true,true,true,true] * 9
# Same as another in the column isn't permissible...
(0..8).each { |i2|
Line 636:
}
# Convert to the array format...
(01..89).eachselect { |i2| ret.push(i2 + 1) if ok[i2-1] }
ret = []
(0..8).each { |i2| ret.push(i2 + 1) if ok[i2] }
ret
end
def deep_copy_sudoku(matrix)
matrix.collect { |i| i.collect { |j| j } }
newmat = []
(0..8).each { |i|
newmat[i] = []
(0..8).each { |j|
newmat[i][j] = matrix[i][j]
}
}
newmat
end
Anonymous user