% Prolog Clauses for a Simple Blocks World % Action Precondition Axioms. poss(move(X,Y),S) :- clear(X,S), clear(Y,S), not X = Y. poss(moveToTable(X),S) :- clear(X,S), not ontable(X,S). % Successor State Axioms. clear(X,do(A,S)) :- (A = move(Y,Z) ; A = moveToTable(Y)), on(Y,X,S) ; clear(X,S), not A = move(Y,X). on(X,Y,do(A,S)) :- A = move(X,Y) ; on(X,Y,S), not A = moveToTable(X), not A = move(X,Z). ontable(X,do(A,S)) :- A = moveToTable(X) ; ontable(X,S), not A = move(X,Y). % Primitive Action Declarations. primitive_action(move(X,Y)). primitive_action(moveToTable(X)).