
%  Initial State  

on(a,f,s0). ontable(f,s0).
ontable(e,s0).
ontable(b,s0).
ontable(c,s0).
ontable(d,s0). 
clear(a,s0). clear(e,s0). clear(b,s0). clear(c,s0). clear(d,s0). 

%  Goal  

goal(S) :-  on(e,f,S), on(f,c,S), on(c,b,S),
	on(b,a,S), on(a,d,S), ontable(d,S).
	
%  Good towers. 

goodTower(e,S) :- on(e,f,S), goodTower(f,S).
goodTower(f,S) :- on(f,c,S), goodTower(c,S).
goodTower(c,S) :- on(c,b,S), goodTower(b,S).
goodTower(b,S) :- on(b,a,S), goodTower(a,S).
goodTower(a,S) :- on(a,d,S), goodTower(d,S).
goodTower(d,S) :- ontable(d,S). 

