Knight's Challenge in D

janderson askme at me.com
Wed Apr 2 00:12:32 PDT 2008


Chris Miller wrote:
> I decided to take D for a spin with a very old problem I tried to solve my freshmen year in Computer Science.  I was using Java, and back then with only version 1.4.2 it didn't get very far, or very fast, either.
> 
> So when I came back to the same problem, I tried to use some more D features than my previous Java attempts.  I came up with a working solution extremely quickly (four hours).  That was cool.  (1)
> 
> Then I decided to write a D program to make SVG images to illustrate the solutions. (2)  I reverse-engineered the SVG images from an existing Wikipedia image script written in Perl, embellishing it to handle variable sized grids.  That took about six hours, since I had to write a parser.
> 
> All in all, it took around 1,000 microseconds to generate the solution sets, and around half a second to generate all the images. (3)
> 
> Complete success.
> 
> I thought some people here might like to see it, since it's in D.  I didn't exactly think it big enough for digitalmars.D.announce, either.
> 
> I hope someone likes it!
> 
> 1. http://www.fsdev.net/browser/Knights_Challenge/Intelligent/8x8/Miller.d
> 2. http://www.fsdev.net/browser/Knights_Challenge/tools/SVGMaker.d
> 3. http://www.fsdev.net/wiki/knights-tour/Miller1

Great Stuff!



More information about the Digitalmars-d mailing list