View previous topic :: View next topic |
Author |
Message |
| gnuvince
| Joined: 10 Dec 2006 | Posts: 1 | : | | Items |
|
Posted: Mon Dec 11, 2006 12:00 am Post subject: Help me with this puzzle |
|
|
Hello everyone,
I am writing a sudoku solver in Python that does not use backtracking (that will be another exercise). The results are not bad so far, here are the stats of the program:
Code: |
Easy puzzles : 48 out of 48 (100.00%) puzzles were solved
Medium puzzles: 50 out of 50 (100.00%) puzzles were solved
Hard puzzles : 32 out of 53 (60.38%) puzzles were solved
Evil puzzles : 0 out of 54 (0.00%) puzzles were solved
|
As you can see, my current implementation starts having problems with hard puzzles and can't solve any evil puzzle yet. I would like it if someone could look at the following (incomplete) puzzle and tell me what digit could be logically determined, and work me through the technique. As I found out, just adding one digit to the puzzle can go a long way to solving it.
Code: |
+---------+---------+---------+
| 3 1 9 | 6 7 - | - - - |
| 6 7 2 | - - - | - - 9 |
| - 8 - | - 9 - | 7 6 - |
+---------+---------+---------+
| - - - | 9 - 5 | 6 - - |
| - 6 - | 7 1 - | - 9 - |
| 9 - - | 4 - 6 | - - - |
+---------+---------+---------+
| - 9 8 | - 6 - | 1 3 7 |
| - - - | - - 9 | 5 8 6 |
| - - 6 | - - 7 | 9 4 2 |
+---------+---------+---------+
|
Thank you for your help,
Edit: the formatting of the puzzle is slightly off because the [ code] tags on this board do not use a fixed-width font. To view it more clearly, copy and paste into Notepad.exe
Vincent. |
|
Back to top |
|
|
| m_b_metcalf
| Joined: 13 Mar 2006 | Posts: 210 | : | Location: Berlin | Items |
|
Posted: Mon Dec 11, 2006 1:35 am Post subject: Re: Help me with this puzzle |
|
|
gnuvince wrote: |
As you can see, my current implementation starts having problems with hard puzzles and can't solve any evil puzzle yet. I would like it if someone could look at the following (incomplete) puzzle and tell me what digit could be logically determined, and work me through the technique. As I found out, just adding one digit to the puzzle can go a long way to solving it.
|
Vincent,
For this type of problem, you can always type your incomplete solution into Sudoku Expainer (use Google to find it), and it will give you the next step with a complete analysis.
HTH
Mike Metcalf |
|
Back to top |
|
|
| Pat
| Joined: 06 Sep 2006 | Posts: 128 | : | | Items |
|
Posted: Mon Dec 11, 2006 2:38 pm Post subject: |
|
|
gnuvince wrote: |
I would like it if someone could look at the following puzzle and tell me what digit could be logically determined, and work me through the technique.
Code: |
3 1 9 | 6 7 . | . . .
6 7 2 | . . . | . . 9
. 8 . | . 9 . | 7 6 .
-------+-------+------
. . . | 9 . 5 | 6 . .
. 6 . | 7 1 . | . 9 .
9 . . | 4 . 6 | . . .
-------+-------+------
. 9 8 | . 6 . | 1 3 7
. . . | . . 9 | 5 8 6
. . 6 | . . 7 | 9 4 2
|
|
the 5 for r1
can only be in box3
- exclude this digit elsewhere in that box
( line-to-box exclusion )
leaving only one possible digit for r2c8 (not 5) |
|
Back to top |
|
|
| Carcul
| Joined: 29 Dec 2005 | Posts: 50 | : | Location: Coimbra, Portugal | Items |
|
Posted: Wed Dec 13, 2006 6:25 pm Post subject: |
|
|
Pat wrote: | leaving only one possible digit for r2c8 (not 5) |
After that:
Code: | *-----------------------------------------------------*
| 3 1 9 | 6 7 48 | 248 25 458 |
| 6 7 2 | 38 5 348 | 48 1 9 |
| 5 8 4 | 2 9 1 | 7 6 3 |
|-----------------+-----------------+-----------------|
| 278 4 137 | 9 238 5 | 6 27 18 |
| 28 6 35 | 7 1 38 | 2348 9 458 |
| 9 23 157 | 4 238 6 | 238 57 15 |
|-----------------+-----------------+-----------------|
| 4 9 8 | 5 6 2 | 1 3 7 |
| 27 23 37 | 1 4 9 | 5 8 6 |
| 1 5 6 | 38 38 7 | 9 4 2 |
*-----------------------------------------------------*
|
[r9c5]-3-[r9c4]=3=[r2c4]-3-[r2c6]=3|2=[r1c7]-2-[r1c8]=2=[r4c8](-2-
-[r4c5])-2-[r5c7]=2=[r5c1]=8=[r4c1]-8-[(r4c5)]-3-[r9c5], => r9c5<>3 solving the puzzle.
Carcul |
|
Back to top |
|
|
|