backtracking
On Dec 6, 5:05 pm, Vishnutej mylavarapu.vishnu...@gmail.com wrote:
Can anyone tell me how to write a generic code for any board size of sudoku?
I mean we can write code for a normal 9x9 sudoku board..What about
16x16,25x25...??
--
You received this message because you are
My method does use backtracking, but only when the first two methods
fail. When the cell-based and group-based analysis do not produce any
results, it picks one cell and tries each possible value in that cell.
If that results in a contradiction, it backs out to that point and
tries something else.
When you say Simulate Sudoku, do you mean solve a given Sudoku
problem?
Here is an overview of how I did that:
I used an array of 81 integers to represent the board.
Then I built a 27x9 table of all the groups: 9 rows, 9 columns, and 9
squares.
Then I built a 81x3 map which relates each location
Hi Don,
How is your method better than backtracking?
i hope you are implementing a sudoku solver..
Let me know.
Regds.
On Tue, Oct 4, 2011 at 10:42 PM, Don dondod...@gmail.com wrote:
When you say Simulate Sudoku, do you mean solve a given Sudoku
problem?
Here is an overview of how I did
A little different but related problem is to determine whether a
Sudoku puzzle is easy, medium or hard to solve. Here, solveability is
guaranteed.
On Tue, Jun 7, 2011 at 2:31 PM, Navneet Gupta navneetn...@gmail.com wrote:
What could be a good strategy to check if the given Sudoku puzzle is
A data structure could be a mapping from each of the N*N cells to the
three regions it belongs to, and then for each region, a set of N bits
indicating which values it already contains. Then the validation
simply involves iterating over the cells. For each one, if any of the
three regions already
here in this part
if bitmap[bi] matrix[i][j]) 0x1) == 0x0)
(((bitmap[bj] matrix[i][j]) 0x1) == 0x0)
(((bitmap[bk] matrix[i][j])
0x1) == 0x0)) {
bitmap[bi] |= 1 matrix[i][j];
yes, you are right. bitmap will be filled in the process of solving
the grid. in verify routine, if the expression evaluates to false, it
mean an element is encountered which is already present in row, col
and 3x3 cube. this way you an tell that the solution is wrong.
hope that helps.
On Sun,
no... what i mean to say is you have filled the bitmap in the process
of solving the grid. The way you are filling the bitmap is - you are
taking values from the matrix and placing them in the bitmaps using bi
bj bk.
now in the verification you are checking the same matrix value against
the same
I think ur verification function is correct but it works only if user
is entering the values one by one. as soon as he enters a duplicate
value it will show a error. It will work for the case of ur solver as
ur code itself is generating the values.
But here in this verification problem u r given a
sorry, i made a mistake in explaining. when you are solving the gird,
you will have the matrix[][] array partially filled. the bitmap used
for solving the grid is different than the one being used for
verifying. in case of verifying, you will have a completely blank
bitmap, with not bits set. you
what i understood from your problem is, when the configuration is
given by user, it can be directly stored into matrix[][] array. that
will solve your problem in o(n^2), where n=9.
On Sun, May 29, 2011 at 5:50 PM, Dumanshu duman...@gmail.com wrote:
I think ur verification function is correct but
oh yeah... now it works. thanx a lot!
On May 29, 5:20 pm, Vishal Thanki vishaltha...@gmail.com wrote:
sorry, i made a mistake in explaining. when you are solving the gird,
you will have the matrix[][] array partially filled. the bitmap used
for solving the grid is different than the one being
No help from here on the difficulty calculation for Sudoku solving.
My solver works like most of them, I'd guess. From the starting
position:
1) Add any must have numbers, if any, to the set of known square
values.
2) Delete any can't be numbers from the list of possible numbers for
each
14 matches
Mail list logo