Blob


1 (defun make-position (row col)
2 (cons row col))
3 (defun position-row (pos)
4 (car pos))
5 (defun position-col (pos)
6 (cdr pos))
7 (defun positions-equal (a b)
8 (equal a b))
9 (defvar empty-board '())
10 (defun adjoin-position (row col positions)
11 (append positions (list (make-position row col))))
12 (defun attacks? (a b)
13 (let ((a-row (position-row a))
14 (a-col (position-col a))
15 (b-row (position-row b))
16 (b-col (position-col b)))
17 (cond
18 ((= a-row b-row) t)
19 ((= a-col b-col) t)
20 ((= (abs (- a-col b-col))
21 (abs (- a-row b-row)))