Re: eight queens

Daniel Mahler (mahler@nospam.socs.uts.edu.au)
Mon, 16 Oct 1995 17:52:27 +1000

>My original "code" actually places all eight pieces on the board
>simultaneously, regardless of the validity of their placement. Thus,
>Daniel's first comment only applies to his recursive suggestion.

If your code has eight nested loops then it places them in sequnce.
The first queen is set by the outermost loop and so on.
If the first and second queen attack can be determined just after the
second outermost loop is incremented.
If that testing was done then you could exit back out to the second loop.
Otherwise the remaining six loops have to go through all their iterations.

>So, did I hear Daniel volunteering to hack something up in Lisp and post
>it to the mailing list? :-)

As Anthony pointed out the recursive algorithm is in the Miranda manual.

>But we were only after a quick hack, weren't we? :-)

Just though poeple might like to know anyway.

Daniel