Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Sudoku Resolution Algorithm???

casalcasal Posts: 1Member
Hi,

I'm trying to figure out how to solve a sudoku puzzle using a backtracking algorithm (any other way would be ok as well).


Any hints? Any code you could share??

So far i've managed to develop a function able to detect when only one number can fit into one slot, applying this function a few times, and filling the square with the only right number i get to a point where i have no more slots available where only just 1 number would fit.

So now, i need to apply a backtracking algorithm, trying to fill out with one of the 2 or more numbers that would fit the gap, if the number is OK, i can go on filling the following ones, if i get to a point where no more "moves" can be done, i must go back and change the previously wrongly guessed number and try with the next available one.

Well, basically thats the backtracking technic.

How can i translate that easy-to-say-code into java (c++ ok too) code ??


:-)

I would appreciate if someone could help out.

I can share my code with others, could be helpful, just ask.

Comments

  • MarblexMarblex Posts: 1Member
    Let me see!
  • kulandaikulandai Posts: 1Member
    : Hi,
    :
    : I'm trying to figure out how to solve a sudoku puzzle using a backtracking algorithm (any other way would be ok as well).
    :
    :
    : Any hints? Any code you could share??
    :
    : So far i've managed to develop a function able to detect when only one number can fit into one slot, applying this function a few times, and filling the square with the only right number i get to a point where i have no more slots available where only just 1 number would fit.
    :
    : So now, i need to apply a backtracking algorithm, trying to fill out with one of the 2 or more numbers that would fit the gap, if the number is OK, i can go on filling the following ones, if i get to a point where no more "moves" can be done, i must go back and change the previously wrongly guessed number and try with the next available one.
    :
    : Well, basically thats the backtracking technic.
    :
    : How can i translate that easy-to-say-code into java (c++ ok too) code ??
    :
    :
    : :-)
    :
    : I would appreciate if someone could help out.
    :
    : I can share my code with others, could be helpful, just ask.
    :
    Check for solution: http://kulandai.blogspot.com/2006/10/sudoku-puzzle-java-source.html
Sign In or Register to comment.