Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Way too much time on my hands

Re: Way too much time on my hands

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 11 Apr 2006 15:03:51 -0700
Message-ID: <1144797528.655098@yasure.drizzle.com>


Maxim Demenko wrote:

> DA Morgan schrieb:

>> I have posted a page to the internet with a bit of a puzzle (to put it
>> mildly): http://www.psoug.org/sudoku.html
>>
>> This is hardly a finished work of art ... in fact it is only about 3
>> hours or so worth of any work at all.
>>
>> But it seems like an interesting challenge, solving Sudoku puzzles with
>> PL/SQL, so I thought I'd put this out here for anyone that might want to
>> collaborate (or just criticize some reasonably abysmal code).
>>
>> It easily solves simple problems. Those where it is possible to examine
>> blocks, columns, and rows, and identify at least one cell with each
>> iteration where an unambiguous answer is possible. But chokes when the
>> solution is more complex.
>>
>> I've considered writing something to do a brute force attack but thought
>> others might be able to come up with something far more elegant.
>>
>> Enjoy!
> 
> Have you seen a Rene Nyffenegger approach ?
> http://www.adp-gmbh.ch/blog/2005/september/6.html
> 
> Best regards
> 
> Maxim

I hadn't ... thanks.

I find it fascinating how we used similar names for objects without ever seeing each others' work and choose totally different approaches.

And both choke at the exact same point on my Complex Demo where there is a situation in which no cell has a non-ambiguous solution.

Anyone else with a way of avoiding brute force?

BTW ... for anyone interested in comparing the two ... here are the insert statement's for Renee's method:

begin

insert into sb (rij, kolom, digit, blok) values (1, 1,    2, 1);
insert into sb (rij, kolom, digit, blok) values (1, 2, null, 1);
insert into sb (rij, kolom, digit, blok) values (1, 3, null, 1);
insert into sb (rij, kolom, digit, blok) values (1, 4, null, 2);
insert into sb (rij, kolom, digit, blok) values (1, 5,    4, 2);
insert into sb (rij, kolom, digit, blok) values (1, 6, null, 2);
insert into sb (rij, kolom, digit, blok) values (1, 7, null, 3);
insert into sb (rij, kolom, digit, blok) values (1, 8, null, 3);
insert into sb (rij, kolom, digit, blok) values (1, 9,    8, 3);

insert into sb (rij, kolom, digit, blok) values (2, 1, null, 1);
insert into sb (rij, kolom, digit, blok) values (2, 2,    8, 1);
insert into sb (rij, kolom, digit, blok) values (2, 3, null, 1);
insert into sb (rij, kolom, digit, blok) values (2, 4, null, 2);
insert into sb (rij, kolom, digit, blok) values (2, 5, null, 2);
insert into sb (rij, kolom, digit, blok) values (2, 6, null, 2);
insert into sb (rij, kolom, digit, blok) values (2, 7, null, 3);
insert into sb (rij, kolom, digit, blok) values (2, 8, 7, 3); insert into sb (rij, kolom, digit, blok) values (2, 9, null, 3);
insert into sb (rij, kolom, digit, blok) values (3, 1,    3, 1);
insert into sb (rij, kolom, digit, blok) values (3, 2, null, 1);
insert into sb (rij, kolom, digit, blok) values (3, 3, null, 1);
insert into sb (rij, kolom, digit, blok) values (3, 4, null, 2);
insert into sb (rij, kolom, digit, blok) values (3, 5,    2, 2);
insert into sb (rij, kolom, digit, blok) values (3, 6, null, 2);
insert into sb (rij, kolom, digit, blok) values (3, 7, null, 3);
insert into sb (rij, kolom, digit, blok) values (3, 8, null, 3);
insert into sb (rij, kolom, digit, blok) values (3, 9,    6, 3);

insert into sb (rij, kolom, digit, blok) values (4, 1, null, 4);
insert into sb (rij, kolom, digit, blok) values (4, 2, null, 4);
insert into sb (rij, kolom, digit, blok) values (4, 3,    2, 4);
insert into sb (rij, kolom, digit, blok) values (4, 4, null, 5);
insert into sb (rij, kolom, digit, blok) values (4, 5, null, 5);
insert into sb (rij, kolom, digit, blok) values (4, 6, null, 5);
insert into sb (rij, kolom, digit, blok) values (4, 7,    7, 6);
insert into sb (rij, kolom, digit, blok) values (4, 8, null, 6); insert into sb (rij, kolom, digit, blok) values (4, 9, 1, 6);
insert into sb (rij, kolom, digit, blok) values (5, 1, null, 4);
insert into sb (rij, kolom, digit, blok) values (5, 2, null, 4);
insert into sb (rij, kolom, digit, blok) values (5, 3, null, 4);
insert into sb (rij, kolom, digit, blok) values (5, 4, null, 5);
insert into sb (rij, kolom, digit, blok) values (5, 5,    3, 5);
insert into sb (rij, kolom, digit, blok) values (5, 6, null, 5);
insert into sb (rij, kolom, digit, blok) values (5, 7, null, 6);
insert into sb (rij, kolom, digit, blok) values (5, 8, null, 6);
insert into sb (rij, kolom, digit, blok) values (5, 9, null, 6);

insert into sb (rij, kolom, digit, blok) values (6, 1,    9, 4);
insert into sb (rij, kolom, digit, blok) values (6, 2, null, 4);
insert into sb (rij, kolom, digit, blok) values (6, 3,    5, 4);
insert into sb (rij, kolom, digit, blok) values (6, 4, null, 5);
insert into sb (rij, kolom, digit, blok) values (6, 5, null, 5);
insert into sb (rij, kolom, digit, blok) values (6, 6, null, 5);
insert into sb (rij, kolom, digit, blok) values (6, 7,    4, 6);
insert into sb (rij, kolom, digit, blok) values (6, 8, null, 6); insert into sb (rij, kolom, digit, blok) values (6, 9, null, 6);
insert into sb (rij, kolom, digit, blok) values (7, 1,    8, 7);
insert into sb (rij, kolom, digit, blok) values (7, 2, null, 7);
insert into sb (rij, kolom, digit, blok) values (7, 3, null, 7);
insert into sb (rij, kolom, digit, blok) values (7, 4,    1, 8);
insert into sb (rij, kolom, digit, blok) values (7, 5, null, 8);
insert into sb (rij, kolom, digit, blok) values (7, 6,    6, 8);
insert into sb (rij, kolom, digit, blok) values (7, 7, null, 9);
insert into sb (rij, kolom, digit, blok) values (7, 8, null, 9);
insert into sb (rij, kolom, digit, blok) values (7, 9,    9, 9);

insert into sb (rij, kolom, digit, blok) values (8, 1, null, 7);
insert into sb (rij, kolom, digit, blok) values (8, 2,    2, 7);
insert into sb (rij, kolom, digit, blok) values (8, 3, null, 7);
insert into sb (rij, kolom, digit, blok) values (8, 4, null, 8);
insert into sb (rij, kolom, digit, blok) values (8, 5, null, 8);
insert into sb (rij, kolom, digit, blok) values (8, 6, null, 8);
insert into sb (rij, kolom, digit, blok) values (8, 7, null, 9);
insert into sb (rij, kolom, digit, blok) values (8, 8, 6, 9); insert into sb (rij, kolom, digit, blok) values (8, 9, null, 9);
insert into sb (rij, kolom, digit, blok) values (9, 1,    1, 7);
insert into sb (rij, kolom, digit, blok) values (9, 2, null, 7);
insert into sb (rij, kolom, digit, blok) values (9, 3, null, 7);
insert into sb (rij, kolom, digit, blok) values (9, 4, null, 8);
insert into sb (rij, kolom, digit, blok) values (9, 5, null, 8);
insert into sb (rij, kolom, digit, blok) values (9, 6,    7, 8);
insert into sb (rij, kolom, digit, blok) values (9, 7, null, 9);
insert into sb (rij, kolom, digit, blok) values (9, 8, null, 9);
insert into sb (rij, kolom, digit, blok) values (9, 9,    2, 9);
commit;
end;
/
-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Tue Apr 11 2006 - 17:03:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US