```#-(and) "
P90 (**) Eight queens problem

This is a classical problem in computer science. The objective is
to place eight queens on a chessboard so that no two queens are
attacking each other; i.e., no two queens are in the same row, the
same column, or on the same diagonal.

Hint: Represent the positions of the queens as a list of numbers
1..N. Example: [4,2,7,3,6,8,5,1] means that the queen in the first
column is in row 4, the queen in the second column is in row 2,

"

(defvar *queen-board-size* 8)

;; We could use a list instead of a vector with fill pointer to
;; represent the board.  But instead of incrementing and decrementing
;; the fill-pointer, we would have to cons or free a cell.

(defun make-board (&optional (initial-size 0))
(make-array *queen-board-size* :fill-pointer initial-size :element-type 'fixnum
:initial-element -1))

(defun put-queen (board col row)
(assert (= col (length board)))
(vector-push row board))

(defun remove-queen (board col)
(assert (= (1+ col) (length board)))
(vector-pop board))

(defun valid-queen-position-p (board col row)
(or (zerop col)
(and
;; not on the same row:
(notany (lambda (other-row) (= other-row row)) board)
;; not on a same diagonal:
(loop
:for other-col :below col
:for other-row :across board
:never (= (- col other-col) (abs (- row other-row)))))))

(defun queens ()
(let ((results '()))
(labels ((collect (board)
(push (copy-seq board) results))
(search-queens (board col)
(if (= col *queen-board-size*)
(collect board)
(loop
:for row :below *queen-board-size*
:when (valid-queen-position-p board col row)
:do (progn
(put-queen board col row)
(search-queens board (1+ col))
(remove-queen board col))))))
(search-queens (make-board) 0)
results)))

;; (queens)
;;  --> (#(7 3 0 2 5 1 6 4)
;;       #(7 2 0 5 1 4 6 3)
;;       #(7 1 4 2 0 6 3 5)
;;       #(7 1 3 0 6 4 2 5)
;;       #(6 4 2 0 5 7 1 3)
;;       #(6 3 1 7 5 0 2 4)
;;       #(6 3 1 4 7 0 2 5)
;;       #(6 2 7 1 4 0 5 3)
;;       #(6 2 0 5 7 4 1 3)
;;       #(6 1 5 2 0 3 7 4)
;;       #(6 1 3 0 7 4 2 5)
;;       #(6 0 2 7 5 3 1 4)
;;       #(5 7 1 3 0 6 4 2)
;;       #(5 3 6 0 7 1 4 2)
;;       #(5 3 6 0 2 4 1 7)
;;       #(5 3 1 7 4 6 0 2)
;;       #(5 3 0 4 7 1 6 2)
;;       #(5 2 6 3 0 7 1 4)
;;       #(5 2 6 1 7 4 0 3)
;;       #(5 2 6 1 3 7 0 4)
;;       #(5 2 4 7 0 3 1 6)
;;       #(5 2 4 6 0 3 1 7)
;;       #(5 2 0 7 4 1 3 6)
;;       #(5 2 0 7 3 1 6 4)
;;       #(5 2 0 6 4 7 1 3)
;;       #(5 1 6 0 3 7 4 2)
;;       #(5 1 6 0 2 4 7 3)
;;       #(5 0 4 1 7 2 6 3)
;;       #(4 7 3 0 6 1 5 2)
;;       #(4 7 3 0 2 5 1 6)
;;       #(4 6 3 0 2 7 5 1)
;;       #(4 6 1 5 2 0 7 3)
;;       #(4 6 1 5 2 0 3 7)
;;       #(4 6 1 3 7 0 2 5)
;;       #(4 6 0 3 1 7 5 2)
;;       #(4 6 0 2 7 5 3 1)
;;       #(4 2 7 3 6 0 5 1)
;;       #(4 2 0 6 1 7 5 3)
;;       #(4 2 0 5 7 1 3 6)
;;       #(4 1 7 0 3 6 2 5)
;;       #(4 1 5 0 6 3 7 2)
;;       #(4 1 3 6 2 7 5 0)
;;       #(4 1 3 5 7 2 0 6)
;;       #(4 0 7 5 2 6 1 3)
;;       #(4 0 7 3 1 6 2 5)
;;       #(4 0 3 5 7 1 6 2)
;;       #(3 7 4 2 0 6 1 5)
;;       #(3 7 0 4 6 1 5 2)
;;       #(3 7 0 2 5 1 6 4)
;;       #(3 6 4 2 0 5 7 1)
;;       #(3 6 4 1 5 0 2 7)
;;       #(3 6 2 7 1 4 0 5)
;;       #(3 6 0 7 4 1 5 2)
;;       #(3 5 7 2 0 6 4 1)
;;       #(3 5 7 1 6 0 2 4)
;;       #(3 5 0 4 1 7 2 6)
;;       #(3 1 7 5 0 2 4 6)
;;       #(3 1 7 4 6 0 2 5)
;;       #(3 1 6 4 0 7 5 2)
;;       #(3 1 6 2 5 7 4 0)
;;       #(3 1 6 2 5 7 0 4)
;;       #(3 1 4 7 5 0 2 6)
;;       #(3 0 4 7 5 2 6 1)
;;       #(3 0 4 7 1 6 2 5)
;;       #(2 7 3 6 0 5 1 4)
;;       #(2 6 1 7 5 3 0 4)
;;       #(2 6 1 7 4 0 3 5)
;;       #(2 5 7 1 3 0 6 4)
;;       #(2 5 7 0 4 6 1 3)
;;       #(2 5 7 0 3 6 4 1)
;;       #(2 5 3 1 7 4 6 0)
;;       #(2 5 3 0 7 4 6 1)
;;       #(2 5 1 6 4 0 7 3)
;;       #(2 5 1 6 0 3 7 4)
;;       #(2 5 1 4 7 0 6 3)
;;       #(2 4 7 3 0 6 1 5)
;;       #(2 4 6 0 3 1 7 5)
;;       #(2 4 1 7 5 3 6 0)
;;       #(2 4 1 7 0 6 3 5)
;;       #(2 0 6 4 7 1 3 5)
;;       #(1 7 5 0 2 4 6 3)
;;       #(1 6 4 7 0 3 5 2)
;;       #(1 6 2 5 7 4 0 3)
;;       #(1 5 7 2 0 3 6 4)
;;       #(1 5 0 6 3 7 2 4)
;;       #(1 4 6 3 0 7 5 2)
;;       #(1 4 6 0 2 7 5 3)
;;       #(1 3 5 7 2 0 6 4)
;;       #(0 6 4 7 1 3 5 2)
;;       #(0 6 3 5 7 1 4 2)
;;       #(0 5 7 2 6 3 1 4)
;;       #(0 4 7 5 2 6 1 3))

;;;----------------------------------------------------------------------
;;; Let's eliminate solutions that are symetric to others.

(defun board-variants (board)
(loop
:with size = (length board)
:for transform
:in (list
;; rotations:
(lambda (new row col) (setf (aref new col)            row))
(lambda (new row col) (setf (aref new (- size row 1)) col))
(lambda (new row col) (setf (aref new (- size col 1)) (- size row 1)))
(lambda (new row col) (setf (aref new row)            (- size col 1)))
;; horizontal mirror:
(lambda (new row col) (setf (aref new col)            (- size row 1)))
;; vertical mirror:
(lambda (new row col) (setf (aref new (- size col 1)) row))
;; first diagonal:
(lambda (new row col) (setf (aref new row)            col))
;; second diagonal:
(lambda (new row col) (setf (aref new (- size row 1)) (- size col 1))))
:collect (loop
:with new = (make-board 8)
:for col :below size
:for row = (aref board col)
:do (funcall transform new row col)
:finally (return new))))

;;; We'll select the "smallest" equivalent solution:

(defun board-lessp (a b)
"Return whether the board A is less than the board B in the 'lexicographic' order."
(loop
:for ai :across a
:for bi :across b
:while (= ai bi)
:finally (return (< ai bi))))

(defun unique-queens ()
(remove-duplicates (mapcar (lambda (board)
(reduce (lambda (a b)
(if (board-lessp a b)
a
b))
(board-variants board)))
(queens))
:test (function equalp)))

;; (mapc  (unique-queens))
;;  (#(2 5 1 4 7 0 6 3)
;;   #(2 4 7 3 0 6 1 5)
;;   #(2 4 1 7 0 6 3 5)
;;   #(1 6 4 7 0 3 5 2)
;;   #(1 6 2 5 7 4 0 3)
;;   #(1 5 7 2 0 3 6 4)
;;   #(1 5 0 6 3 7 2 4)
;;   #(1 4 6 3 0 7 5 2)
;;   #(1 4 6 0 2 7 5 3)
;;   #(1 3 5 7 2 0 6 4)
;;   #(0 5 7 2 6 3 1 4)
;;   #(0 4 7 5 2 6 1 3))

;;; Chess Board Drawing Module

(pushnew :unicode *features*)

#+unicode (progn
(defparameter *cell-format*  "~1A")
(defparameter *space-white* " ")
(defparameter *space-black* " ")
(defparameter *chess-symbols*
'(((roi      blanc) . "♔")
((reine    blanc) . "♕")
((tour     blanc) . "♖")
((fou      blanc) . "♗")
((cavalier blanc) . "♘")
((pion     blanc) . "♙")
((roi      noir ) . "♚")
((reine    noir ) . "♛")
((tour     noir ) . "♜")
((fou      noir ) . "♝")
((cavalier noir ) . "♞")
((pion     noir ) . "♟"))))

#-unicode (progn
(defparameter *cell-format*  "~2A")
(defparameter *space-white* "  ")
(defparameter *space-black* "::")
(defparameter *chess-symbols*
'(((roi      blanc) . "RB")
((reine    blanc) . "QB")
((tour     blanc) . "TB")
((fou      blanc) . "FB")
((cavalier blanc) . "CB")
((pion     blanc) . "PB")
((roi      noir ) . "RN")
((reine    noir ) . "QN")
((tour     noir ) . "TN")
((fou      noir ) . "FN")
((cavalier noir ) . "CN")
((pion     noir ) . "PN"))))

(defmethod get-chess-symbol (queen)
(cdr (assoc (list 'reine 'noir)
*chess-symbols*
:test (function equal))))

(defmethod dessine ((board vector) &optional (stream t))
(flet ((piece (i j)
(if (= (aref board i) j)
'qn
nil))
(letters ()
(loop
:for i :below (length board)
:initially (format stream "   ")
:do (format stream "  ~? " *cell-format*
(list (format nil "~[A~;B~;C~;D~;E~;F~;G~;H~]" i)))
:finally (format stream "~%")))
(line ()
(loop
:with line = (make-string (+ 2  (length (format nil "~?" *cell-format* '(""))))
:initial-element #\-)
:initially (format stream "~A+" line)
:repeat (length board)
:do (format stream "~A+" line)
:finally (format stream "~A~%" line))))
(letters)
(loop
:for j :from (1- (length board)) :downto 0
:do (line)
:do (loop
:for i :below (length board)
:initially (format stream " ~A " (1+ j))
:do (if (piece i j)
(format stream "| ~A " (get-chess-symbol (piece i j)))
(format stream "| ~A " (if (oddp (+ i j))
*space-white*
*space-black*)))
:finally (format stream "| ~A~%" (1+ j))))
(line)
(letters)
(values)))

(defun print-queen-board (board)
(dessine board))

;; (mapc 'print-queen-board (unique-queens))
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   |   | ♛ |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   |   |   | ♛ |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   | ♛ |   |   |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   |   | ♛ |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   |   |   | ♛ | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 | ♛ |   |   |   |   |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 |   |   | ♛ |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   |   | ♛ |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   | ♛ |   |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   |   | ♛ |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   |   |   |   |   | ♛ | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   | ♛ |   |   |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   | ♛ |   |   |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 | ♛ |   |   |   |   |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 |   |   |   |   |   |   | ♛ |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   | ♛ |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   | ♛ |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   |   | ♛ |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   |   |   |   |   | ♛ | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   | ♛ |   |   |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   |   | ♛ |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 | ♛ |   |   |   |   |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 |   |   | ♛ |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   | ♛ |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   | ♛ |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   | ♛ |   |   |   |   |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   |   |   |   | ♛ |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   | ♛ |   |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   | ♛ |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   |   |   |   |   | ♛ | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   | ♛ |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   |   | ♛ |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   | ♛ |   |   |   |   |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   | ♛ |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   |   |   |   | ♛ |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   |   |   | ♛ | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   | ♛ |   |   |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   |   |   | ♛ |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   | ♛ |   |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   |   |   | ♛ |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   | ♛ |   |   |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   |   |   |   |   |   | ♛ | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   | ♛ |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   | ♛ |   |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   | ♛ |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   |   |   | ♛ |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   | ♛ |   |   |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   | ♛ |   |   |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   |   |   |   |   |   | ♛ | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   | ♛ |   |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   |   |   |   | ♛ |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   | ♛ |   |   |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   |   |   | ♛ |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   | ♛ |   |   |   |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   |   |   |   | ♛ |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   | ♛ |   |   |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   | ♛ |   |   |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   |   |   |   |   | ♛ | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   | ♛ |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   |   |   | ♛ |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   | ♛ |   |   |   |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   |   |   |   | ♛ |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   | ♛ |   |   |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   |   |   | ♛ | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   |   | ♛ |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   | ♛ |   |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   |   | ♛ |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   |   |   | ♛ |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   | ♛ |   |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   |   |   |   |   |   | ♛ | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   | ♛ |   |   |   |   |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   |   | ♛ |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 | ♛ |   |   |   |   |   |   |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 |   |   |   |   |   | ♛ |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   | ♛ |   |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   | ♛ |   |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   | ♛ |   |   |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   |   |   |   |   |   |   | ♛ | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   | ♛ |   |   | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   | ♛ |   |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 |   |   |   |   |   |   | ♛ |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 | ♛ |   |   |   |   |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;      A   B   C   D   E   F   G   H
;; ---+---+---+---+---+---+---+---+---+---
;;  8 |   |   | ♛ |   |   |   |   |   | 8
;; ---+---+---+---+---+---+---+---+---+---
;;  7 |   |   |   |   |   | ♛ |   |   | 7
;; ---+---+---+---+---+---+---+---+---+---
;;  6 |   |   |   | ♛ |   |   |   |   | 6
;; ---+---+---+---+---+---+---+---+---+---
;;  5 |   | ♛ |   |   |   |   |   |   | 5
;; ---+---+---+---+---+---+---+---+---+---
;;  4 |   |   |   |   |   |   |   | ♛ | 4
;; ---+---+---+---+---+---+---+---+---+---
;;  3 |   |   |   |   | ♛ |   |   |   | 3
;; ---+---+---+---+---+---+---+---+---+---
;;  2 |   |   |   |   |   |   | ♛ |   | 2
;; ---+---+---+---+---+---+---+---+---+---
;;  1 | ♛ |   |   |   |   |   |   |   | 1
;; ---+---+---+---+---+---+---+---+---+---
;;      A   B   C   D   E   F   G   H
;;
;; -->  (#(2 5 1 4 7 0 6 3)
;;       #(2 4 7 3 0 6 1 5)
;;       #(2 4 1 7 0 6 3 5)
;;       #(1 6 4 7 0 3 5 2)
;;       #(1 6 2 5 7 4 0 3)
;;       #(1 5 7 2 0 3 6 4)
;;       #(1 5 0 6 3 7 2 4)
;;       #(1 4 6 3 0 7 5 2)
;;       #(1 4 6 0 2 7 5 3)
;;       #(1 3 5 7 2 0 6 4)
;;       #(0 5 7 2 6 3 1 4)
;;       #(0 4 7 5 2 6 1 3))

;;;; THE END ;;;;```
ViewGit