Home > blog > Sudoku Check Algorithm

Sudoku Check Algorithm

sudoku check algorithm
I can create a Sudoku solver in Java, and I need help! Can anyone here?

I'll talk about this: to what I did: The program creates a list (1-9), then check my ([][]); int table for each number in the column, check numbers, and if no one on my list of 1-9, change that number to 0. Does the same for columns. If 8 0, the remaining number (Q> 0) will be launched this table. Do I have to do: the numbers every third need to be included in this as well. Is there an algorithm or perhaps a new way to determine what is the third in the table? or I have to use if / then / Switch statements? or maybe I'm going about it all wrong? I'm a hobbyist programmer, this is really the first comprehensive solo full as I try, then comments are greatly appreciated! thanks.

Sudoku solver started a bit like a mental exercise, but I have not had a chance to finish it. I created a regular 2D 9×9 array of cells and each cell contains the current number is put in place (if applicable) and a bit mask indicating all the numbers that can be at this location (9 bits per cell, one for each possible number). Then create multiple index sets ("Games") in this table, a set of nine indicators for each line, one for each column and each 3×3 sub-grid. The first rule is that if a cell is set to a number and another number in this line of cells, columns or subnet can be configured for this problem. So when you put a cell in a given number of everything in all sets that contain this cell, then go all other cells of these complexes and remove the mask number. Second rule is that if the mask for all cells at any time, contains only a bit is set (ie, one number can go here), then I set the rule of the cells with the number # 1 and apply to all cells that share a set with this cell. Rule 3 is that, if a bit for a given number is defined in a single cell in a given set when the cell must contain that number. This is analogous to finding a column that have excluded the number 3 (for example) of all cells except one … this cell should be a 3. Thereafter, the rules are somewhat more complex. Rule 2 can be extended to a more generic X-cell involvement is whether cells in a given set X and only have a number X that may reside in other cells, then this game can not have these figures to clear the bit masks other cells. There are many pages sites dedicated to sudoku which contains more advanced algorithms that are so easy to apply bit masks, must apply these rules on several occasions and even to reach a solution. If at any time at a standstill, then you should use a brute force method to find depth and first to reach the solution.

Google Wave Developer Preview at Google I/O 2009



  1. October 20th, 2011 at 12:50 | #1

    At last! Someone who understands! Thanks for psoting!

  1. September 10th, 2011 at 02:34 | #1
  2. September 15th, 2011 at 10:32 | #2
  3. September 15th, 2011 at 19:25 | #3
  4. September 15th, 2011 at 21:14 | #4
  5. September 15th, 2011 at 23:59 | #5
  6. September 20th, 2011 at 20:51 | #6
  7. September 21st, 2011 at 12:15 | #7
  8. September 22nd, 2011 at 02:09 | #8
  9. September 22nd, 2011 at 09:55 | #9
  10. September 22nd, 2011 at 11:03 | #10
  11. September 22nd, 2011 at 12:35 | #11
  12. September 24th, 2011 at 10:15 | #12
  13. September 25th, 2011 at 08:07 | #13
  14. September 26th, 2011 at 11:44 | #14
  15. September 27th, 2011 at 18:35 | #15
  16. September 28th, 2011 at 00:09 | #16
  17. September 29th, 2011 at 19:06 | #17
  18. October 1st, 2011 at 19:47 | #18
  19. October 2nd, 2011 at 00:33 | #19
  20. October 5th, 2011 at 18:38 | #20
  21. October 5th, 2011 at 19:49 | #21
  22. October 12th, 2011 at 17:32 | #22
  23. October 14th, 2011 at 01:40 | #23
  24. October 20th, 2011 at 13:55 | #24
  25. October 28th, 2011 at 12:24 | #25
  26. October 28th, 2011 at 12:25 | #26
  27. October 28th, 2011 at 20:14 | #27
  28. November 5th, 2011 at 03:24 | #28
  29. November 13th, 2011 at 23:32 | #29
  30. November 16th, 2011 at 19:35 | #30
  31. February 10th, 2012 at 19:34 | #31
  32. February 12th, 2012 at 01:04 | #32
  33. March 3rd, 2012 at 05:40 | #33
  34. March 7th, 2012 at 22:00 | #34
  35. March 11th, 2012 at 05:12 | #35
  36. March 15th, 2012 at 13:37 | #36