I ran this with Sicstus prolog 3, and wow it was fast. The ten cases together took only 68 seconds. (That's on a 2.4 GHz pentium 4 machine; and about 140 seconds on a slower 992 MHz pentium 3 machine with the newer Sicstus 4. Gave the correct results in both cases. I can't compare the speed with SWI prolog for I'm lazy to install a newer SWI, and I don't even have any SWI prolog and Sicstus running on the same machine.)

Porting was trivial, the only definitions you need are below.

label(X) :- labeling([], X). time(X) :- X.

I'm surprised how fast it is. I know that the optimization you mention (the one in the first spoiler block) helps a lot, and also that the constraint programming nature makes it so that the last row is always filled in and there aren't too many possibilities to iterate over in the sixth row either, and that also counts a great deal in time. Still, I didn't think it would be so fast after the results with my perl programs.


In reply to Re^5: Seven by seven farming puzzle by ambrus
in thread Seven by seven farming puzzle by ambrus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.