For Programmers: Free Programming Magazines  


Home > Archive > Prolog > September 2007 > Re: How to improve this 8 queens?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to improve this 8 queens?
pineapple.link@yahoo.com

2007-09-27, 7:09 pm

> Markus is not "generating custom facts on the fly".

Real quick - I knew he wasn't doing this. *I* did this in my version
of 8 queens, and I wanted to do more of it. I wanted to dynamically
generate the test/8 predicate, if possible, with a short 1 or 2 line
predicate. I wanted to do this simply to shrink the length of code.
If you look at my solution, most of the code bulk is in that one
"problem predicate" (are these things called predicates?). If I could
reduce the bulk of this predicate, I could say that I produced an 8
queens that was as reasonably short as one could make it (especially
for a newbie), give or take (sure - I've seen code in APL or J that is
shorter, but what can you expect). I was saying that I would try
later to dynamically generate this predicate, but that I'm not nearly
as good at this sort of thing as he is ("generating custom facts on
the fly"), so.... Anyway, sorry for the confusion.

Thanks for the walk-through on Markus's code. I tried doing something
similar before making the original post, but lists always give me
headaches in Prolog. I could have succeeded in a solution similar to
his if I had easy access to an array type, but no tutorial or FAQ I've
ever seen on Prolog covers arrays - only lists (what you would call a
"term" I believe).

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com