Thread: Sudoku puzzle

  1. #1
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    138

    Post Sudoku puzzle

    Hi,

    I am somehow sick, so here is my code on trying to solve sudoku puzzle. The problem could be in "fill_cells" function. Then the code needs a lot of refactoring and testing too.
    Attached Files Attached Files

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,114
    1) Before posting, please read the "Forum Rules FAQ", especially the section on using "Code Tags"!!!

    2) Please post all your code in "Code Tags" or and other text files in "Quote Tags"!!! NOT as attachments, ESPECIALLY in a zip file!!! You want us to download a zip file without knowing, or trusting the contents???

    3) "The problem could be in ..." Please describe what the problem is. What output do you get? What output do you expect? Why do you think "The problem could be in "fill_cells" function."?

    Inquiring minds want to know!

  3. #3
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    138
    Quote Originally Posted by rstanley View Post
    1) Before posting, please read the "Forum Rules FAQ", especially the section on using "Code Tags"!!!
    I read it.


    2) Please post all your code in "Code Tags" or and other text files in "Quote Tags"!!! NOT as attachments, ESPECIALLY in a zip file!!! You want us to download a zip file without knowing, or trusting the contents???
    I do not understand your "or and" in the above quote, please explain. By the way I did not used "Code tags" for Main.c file because it was +1300 lines long.

    3) "The problem could be in ..." Please describe what the problem is. What output do you get? What output do you expect? Why do you think "The problem could be in "fill_cells" function."?

    Inquiring minds want to know!
    Well, basically "fill_cells" function sometimes moves forward, sometimes backward. Whenever there is no contradiction, it finds the next unbounded cell and bounds it to its first possible value. Whenever there is a contradiction, it should go backward to a state that has no contradiction and continue from there. I suspect there are cases that the whole possible values for a cell are used and none would lead to a solution; in this situation maybe a previous state should be tried. By the way I may have forgotten some things as I wrote the code some time ago.

  4. #4
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    138
    Why my reply to post #2 did not show up?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    That was the mods fault for not seeing that your post #3 was in the moderation queue
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,114
    Quote Originally Posted by ordak View Post
    I do not understand your "or and" in the above quote, please explain.
    Just a simple typo/"Brain glitch". That should have been obvious.

    It is standard in this forum to request posters place their code in code tags rather than attach it in a file.

    It is also standard in this forum to ask the poster to provide a small program that demonstrates the problem that we can compile and test, rather than a large source file, or multiple files.

    As for attaching a .zip file, imagine a malicious poster attaching a .zip file to a posting, containing some sort of Malware. We don't want to have to deal with such a possibility.

    Quote Originally Posted by ordak View Post
    By the way I may have forgotten some things as I wrote the code some time ago.
    Then how can we help? We are here to guide you, but we are not a free debugging service.

    I'm sorry you are unwilling to cooperate with us. I wish you the best of luck with your code, but I am unable to assist you any further.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sudoku in c
    By Melamust in forum C Programming
    Replies: 10
    Last Post: 05-23-2013, 09:51 AM
  2. Like Sudoku, but not.
    By quzah in forum Game Programming
    Replies: 4
    Last Post: 08-27-2011, 05:33 AM
  3. Sudoku Puzzle Solver?
    By Apocalypse in forum C Programming
    Replies: 7
    Last Post: 03-12-2006, 02:10 PM
  4. sudoku puzzle
    By Dr Spud in forum C Programming
    Replies: 4
    Last Post: 11-26-2005, 04:41 AM
  5. sudoku help
    By blue4life20 in forum C++ Programming
    Replies: 3
    Last Post: 11-18-2005, 03:50 PM

Tags for this Thread