December 15, 2005
Tiago Gasiba wrote:
<snip>
> Oops... forgot to copy-paste a few numbers
> Here it goes the final (complete) and unique solution:
> 
> 126 437 958
> 895 621 473
> 374 985 126
> 
> 457 193 862
> 983 246 517
> 612 578 394
> 
> 269 314 785
> 548 769 231
> 731 852 649

That's strange.  When I tried it, the first one it solved was number 10.

The only thing that mine does that the website doesn't is the refinePerms function, which is a generalisation of C and D.  If you comment out the call to this, you'll see that it doesn't solve.

But my program doesn't implement method E or F at all.  A generalisation of F that shouldn't be too hard to implement is to enumerate the arrangements of each number throughout the grid and refine the options in a similar way to refinePerms.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
December 16, 2005
Mine is not working well :-(
It's my first D project using DBC and I get assertions allover the place...
I now need assertions for my assertions, since I'm no longer sure I can
assert certain things :-S

Actually it works, but it's far from smart. There are plenty of tricks that I haven't implemented yet.

http://www.lunesu.com/sudoku.zip

WARNING: unclean code!

L.


December 16, 2005
Lionello Lunesu wrote:
> Mine is not working well :-(
> It's my first D project using DBC and I get assertions allover the place... I now need assertions for my assertions, since I'm no longer sure I can assert certain things :-S
> 
> Actually it works, but it's far from smart. There are plenty of tricks that I haven't implemented yet.
> 
> http://www.lunesu.com/sudoku.zip
> 
> WARNING: unclean code!

Maybe.  But I'm still totally perplexed about why you've chosen to invent a boolean type with the true/false values reversed.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
December 16, 2005
> Maybe.  But I'm still totally perplexed about why you've chosen to invent a boolean type with the true/false values reversed.

Uh.. because they're initialized to 0 :-S That's the actual reason, I'm not making it up.

The class itself started pretty clean, but the algorithm is a mess, mostly because I kept rewriting it, trying to get rid of some assertions that kept failing...

L.


December 16, 2005
Lionello Lunesu wrote:
>> Maybe.  But I'm still totally perplexed about why you've chosen to invent a boolean type with the true/false values reversed.
> 
> Uh.. because they're initialized to 0 :-S That's the actual reason, I'm not making it up.
<snip>

I see now.  Could've been done with

typedef byte possible = true;

(Ideally it should be bool, but the bug with GDC on Mac OS X seems to kick in when I do it that way.)

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
December 16, 2005
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:dnu9bc$1shk$1@digitaldaemon.com...
> Lionello Lunesu wrote:
>>> Maybe.  But I'm still totally perplexed about why you've chosen to invent a boolean type with the true/false values reversed.
>>
>> Uh.. because they're initialized to 0 :-S That's the actual reason, I'm not making it up.
> <snip>
>
> I see now.  Could've been done with
>
> typedef byte possible = true;

Aaaah, right.. This thing was actually the first D file that wasn't just a snippet.. I was learning new D stuff on the way...

L.


Next ›   Last »
1 2 3
Top | Discussion index | About this forum | D home