Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Terminator for MegaSUDOKU

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> FAQ & Off Topics
View previous topic :: :: View next topic  
Author Message
lkhiger

New User


Joined: 28 Oct 2005
Posts: 89

PostPosted: Mon Sep 28, 2009 7:20 pm    Post subject: Terminator for MegaSUDOKU
Reply with quote

There is level-3 sudoku, having 2 empty lines:

Sudoku Line

XXXXXXXXX
X7XXX6X3X
X3X72XX4X
7XXXX8XX1
6XX3X7XX5
5X91XXXXX
X8XX91X2X
X916XXX7X
XXXXXXXXX

Line 1: | 9 | 6 | 2 | 8 | 3 | 4 | 1 | 5 | 7 |
Line 2: | 8 | 7 | 4 | 5 | 1 | 6 | 9 | 3 | 2 |
Line 3: | 1 | 3 | 5 | 7 | 2 | 9 | 6 | 4 | 8 |
Line 4: | 7 | 2 | 3 | 9 | 5 | 8 | 4 | 6 | 1 |
Line 5: | 6 | 1 | 8 | 3 | 4 | 7 | 2 | 9 | 5 |
Line 6: | 5 | 4 | 9 | 1 | 6 | 2 | 7 | 8 | 3 |
Line 7: | 3 | 8 | 7 | 4 | 9 | 1 | 5 | 2 | 6 |
Line 8: | 2 | 9 | 1 | 6 | 8 | 5 | 3 | 7 | 4 |
Line 9: | 4 | 5 | 6 | 2 | 7 | 3 | 8 | 1 | 9 |

Our solver spent 11 second to find this single solution.

Now we make simple experiment: we'll change line 4 by remove 1 from source string:

7XXXX8XX1==> 7XXXX8XX0

We expect the same single solution, but not.

Because we have 2 empty lines we'll have multiple solutions.

Ok, every solution will shown to you, but how ?

Line 1: ........
Line 1: ........
..................
Line 1: ........
Line 2: ........
Line 2: ........
..................
Line 2: ........ etc.

How combine these lines in complete sudoku solutions ?

For this I created the new termin (column) named Weight.

The weight has to be unique for every single solution.

Weight = 'Line 1:... ' || 'Line 2:... ' ||.... || 'Line 9:... '.

Then I used Group By and Order BY for Weight & Line##.

As Result:

Sudoku Line

XXXXXXXXX
X7XXX6X3X
X3X72XX4X
7XXXX8XXX
6XX3X7XX5
5X91XXXXX
X8XX91X2X
X916XXX7X
XXXXXXXXX

Line 1: | 1 | 6 | 2 | 8 | 3 | 4 | 7 | 5 | 9 |
Line 2: | 9 | 7 | 4 | 5 | 1 | 6 | 8 | 3 | 2 |
Line 3: | 8 | 3 | 5 | 7 | 2 | 9 | 6 | 4 | 1 |
Line 4: | 7 | 1 | 3 | 9 | 5 | 8 | 2 | 6 | 4 |
Line 5: | 6 | 2 | 8 | 3 | 4 | 7 | 1 | 9 | 5 |
Line 6: | 5 | 4 | 9 | 1 | 6 | 2 | 3 | 8 | 7 |
Line 7: | 3 | 8 | 7 | 4 | 9 | 1 | 5 | 2 | 6 |
Line 8: | 2 | 9 | 1 | 6 | 8 | 5 | 4 | 7 | 3 |
Line 9: | 4 | 5 | 6 | 2 | 7 | 3 | 9 | 1 | 8 |

Line 1: | 1 | 6 | 2 | 8 | 3 | 4 | 7 | 5 | 9 |
Line 2: | 9 | 7 | 4 | 5 | 1 | 6 | 8 | 3 | 2 |
Line 3: | 8 | 3 | 5 | 7 | 2 | 9 | 6 | 4 | 1 |
Line 4: | 7 | 1 | 3 | 9 | 5 | 8 | 2 | 6 | 4 |
Line 5: | 6 | 2 | 8 | 3 | 4 | 7 | 9 | 1 | 5 |
Line 6: | 5 | 4 | 9 | 1 | 6 | 2 | 3 | 8 | 7 |
Line 7: | 3 | 8 | 7 | 4 | 9 | 1 | 5 | 2 | 6 |
Line 8: | 2 | 9 | 1 | 6 | 8 | 5 | 4 | 7 | 3 |
Line 9: | 4 | 5 | 6 | 2 | 7 | 3 | 1 | 9 | 8 |

Line 1: | 1 | 6 | 2 | 8 | 3 | 4 | 7 | 5 | 9 |
Line 2: | 9 | 7 | 4 | 5 | 1 | 6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 | 8 | 3 | 4 | 7 | 2 | 9 | 5 |
Line 6: | 5 | 4 | 9 | 1 | 6 | 2 | 3 | 8 | 7 |
Line 7: | 3 | 8 | 7 | 4 | 9 | 1 | 5 | 2 | 6 |
Line 8: | 2 | 9 | 1 | 6 | 8 | 5 | 4 | 7 | 3 |
Line 9: | 4 | 5 | 6 | 2 | 7 | 3 | 8 | 1 | 9 |

we got 8 different solutions in 1 minute.

P.S. Code in an attachment icon_arrow.gif icon_arrow.gif icon_arrow.gif
Back to top
View user's profile Send private message

View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> FAQ & Off Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Find corresponding Scope Terminator TS70363 COBOL Programming 2 Fri Jun 11, 2010 4:16 pm
No new posts Copybook Scope Terminator within IF/E... ramanindya55 COBOL Programming 3 Thu Mar 18, 2010 8:27 pm
No new posts SQL concatenation is taking ' as the ... William Thompson DB2 6 Thu Feb 01, 2007 6:48 pm
No new posts What is the use of cobol scope termin... niharika1234 COBOL Programming 3 Tue May 02, 2006 2:28 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us