0

Hi all,
I have to solve a tripple sudoku.
The program is supposed to solve the enlarged sudoku. We load 21 rows, each with 9 integers in the range <0.9>. Rows 1-9 (numbered so that the first line is numbered 1, etc.), 7-15 and 13-21 are to create a classic sudoku. We remind you of the classic sudoku rules:

  • The classic sudoku has a size of 9x9,
  • Each row of numbers can not repeat itself,
  • In each column the numbers can not be repeated,
  • In each of the nine squares 3x3 numbers can not repeat.

We fill the Sudoku in numbers from 1 to 9. We can only interfere with sudoku cells that initially contained zero. Cell contents that were not initially zero can not be changed. If it is not possible to solve the sudoku display:

NO

If possible, we display a solution in a format like input.

I have a couple questions:

  1. How can computer solve the sudoku?
  2. Which algorithm to use?
  3. How to design it?
  4. When to change 0 to a number (What is the condition that enable us to write a number in the place of 0?)
4
Contributors
6
Replies
26
Views
5 Months
Discussion Span
Last Post by Reverend Jim
0

As always with such homework/assignment tasks, we ask that you show some effort by posting up how far you've got with your code and explaining where you are having difficulty. Everyone here is a volunteer helper, show them you've made some effort and they will respond in kind.

0

Heah, but I don't have any idea of doing this. I just need an inspiration or maybe even vision of working this algorithm. I don't know where to start. I don't know what should I do.

0

Start by slowly and carefully solving one or two by hand. Make a note of what you are doing at each step and why. When you have finished those notes will describe an algorithm or process that can solve a triple sudoku. Now you have something that you can use for a first-pass design of a program.
That first version won't be very good, but once it's running you can see where it fails and improve it to avoid those failures.

(The same advice applies to just about every "I don't know where to start" question. Work it through with pencil and paper until you understand how that works. Then, and only then, start to design a program to do the same thing.)

0

I love doing Sudoku puzzles. What I don't like doing is doing them by hand with pencil and paper so I wrote a vb.net app that takes out the drudgery (writing, erasing, writing, erasing...). It doesn't have any smarts built in (that would take away the fun part). What it does do is eliminate numbers from all related cells when I solve for a single cell. To get you started, here is the elimination algorithm. Note that this is for regular Sudoku (I don't know what a triple Sudoku looks like). Each cell initially has a set of possible digits (1-9).

1.When a cell is solved, scan all cells to the left and right and eliminate the solved digit from the cell set.

  1. Scan all cells above and below and eliminate the solved digit from the cell set.
  2. Scan all cells in the local 9x9 grid and eliminate the solved digit from the cell set.
  3. Scan all cells to see if there are any new cells that have been reduced to a single element in the cell set (solved). If so then repeat these four steps.

To add some smarts (self-solving) requires more ingenuity. For example, if you find two cells in a row, column or local grid, both with the same two digits, you can eliminate those two digits from all other cells in the same row, etc. The same applies to three cells with three digits, etc.

You might want to have a look at this thread.

Good luck.

Edited by Reverend Jim

0

I attached a photo. Is it a right splitting of the SUDOKU that I described earlier? Or am I wrong?

Edited by Noname_1

Attachments Picture.jpg 83.13 KB
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.