Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

I want algorithm for Sudoku in JAVA?

I want to make a Sudoku Solver application in Core Java (Console Application). Please give me a suitable algorithm for that. Thanks for answering my question.

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    So you want somone to code for you? to enter into your own code. "that isnt going to teach you anything......"

    But if you must cheat, how about just going to

    http://en.wikipedia.org/wiki/Algorithmics_of_sudok...

    Before you ask the expert's, why not google questions first mate.

  • feagle
    Lv 4
    5 years ago

    Sudoku Algorithm Java

  • Anonymous
    5 years ago

    I have a sudoku solver. At its heart is a structure that holds a partially filled in puzzle. Each cell holds nine Booleans representing the numbers that can go in that cell. At the start I fill in the known cells, that sets all the Booleans in that cell to false apart from the known value. Whenever I set a cell to only have one true Boolean I then set the corresponding digit's Booleans false in all the related cells, that is all the cells in the same block, column and row. Once I have filled in the known cells I see whether I've got a finished puzzle. Most often I haven't. If I do not have a completed puzzle I find a cell that has several possible values. I repeatedly copy the puzzle and set the cell to have just one of its possible values. I then see if that is a completed puzzle, if not I rinse and repeat recursively. As I recurse sometimes I end up with a solution, or rather once, and when I find it I'm done. Often when I recurse I end up with a non-solution, at which point I backtrack.

  • 1 decade ago

    Well if you just want the general scheme, I think that all you would need to do is treat the entire thing like an array. For each space, calculate the possible numbers that could fill that space. This would just involve calling maybe three methods, one that checks row, another to check column, and a last one to check the box. Then enter the first val possible. Keep going till you hit a block, where you can't fill anything in. Then recursively step back and try the next possible value. It'll be really hard tho :) good luck.

Still have questions? Get your answers by asking now.