4
$\begingroup$

Partially solved sudoku:

   ===================================
9: || 8  __ 3 || __ __ __|| 4  9  2 ||
8: || 6  4  1 || 9  __ 2 || __ __ __||
7: || __ __ __|| 3  4  8 || __ 6  1 ||
   ===================================
6: || __ __ 7 || __ 9  __|| 1  5  8 ||
5: || __ __ __|| __ 2  __|| __ __ 6 ||
4: || 5  6  __|| __ 1  __|| 2  __ __||
   ===================================
3: || 4  __ 6 || 2  3  __|| __ __ __||
2: || __ __ __|| __ 8  __|| 6  2  4 ||
1: || 7  8  2 || __ __ __|| 3  1  __||
   ===================================
      A  B  C    D  E  F    G  H  I 

These are potential values on the missing fields:

A/2: -- [1, 3, 9]
A/5: -- [1, 3, 9]
A/6: -- [2, 3]
A/7: -- [2, 9]
B/2: -- [1, 3, 5, 9]
B/3: -- [1, 5, 9]
B/5: -- [1, 3, 9]
B/6: -- [2, 3]
B/7: -- [2, 5, 7, 9]
B/9: -- [5, 7]
C/2: -- [5, 9]
C/4: -- [4, 8, 9]
C/5: -- [4, 8, 9]
C/7: -- [5, 9]
D/1: -- [4, 5, 6]
D/2: -- [1, 5, 7]
D/4: -- [4, 7, 8]
D/5: -- [4, 5, 7, 8]
D/6: -- [4, 6]
D/9: -- [1, 5, 6, 7]
E/1: -- [5, 6]
E/8: -- [5, 7]
E/9: -- [5, 6, 7]
F/1: -- [4, 5, 6, 9]
F/2: -- [1, 5, 7, 9]
F/3: -- [1, 5, 7, 9]
F/4: -- [3, 4, 7]
F/5: -- [3, 4, 5, 7]
F/6: -- [3, 4, 6]
F/9: -- [1, 5, 6, 7]
G/3: -- [5, 7, 8, 9]
G/5: -- [7, 9]
G/7: -- [5, 7]
G/8: -- [5, 7, 8]
H/3: -- [7, 8]
H/4: -- [3, 4, 7]
H/5: -- [3, 4, 7]
H/8: -- [3, 7, 8]
I/1: -- [5, 9]
I/3: -- [5, 7, 9]
I/4: -- [3, 7, 9]
I/8: -- [3, 5, 7]

My sudoku solver program is stuck on the above field. I didn't implement a backtracking algorithm on purpose, but I also can't figure out the next move, not to mention implementing the according strategy.

Please give a tip on how to find out the next number.

EDIT: The original unsolved sudoku:

   ===================================
9: || __ __ 3 || __ __ __|| 4  9  2 ||
8: || 6  __ 1 || __ __ __|| __ __ __||
7: || __ __ __|| __ 4  8 || __ __ __||
   ===================================
6: || __ __ 7 || __ 9  __|| __ 5  8 ||
5: || __ __ __|| __ 2  __|| __ __ __||
4: || 5  6  __|| __ 1  __|| 2  __ __||
   ===================================
3: || __ __ __|| 2  3  __|| __ __ __||
2: || __ __ __|| __ __ __|| 6  __ 4 ||
1: || 7  8  2 || __ __ __|| 3  __ __||
   ===================================
      A  B  C    D  E  F    G  H  I 
$\endgroup$
  • $\begingroup$ I can't get to H7,I7 or G6,I5 - Do you know the logic on those? $\endgroup$ – Raystafarian Aug 31 '15 at 18:06
  • $\begingroup$ Well, even with debugging, it's hard to tell the intermediate results. Of course I tested the individual strategies alot, so Iam 95% sure, that they perform well. The mentioned numbers are always added in the first iteration, so it should be something obvious. $\endgroup$ – SME_Dev Aug 31 '15 at 18:25
  • $\begingroup$ Well, all the rest of it is definitely correct, but those four stump me - not that they're wrong. $\endgroup$ – Raystafarian Aug 31 '15 at 18:26
  • 1
    $\begingroup$ G6 is at the intersection of 7958 and 4263 $\endgroup$ – JonTheMon Aug 31 '15 at 20:01
  • 1
    $\begingroup$ H1 is at the intersection of 7823 and 59 and eliminated 64 $\endgroup$ – JonTheMon Aug 31 '15 at 20:26
4
$\begingroup$

After getting G6 (intersection of 7958 and 4263) and H1 (intersection of 7823 and 59 and eliminated 64), the next move would be I4 (9).

We know this because C4 and C5 must be 4 or 8. E6 (9) eliminates A6, B6, which means there's a 9 on row 5. H9 (9) eliminates H4, leaving I4 = 9. Follow up with F1 = 9.

Intermediate grid:

   ===================================
9: || _8 __ 3 || __ __ __|| 4  9  2 ||
8: || 6  _4 1 || _9 __ _2|| __ __ __||
7: || __ __ __|| _3 4  8 || __ _6 _1||
   ===================================
6: || __ __ 7 || _6 9  _4|| _1 5  8 ||
5: || __ __ __|| __ 2  __|| __ __ _6||
4: || 5  6  __|| __ 1  __|| 2  __ _9||
   ===================================
3: || __ __ _6|| 2  3  __|| __ __ __||
2: || __ __ __|| __ _8 __|| 6  _2 4 ||
1: || 7  8  2 || _4 _6 _9|| 3  _1 _5||
   ===================================
      A  B  C    D  E  F    G  H  I 

Completed grid:

   ===================================
9: || _8 _5 3 || _1 _7 _6|| 4  9  2 ||
8: || 6  _4 1 || _9 _5 _2|| _8 _7 _3||
7: || _2 _7 _9|| _3 4  8 || _5 _6 _1||
   ===================================
6: || _3 _2 7 || _6 9  _4|| _1 5  8 ||
5: || _1 _9 _8|| _5 2  _3|| _7 _4 _6||
4: || 5  6  _4|| _8 1  _7|| 2  _3 _9||
   ===================================
3: || _4 _1 _6|| 2  3  _5|| _9 _8 _7||
2: || _9 _3 _5|| _7 _8 _1|| 6  _2 4 ||
1: || 7  8  2 || _4 _6 _9|| 3  _1 _5||
   ===================================
      A  B  C    D  E  F    G  H  I 
$\endgroup$
  • $\begingroup$ Thanks alot, though i didn't get E6 (9) eliminates A6 at first. But that's clear now. $\endgroup$ – SME_Dev Aug 31 '15 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.