TechECE

Ramblings of a directionless group...

Contributors
Our Personal Blogs
Subscribe to our feed

Enter your email address:

Delivered by FeedBurner

Monday, April 17, 2006
Idea required
I am planning to write sudoku program. Though i haven't started it. i am quite sure that the user input and checks wud b quite easy to implement. But, I have no idea about the start up data - initial number fillings. Like any sudoku program, i wud like to have three levels; hard, medium and easy. Worst case is i cud hardcore the startup data with ... say 50 samples in each level. But this is the last resort. Is there any algo or logic by which i can generate a startup data.
posted by Ramkumar @ 12:40 AM  
12 Comments:
  • At 2:08 AM, Blogger Sunil said…

    Do you mean program to solve sudoku or generate sudoku puzzles? Balaji had written one that would solve!

     
  • At 2:40 AM, Blogger Ramkumar said…

    not solve da. i am just want to write game program da. so, user will play not the program itself. i want idea for startup numbers.

     
  • At 2:58 AM, Blogger Ramkumar said…

    i want to reiterate that i am not writing a program to solve sudoku puzzle but rather for the user to play.
    he cud move to a position and give a number, i have to validate thats all.
    But, for the startup i have to give some number isn't it? i don't that part.

     
  • At 3:41 AM, Blogger Iday said…

    i wud suggest that u generate the grid (the 9X9 array inside which the sudoku is played) as such and display random locations from the grid. the level of difficulty is now an issue with how u construct the grid.

     
  • At 3:52 AM, Blogger Sunil said…

    You can't fill up numbers at random da. What if you end up with a sudoku that has more than one solution? The question is "How to fill in numbers in the sudoku grid so that you have a valid solution?"

    Correct me if i'm wrong, the level of difficulty is dictated by the number of numbers (:D) present in the grid. Isn't it?

    Wwe can do it programaically, Ram. No need to use hardcoded values.

     
  • At 3:55 AM, Blogger Iday said…

    This comment has been removed by a blog administrator.

     
  • At 4:03 AM, Blogger Ramkumar said…

    no da. providing the preliminary numbers requires understanding of sudoku which i lack. U asked the question for which i don't have answer.
    Difficulty is not only proportional to numbers given alone but the location also. isn't it? or am i wrong?

     
  • At 9:58 PM, Blogger Sunil said…

    Interesting puzzle as it turns out to be! We have to find out the basic criteria to be met to create a solvable sudoku grid. These are the obvious factors influencing te solvability:
    1. Number of numbers filled
    2. Position of the filled numbers
    3. Reptition in the filled numbers (i.e. if there are 20 numbers filled it can have the number 6 eight times which makes solving easier than having 6 just one time. anyway I'm not sure about this.)

    I thought this way. When we solve the puzzle, when can we decide a number should come in a particular box in the grid? When we are sure that all the other eight numbers can't fill that box. Let us call this a eight NOT conditions to be met. So number of NOT conditions to be met in a fully filled grid is,
    81*8

    Now take an empty grid. Just add one number in it. It will generate 8 NOT conditions in the row, column and the square in which it is added. So a single number would generate 8*3 NOT conditions.

    So number of numbers to be present so that all 81 can be filled without ambiguity is,

    81*8 / 24 = 27

    Am I missing something in finding this out? I checked few random sudokus and all had over 27 numbers filled.

    But this is not a sufficient condition to be met. For example if I fill first three horizontally successive squares with the 27 numbers, still we the remaining boxes can be filled in more than one way to get a solution. Which means ambiguity is not getting removed by the number of terms alone.

    The influence of position of numbers seems to be tricky. I'm still trying to find out a condition to be met.

     
  • At 10:14 PM, Blogger Sunil said…

    I found a sudoku of "Evil" difficulty level. There were only 25 numbers :)))))))))))))

     
  • At 1:42 AM, Blogger Sunil said…

    I think attempting to write a logic to solve sudoku could help us find the minimum criteria to be met for creating a puzzle.

    We can predict a number's occurnce in a box by two ways.

    Method 1: No other number can occupy the box. (8 NOT comditions)

    Method 2: That particular number won't go into any other box in the row or column or square.

    Are these mutually exclusive?
    Balaji, what was the logic you used?

     
  • At 1:44 AM, Blogger Sunil said…

    One clarification: by mutualy exclusive I meant, can we use any one method to solve the entire grid or do we need to use both of these? Are these methods different or just a converse statement?

     
  • At 2:21 AM, Blogger Sunil said…

    Are you contradicting yourself?
    In your program you essentially use the method I alone to solve the puzzle isn't it? Or did I understand it wrong?

     
Post a Comment
<< Home
 
Previous Post
Blogroll
Archives
Personal Blogs by Indian Bloggers