The next solve the problem of eight Queeen... but i don't undestand
it!!!.... can you explain me?

(defun n-queens (n m)
  (

    if (= n 1)
    (loop for x from 1 to m collect (list x))


    (loop for sol in (n-queens (1- n) m) nconc
      (loop for col from 1 to m when
        (loop for row from 0 to (length sol) for c in sol
              always (and (/= col c)
                  (/= (abs (- c col)) (1+ row)))
              finally (return (cons col sol))
        )
       collect it
      )
     )
    )
 )




-- 
Victor Manuel Grijalva Altamirano
Universidad Tecnologica de La Mixteca

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to