Software development industry analysis by Larry O'Brien, the former editor of Software Development and Computer Language
Monday, August 08, 2005

Inspired by Edi Weitz' solution to Einstein's Riddle in Common Lisp (via O'Reilly Radar), I used Andy Chun's NSolver constraint programming library to solve the program using .NET.

Here's a sense of what C# / NSolver looks like:

//The green house's owner drinks coffee
Post(greenHouse.Eq(coffee));
//The person who smokes Pall Mall rears birds
Post(pallMall.Eq(birds));
//The owner of the yellow house smokes Dunhill
Post(yellowHouse.Eq(dunhill));

On my 1.5Ghz, 768MB RAM Tablet PC, NSolver can solve the problem 100 times in .79 seconds. C# source code (165 lines).

Monday, August 08, 2005 2:35:15 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | #
Tracked by:
"Einstein's Riddle" (Knowing.NET) [Trackback]
http://www.knowing.net/PermaLink,guid,b3082800-4c65-4e9b-8b97-765ac7fe9c6d.aspx [Pingback]
Search
About Larry...
Flickr photostream
Subscribe: RSS 2.0 Atom 1.0
Popular Articles
Programming Sabre with Java, C#, and XML
Genetic Programming in C#
15 Exercises To Know A Programming Language
Top 10 Things I've Learned About Computers From the Movies and Any Episode of "24"
Recently Published Articles
HI
KonaKoder
Categories
Archive
Admin Login
Sign In
Toolroll