(defun el_in (x y lst) (cond ((NULL lst) 0) ((and (eql (car(car lst)) x) (eql(car(cdr(car lst))) y)) 1 ) ( 1 (el_in x y (cdr lst)) ) ) ) (defun el_bit (x y lst) (cond ((NULL lst) 0) ((and (eql (abs (-(car(car lst)) (car(cdr(car lst))))) (abs(- x y)))) 1) ( 1 (el_bit x y (cdr lst)) ) ) ) (defun find_pos1 (lst_el state) (cond ( (eql (length lst_el) 4) (print lst_el)) ( 1 (setq nx 0) (setq ny 0) (loop (setq nx (+ nx 1)) (loop (setq ny (+ ny 1)) (cond ((AND (eql (el_in nx ny lst_el) 0) (eql (el_bit nx ny lst_el) 0)) (push nx state) (push ny state) (find_pos1 (cons(list nx ny) lst_el) state) (setq ny (pop state)) (setq nx (pop state)) ) ) ((> ny 3) (setq ny 0) NULL) ) ((> nx 3) NULL) ) ) ) ) (defun solve() (find_pos1) )