Solution of Nizamettin Korkmaz
(define (put-a-knight k uncovered-list possible-knight)
(if (or (and (= k 0) (not (empty? uncovered-list)))
(empty? possible-knight) ;; if the number of uncovered squares
(> (count uncovered-list) (* 9 k));; is greater than 9 times the number
) ;; of the unused knights
'olmaz!!! ;; it will stop trying...........
(let ((first-possible
(knight (- k 1) (uncovered (first possible-knight) uncovered-list)
(bf possible-knight))))
(if (equal? first-possible 'olmaz!!!)
(put-a-knight k uncovered-list (bf possible-knight))
(se (first possible-knight) first-possible)))))
(define (knight k uncovered-list possible-knight)
(if (empty? uncovered-list)
'()
(put-a-knight k uncovered-list possible-knight)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (tehdit-et yer)
(let ((ilk-digit (first yer)) (son-digit (last yer)))
(keep (lambda(j)
(and (not (member? '- j))
(not (member? 0 j))
(= (count j) 2)))
(se yer
(word (+ ilk-digit 2) (+ son-digit 1)) ;;tehdit-et gives the places
(word (+ ilk-digit 2) (- son-digit 1)) ;;which are attacked by the
(word (+ ilk-digit 1) (+ son-digit 2)) ;;knight and the place of knight
(word (+ ilk-digit 1) (- son-digit 2))
(word (- ilk-digit 2) (+ son-digit 1))
(word (- ilk-digit 2) (- son-digit 1))
(word (- ilk-digit 1) (- son-digit 2))
(word (- ilk-digit 1) (+ son-digit 2))
)
)
))
;;;;;;;;;;;;;;;;;;;; These 2 functions forms the board ;;;;;;;;;;;;;;
(define (empty-board r c)
(if (= r 0) '()
(se (empty-board (- r 1) c) (empty-row r c) )))
(define (empty-row r c)
(if (= c 0) '()
(se (empty-row r (- c 1)) (word c r) )))
;;;; It gives the uncovered-places after puting one knight on the board ;;;;
(define (uncovered q uncovered-list)
(let ((m (tehdit-et q)))
(keep (lambda(j) (not (member? j m))) uncovered-list)
)
)
;;;; It gives the converts the numbers into alphabethical characters
(define (cover n k)
(let ((sayilar (knight k (empty-board n n) (empty-board n n)))
(harfler '(a b c d e f g h i)))
(cond ((equal? sayilar 'olmaz!!!) '())
(else (every (lambda(l) (word (item (first l) harfler) (last l)))
sayilar)))))