Knowing .NET Sometimes a coder who writes, sometimes a writer who codes. Formerly, a coder who edited magazines.

August 8, 2005

Einstein’s Riddle in C#

Filed under: Uncategorized — admin @ 2:35 pm

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
//The person who smokes Pall Mall rears birds
//The owner of the yellow house smokes Dunhill


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


No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress