:-dynamic(on/2). % allows us to retract facts defined in a file.
on(a,c).
on(a,d).
on(b,d).
on(c,e).
on(c,f).
on(d,f).
on(d,g).
on(e,floor).
on(f,floor).
on(g,floor).

clean :-
	on(Block,_), \+on(_,Block),
	format('Remove ~w\n', Block),
	retractall(on(Block,_)), clean, !.
clean :- \+on(_,_).
