;;the function no - test
(defun no-test()
(list '(2 2) 0 nil))
;; the function operators
(defun operators()
(list 'empty-a 'empty-b))
;; the function create node
(defun create-node (bucket &optional (g 0) (father nil))
(list bucket g father))
;; the function dfs
(defun dfs (no sucessors)
(list (append no (car sucessors))))
;; the function bfs
(defun bfs (no sucessors)
(list (append (car sucessors) no)))
;;operator empty-a
(defun empty-a (state)
(cond ((> (car state) 0)
(list 0 (cadr state)))))
;; operator empty-b
(defun empty-b (state)
(cond ((> (cadr state) 0)
(list (car state) 0))))
;; the function sucessors
(defun sucessors (no operator algoritm depth)
(cond
((equal algoritm 'bfs)
(loop for x in operator
do (sucessors-aux1 no x)))
((equal algoritm 'dfs)
(loop for y in operator
do (sucessors-aux1 no y)))
(t (sucessors no operator algoritm depth))))
;; the function sucessors aux1
(defun sucessors-aux1 (no operator)
(print operator);; to show operator
(cond
((create-node
(funcall (symbol-function operator) (first no))
(+ (second no) 1) no))
(t (sucessors-aux1 no operator))))
(print "--- Test Empty-A ---")
(print (sucessors-aux1 (no-test) 'empty-a))
(terpri)
(print "--- Test Empty-B ---")
(print (sucessors-aux1 (no-test) 'empty-b))
(terpri)
(print "--- Test All Operators ---")
(sucessors (no-test) (operators) 'bfs nil)
(sucessors (no-test) (operators) 'dfs 2)