Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

chains Vs trial& error

 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
gabriele46

Joined: 18 Jul 2007
Posts: 1
:
Location: Mantova, Italy

Items
PostPosted: Wed Jul 18, 2007 4:37 pm    Post subject: chains Vs trial& error Reply with quote

I'm a rookie programmer and I developped a program to solve and generate sudokus.
my solver was using the basic tecniques + coloring, forcing chain (wathever is the value assigned to a cell, the value of an other cell will be the same) and a sort of personal trial & error.
After discovering the forum i started developping the routine for chains and loops.
Here is the point: the introduction of the tecnique for finding chains and loop, seems, to me, to bring to a complication of the solution.
An example to explain better my dilemma:
This puzzle :
Code:
*--------------------------------------------------------------------*
 | 3479   5      37     | 2367   27     1      | 3467   8      469    |
 | 379    1      8      | 3567   4      567    | 367    2      369    |
 | 347    2      6      | 378    9      78     | 1      5      34     |
 |----------------------+----------------------+----------------------|
 | 2      7      9      | 1      6      3      | 5      4      8      |
 | 8      6      4      | 257    257    257    | 9      3      1      |
 | 5      3      1      | 9      8      4      | 2      6      7      |
 |----------------------+----------------------+----------------------|
 | 367    4      2      | 567    1      567    | 8      9      356    |
 | 67     9      57     | 245678 3      25678  | 46     1      2456   |
 | 1      8      35     | 2456   25     9      | 346    7      23456  |
 *--------------------------------------------------------------------*
 


is solved by Sudoku Explainer 1.2:
1 x X-Wing
1 x Hidden Pair
1 x XYZ-Wing
3 x XY-Wing
1 x Bidirectional Y-Cycle
1 x Turbot Fish
2 x Bidirectional Cycle
3 x Forcing Chain (here the definition of forcing chain is different from mine)

the new program I developed solves the puzzle with 3 loops:
LOOP, contradiction found, If r5c5=2 then r9c5 = 5, r9c3 = 3,r1c3 = 7,r1c5 = 2
IMPOSSIBLE, 2 is already in r5c5
LOOP, contradiction found, If r5c6=7 then r8c6 = 2, r9c5 = 5, r5c5 = 7
IMPOSSIBLE, 7 is already in r5c6
LOOP, contradiction found, If r9c5=5 then r7c9 = 5, r7c1 = 3, r9c3 = 5
IMPOSSIBLE, 5 is already in r9c5
I use the name "LOOP" because I don't know the right term to use (somebody can help me to find the correct definition?)

My old solver was solving everything in one single step:
if r1c5= 2 then r5c5 = 7, r9c5 = 5,r9c3 = 9 , r8c3 = 5, r7c9 = 5,
r7c1 = 3 - IMPOSSIBLE, also r9c3 = 3, (or,if you prefere, 3 no more possible in row 7)
then r1c5 = 7
The doubt that I have is: can my trial & error be considered logic?
What is the best name of the tecnique I used?
Thank you
Gabriele
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron