Einstein's Riddle

Donal K. Fellows fellowsd at cs.man.ac.uk
Wed Mar 14 10:39:13 EST 2001


Yoann Padioleau wrote:
> Petasis George <petasis at iit.demokritos.gr> writes:
>> Well, try this:-)
>> Written by a friend of mine. Its amazing how small can programs be if you
>> know STL. To bad I don't know stl :-)
>> Of course it will need some time, as it randomly checks all combinations...
> But your program dont really do the job cos it is too slow.
> You first generate the permutations and then test, the pb is that
> there is too many permutations :
> p[nation][english] can be either 0 1 2 3 4 or 5, same for the other
> variables you have 5*(5!) possibililty = 24 883 200 000
> if you are able to do 1 000 000 ValidConstraints per second (cos you
> have perhaps a very very fast computer) you will need 24 883 seconds
> =~ 6hours to compute (in the worst case i admit)
> 
> the prolog program i propose take 0.1 second to find the solution :)
> who say that prolog is slower than c++ :))

Having read both C++ and Prolog versions, do either of you wish to take on
the extension and write a program to take a natural language description of
the problem and solve it?  In this caffeine-hyped .com-ready electronically
enabled speed-of-light online world of ours, I might not have time to take
your existing code and adapt it to the specific problem I'm interested in.

Scanner support is optional.  >:^)

Donal.
- 
Donal K. Fellows    http://www.cs.man.ac.uk/~fellowsd/    fellowsd at cs.man.ac.uk
-- With a complex beast like Swing, it's not just a matter of "What button
   should I push", but rather "How do I put myself into a nice metamorphosis
   so that I am deemed acceptable by the Swing Gods."             -- Anonymous



More information about the Python-list mailing list