|
Hi again, I have a couple of pointers for you that may help. Firstly (ignore this if you already know it) The program is basically trying to complete a list showing the positions of queens on a given board size. The way this list is set up is this: Imagine you have a board of size 4, with a queen at row 1 in column 3, row 4 in column 2, and row 2 in column 1. Ie we are looking for the row for the 4th column. Reading in columns from right to left, the queens are currently at rows 1,4 and 2 respectively. The list that represents this is [1 4 2] - note, just row numbers from right to left! So, the members of this list are all integers. Now, your {BuildList} function expects a list of integers as above, so the line which starts H.1#..... makes no sense because H is an integer and doesn't have a '.1' to access. Secondly, as I said before, stick with the version of {Revise} that the lecturer gave you (exactly as it is) it works 100% guaranteed! I suspect the line else {AddToList H+1#N T} should be different in the original version. This is why - Revise is taking this list of integers we mentioned and is looking for another integer, representing a non-conflicting row for the next column, to stick on the head of the list. Now, in this function, the value being tested is always H+1 , so if H+1 is not {Threatened} then H+1 is the value that must be added to the head of the list. I hope you'll appreciate that I can't just give you code to use, but I've amended your code with these points in mind on my machine and everything as far as revising the list seems to work fine. I was a little dubious about the logic in the {Attack} function simply because it is different to the way I would have done it, but having said that it seems to work as far as I can tell. Hope this helps. Regards Mark Neil Munro wrote:
-- Mark Richardson Final year undergraduate University of Teesside |
_________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
