0

If have 9 lines that are 9 line just like sudoku, but they are instead like

530070000
600195000
098000060
800060003
400803001
700020006
060000280
000419005
000080079

Which transforms into

534678912
672195348
198342567
859761423
426853791
713924856
961537284
287419635
345286179

I thought it would be simpler, but then once putting it into my program it left huge gaps.

I thought I could simply go down each column and put the smallest number in the open space on the first column if it wasn't in the way of any of the other numbers, but as i progressed I realized that I had to go back and delete certain numbers in order to make it better.

Keep in mind the only conditions that apply are that the numbers in the same column cannot be the same and the numbers in the same row cannot be the same, but there are no boxes.

Any advice?

keyerer
  • 73
  • 1
  • 2
  • 10

2 Answers2

0

What you want to do is a recursive backtracking.

Sudoku backtracking algorithm

http://en.wikipedia.org/wiki/Sudoku_algorithms#Backtracking

Community
  • 1
  • 1
tomahh
  • 13,441
  • 3
  • 49
  • 70
0

First determine all possible numbers for each cell given only the cells filled in as of this turn. If any cell has only one possible number, select it and reevaluate affected cells (in the same row, column, and 3x3 square).

When you can no longer find a cell with only one possibility, then employ recursive backtracking.

Lee Louviere
  • 5,162
  • 30
  • 54