Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 399879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:53:22+00:00 2026-05-12T16:53:22+00:00

I am trying to create my own normal 9×9 sudoku puzzle . I divided

  • 0

I am trying to create my own normal 9×9 sudoku puzzle.

I divided the problem into two parts –

  1. creating a fully filled sudoku, and
  2. removing unnecessary numbers from
    the grid

Right now, I am stuck with the first part.


This is the algorithm I use in brief:

a) first of all I choose a number (say 1), generate a random cell position, and place it there if

  • the cell is not already occupied, and
  • if the row does not already have the number, and
  • if the column does not already have the number, and
  • if the 3×3 box does not already have the number

b) now I check for a situation in which in a row, or a column or a box, only one place is empty and I fill that

c) I check that if there is a number that in not present in a box but is present in the boxes in the same row and the same column (i am talking about 3×3 boxes here), the number’s place is fixed and I fill it.

d) I repeat the above steps until every number appears nine times on the grid.


The problem I am facing is that, more than often I am getting an intermediate situation like this:

 0  1  0 | 0  0  3 | 0[4/2]0 
 0 [2] 0 | 0 [4] 1 | 3  0  0 
 3  0 [4]|[2] 0  0 | 0  0  1 
---------+---------+---------
 2  0  3 | 0  5  4 | 0  1  0 
 0  0  1 | 3  0  2 |[4] 0  0 
 0  4  0 | 0  1  0 |[2] 3  0 
---------+---------+---------
 1  0  2 | 0  3  0 | 0  0 [4] 
 4  3  0 | 1  0  0 | 0  0 [2] 
 5  0  0 | 4  2  0 | 1  0  3

See the place with [4/2] written? that is the place of 2 as well as 4 because of the boxes marked [].

What can I do to avoid getting in this situation (because this situation is a deadlock – I cannot move further)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:53:22+00:00Added an answer on May 12, 2026 at 4:53 pm

    There’s another way to generate sudoku puzzles: Start with a known good grid – any one will do – then randomly ‘shuffle’ it by applying operations that don’t destroy the invariants. Valid operations include:

    • Swapping rows within a block
    • Swapping columns within a block
    • Swapping entire rows of blocks (eg, first 3, middle 3, last 3 rows)
    • Swapping entire columns of blocks
    • Swapping all instances of one number with another
    • Reflecting the board
    • Rotating the board

    With these operations, you can generate a very large range of possible boards. You need to be careful about how you apply the operations, however – much like the naive shuffle, it’s easy to write an algorithm that makes some boards more likely than others. A technique similar to the Knuth shuffle may help here.

    Edit: It has been pointed out in the comments that these operations alone aren’t sufficient to create every possible grid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create my own Native win32 C++ Checkbox that can have
I am trying to create my own lightbox for images on my website. Yes,
I'm trying to create my own Magento shipping module in Magento 1.6. Since I
I am trying to create my own torrent tracker but dont know how to
I'm trying to create my own plugin. But I'm having trouble getting things right.
I'm trying to create my own templated List class as a practice excercise. I
I'm trying to create my own template for a List class as a learning
I am trying to create my own next and previous arrows in a fancybox
I am trying to create my own plist file to be used in my
I am trying to create my own little MVC system, its working very well,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.