;; Exercise 2.42 ;; ;; The "eight-queens puzzle" asks how to place eight queens on a ;; chessboard so that no queen is in check from any other (i.e., no ;; two queens are in the same row, column, or diagonal). One possible ;; solution is shown in figure 2.8. One way to solve the puzzle is to ;; work across the board, placing a queen in each column. Once we have ;; placed k - 1 queens, we must place the kth queen in a position ;; where it does not check any of the queens already on the board. We ;; can formulate this approach recursively: Assume that we have ;; already generated the sequence of all possible ways to place k - 1 ;; queens in the first k - 1 columns of the board. For each of these ;; ways, generate an extended set of positions by placing a queen in ;; each row of the kth column. Now filter these, keeping only the ;; positions for which the queen in the kth column is safe with ;; respect to the other queens. This produces the sequence of all ways ;; to place k queens in the first k columns. By continuing this ;; process, we will produce not only one solution, but all solutions ;; to the puzzle. ;; ;; We implement this solution as a procedure queens, which returns a ;; sequence of all solutions to the problem of placing n queens on an ;; n× n chessboard. Queens has an internal procedure queen-cols that ;; returns the sequence of all ways to place queens in the first k ;; columns of the board. ;; ;; (define (queens board-size) ;; (define (queen-cols k) ;; (if (= k 0) ;; (list empty-board) ;; (filter ;; (lambda (positions) (safe? k positions)) ;; (flatmap ;; (lambda (rest-of-queens) ;; (map (lambda (new-row) ;; (adjoin-position new-row k rest-of-queens)) ;; (enumerate-interval 1 board-size))) ;; (queen-cols (- k 1)))))) ;; (queen-cols board-size)) ;; In this procedure rest-of-queens is a way to place k - 1 queens in ;; the first k - 1 columns, and new-row is a proposed row in which to ;; place the queen for the kth column. Complete the program by ;; implementing the representation for sets of board positions, ;; including the procedure adjoin-position, which adjoins a new ;; row-column position to a set of positions, and empty-board, which ;; represents an empty set of positions. You must also write the ;; procedure safe?, which determines for a set of positions, whether ;; the queen in the kth column is safe with respect to the ;; others. (Note that we need only check whether the new queen is safe ;; -- the other queens are already guaranteed safe with respect to ;; each other.) ;; ;; ------------------------------------------------------------------- ;; ;; Hmmm. ;; ;; I've made a few changes to their spec. ;; ;; Since printing the board is done row by row top to bottom, rather ;; than putting one queen per column, I'll put one queen per row, and ;; use a representation like this : ;; ;; . . . . . * . . column = 6 ;; . . * . . . . . 3 1 = left column ;; * . . . . . . . 1 8 = right column ;; . . . . . . * . 7 ;; . . . . * . . . 5 ;; . . . . . . . * 8 ;; . * . . . . . . 2 ;; . . . * . . . . 4 ;; ;; For this position, queens = (6 3 1 7 5 8 2 4) . ;; And since its simplest in scheme to grow a list to the left, ;; I'll start with the rightmost queen and grow leftwards. ;; ;; So the board above is valid because all of these are true : ;; ;; (safe? (list 4)) 4 doesn't conflict with anything above it ;; (safe? (list 2 4)) ...neither does 2 ;; (safe? (list 8 2 4)) ... and so on ;; ... down to ;; (safe? (list 6 3 1 7 5 8 2 4)) ... which checks to see if 6 is ok. ;; ;; To check all n of them, I've defined an (all-safe? queens) ;; function, which checks all of those listed above. And to display a ;; position, I also have set up (print-board queens). ;; -- functions from the textbook. (define (enumerate-interval low high) (if (> low high) nil (cons low (enumerate-interval (+ low 1) high)))) (define (accumulate op initial sequence) (if (null? sequence) initial (op (car sequence) (accumulate op initial (cdr sequence))))) (define (flatmap proc seq) (accumulate append nil (map proc seq))) ;; -- empty board is just an empty list. (define empty-board nil) ;; -- to add a new queen position, just cons it to the front of the list. (define (adjoin-position new-queen rest-of-queens) (cons new-queen rest-of-queens)) ;; OK, here is the main function, which was called "queens" in the ;; problem description, with a few name changes that made more sense ;; to me, and with some k arguments removed that weren't needed. (define (make-queens board-size) (define (make-queens-upto k) (if (= k 0) (list empty-board) (filter (λ (positions) (safe? positions)) (flatmap (λ (rest-of-queens) (map (λ (new-queen) (adjoin-position new-queen rest-of-queens)) (enumerate-interval 1 board-size))) (make-queens-upto (- k 1)))))) (make-queens-upto board-size)) ;; --- testing and debugging --- (define debug false) (define (safe? queens) ;; true if the leftmost queen is not on the same column or diagonal ;; as the other queens. (define (ok? offset remaining) (let ((queen-0 (car queens))) (if debug (printf " debug ok? queen0=~a offset=~a remaining=~a \n" queen-0 offset remaining)) (if (null? remaining) true (let ((queen-n (car remaining))) (and (not (equal? queen-0 queen-n)) ; vertical (not (equal? offset (abs (- queen-0 queen-n)))) ; diagonal (ok? (+ 1 offset) (cdr remaining))))))) ;(display queens) (newline) (ok? 1 (cdr queens))) ;; -- test safe? and all-safe? and print-board -- (define (test-safe queens) (let ((result (safe? queens))) (printf "(safe? ~a) is ~a.\n" queens result))) ;; . . * . 1 ;; * . . . 2 (3 1 4 2) 3 is ok, i.e. no conflict with 1 or 4 or 2. ;; . . . * 3 ;; . * . . 4 (assert (safe? (list 3 1 4 2))) ;; . . * . 1 ;; . . . * 2 (3 4 2 2) 3 is not OK : 4 on diagonal ;; . * . . 3 ;; . * . . 4 (assert (not (safe? (list 3 4 2 2)))) ;; . . * . 1 ;; * . . . 2 (3 1 1 1) 3 is not ok : 1 on diagonal ;; * . . . 3 ;; * . . . 4 (assert (not (safe? (list 3 1 1 1)))) ;; . . * . 1 ;; * . . . 2 (3 1 3 4) 3 is not ok : 3 on vertical ;; . . * . 3 ;; . . . * 4 (assert (not (safe? (list 3 1 3 4)))) (if debug (begin (test-safe (list 3 1 4 2)) (test-safe (list 3 4 2 2)) (test-safe (list 3 1 3 4)) (test-safe (list 3 1 1 1)))) ;; with debug = true : ; (safe? (3 1 4 2)) is #t. ; debug ok? queen0=3 offset=1 remaining=(4 2 2) ; (safe? (3 4 2 2)) is #f. ; debug ok? queen0=3 offset=1 remaining=(1 3 4) ; debug ok? queen0=3 offset=2 remaining=(3 4) ; (safe? (3 1 3 4)) is #f. ; debug ok? queen0=3 offset=1 remaining=(1 1 1) ; debug ok? queen0=3 offset=2 remaining=(1 1) ; (safe? (3 1 1 1)) is #f. (define (all-safe? queens) ;; check to see that none of the n queens conflict with each other. (if (null? queens) true (and (safe? queens) (all-safe? (cdr queens))))) (define (test-all-safe queens) (let ((result (all-safe? queens))) (printf "(all-safe? ~a) is ~a.\n" queens result))) (define (print-row n queen) (define (print-one col) (if (not (> col n)) (begin (if (equal? col queen) (display " *") (display " .")) (print-one (+ col 1))))) (print-one 1) (newline)) (define (print-board queens) (define (print-loop remaining) (if (not (null? remaining)) (begin (print-row (length queens) (car remaining)) (print-loop (cdr remaining))))) (print-loop queens) (newline)) (define example-board (list 6 3 1 7 5 8 2 4)) (assert (all-safe? example-board)) ;(test-all-safe example-board) ;(print-board example-board) ; ---------------------------------------- ;; see https://en.wikipedia.org/wiki/Eight_queens_puzzle ;; with n = 8, 92 is the correct number of solutions. (define (print-solution n) (let ((boards (make-queens n))) (printf "--- with n = ~a found ~a solutions ---\n\n" n (length boards)) (for-each print-board boards))) (print-solution 4) (newline) (print-solution 5) (newline) (print-solution 8) (newline) ;; $ schemeg 2_42.scm ;; --- with n = 4 found 2 solutions --- ;; . . * . ;; * . . . ;; . . . * ;; . * . . ;; . * . . ;; . . . * ;; * . . . ;; . . * . ;; --- with n = 5 found 10 solutions --- ;; . . . * . ;; . * . . . ;; . . . . * ;; . . * . . ;; * . . . . ;; . . * . . ;; . . . . * ;; . * . . . ;; . . . * . ;; * . . . . ;; . . . . * ;; . . * . . ;; * . . . . ;; . . . * . ;; . * . . . ;; . . . * . ;; * . . . . ;; . . * . . ;; . . . . * ;; . * . . . ;; . . . . * ;; . * . . . ;; . . . * . ;; * . . . . ;; . . * . . ;; * . . . . ;; . . . * . ;; . * . . . ;; . . . . * ;; . . * . . ;; . * . . . ;; . . . . * ;; . . * . . ;; * . . . . ;; . . . * . ;; * . . . . ;; . . * . . ;; . . . . * ;; . * . . . ;; . . . * . ;; . . * . . ;; * . . . . ;; . . . * . ;; . * . . . ;; . . . . * ;; . * . . . ;; . . . * . ;; * . . . . ;; . . * . . ;; . . . . * ;; --- with n = 8 found 92 solutions --- ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . . . * . . . ;; * . . . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . * . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . . . * . . . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . * . . . . . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . * . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . * . . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . * . . . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . * . . . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . * . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . . . * ;; . . * . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; * . . . . . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . . . * . . . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . . . * . . . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . * . . ;; * . . . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . * . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . . . * ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . . . * . . . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . . * . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . * . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . * . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . . . * ;; . . * . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . . * ;; . . . * . . . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . * . . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . * . . . . . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . * . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . * . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . * . . ;; . . . * . . . . ;; * . . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . * . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . * . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . * . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; * . . . . . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . . . . . . * ;; . . . * . . . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . * . . ;; . * . . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . * . . . ;; . . . . . . . * ;; . . . . . * . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . . . . . * . . ;; * . . . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . * . . . . . ;; . . . . . . * . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . . . * . . ;; . . . . . . . * ;; . * . . . . . . ;; . . . * . . . . ;; . . . . . . * . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; . . . . . * . . ;; . . * . . . . . ;; . . . . * . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . . * . . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . . . * . . ;; . . . * . . . . ;; . . . . . . * . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . . . * ;; . . . * . . . . ;; . . . . . . * . ;; . . . . * . . . ;; . * . . . . . . ;; . . . . . * . . ;; * . . . . . . . ;; . . * . . . . . ;; . . . . . . . * ;; . . . . * . . . ;; . . . . . . * . ;; . * . . . . . . ;; . . . . . * . . ;; . . * . . . . . ;; * . . . . . . . ;; . . . * . . . . ;; . . . . . . . *