Having read several articles now on the subject I understand I have to write
a recursive back tracking solution like the below (incomplete and
non-working code, it is this i need help with, I believe) to check if queens
positions conflict with each other.
BoardSize is a global variable set by the user at start up can be between 1
and 16.
{Length L} returns the length of a list.
{Threaten T H} checks if a queen position is on the same row, column, rising
or falling diagonal and returns a boolean result.
fun {Revise L}
case L of H|T then
if {Length L} == BoardSize then {Revise L}
else N = {Length L} in
{Threaten T H} then
{Revise H.1+1#H.2+1|T}
else H.1+1#H.2+1|T
end
end
end
I know this function does not work and if anyone could provide any help as
to why it does not work I'd appreciate it, I have neither a mathematics nor
engineering background so explanations may have to be quite simplistic.
Thanks
Neil Munro
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users