Simple algorithm for a sudoku solver java

Posted by user142050 on Programmers See other posts from Programmers or by user142050
Published on 2014-06-02T18:20:58Z Indexed on 2014/06/02 21:45 UTC
Read the original article Hit count: 253

Filed under:
|

just a quick note first, I originally asked this question on stack overflow but was refered here instead.

I've been stuck on this thing for a while, I just can't wrap my head around it. For a homework, I have to produce an algorithm for a sudoku solver that can check what number goes in a blank square in a row, in a column and in a block. It's a regular 9x9 sudoku and I'm assuming that the grid is already printed so I have to produce the part where it solves it.

I've read a ton of stuff on the subject I just get stuck expressing it.

I want the solver to do the following:

  • If the value is smaller than 9, increase it by 1
  • If the value is 9, set it to zero and go back 1
  • If the value is invalid, increase by 1

I've already read about backtracking and such but I'm in the early stage of the class so I'd like to keep it as simple as possible.

I'm more capable of writing in pseudo code but not so much with the algorithm itself and it's the algorithm that is needed for this exercise.

Thanks in advance for your help guys.

© Programmers or respective owner

Related posts about java

Related posts about algorithms