%%% File: attack_and_break %%% Line: This cat tries to attack and break everything he sees %%% https://soundcloud.com/catbossstudio/break-everyone-kill-everything %% Facts ... % break(N,level(L),size(S)) :: N is the name of the objects that this cat want to break, level L is the indicator on how hard this object to break and size S. Cat can't break stuff bigger than large or above level 5 break(vase,level(1),size(small)). break(tv,level(3),size(extra_large)). break(lamp,level(8),size(large)). break(cushion,level(5),size(medium)). break(toilet_paper,level(1),size(small)). % attack(N,catch(C),size(S)) :: This cat wants to attack everyone, N is the name of the poor thing with C means how hard for the cat to catch and S for the size of the victim, cat can't attack things bigger than medium and unable to catch things above 5 attack(bird,catch(8),size(small)). attack(bug,catch(2),size(small)). attack(hellhound,catch(6),size(large)). attack(maillman,catch(3),size(extra_large)). attack(lasagna,catch(1),size(medium)). %% Rules ... % break :: these are stuff cat wants to break break :- break(Name,_,_),write(Name),nl,fail. break. % attack :: there are thins cat wants to attack attack :- attack(Name,_,_),write(Name),nl,fail. attack. % world :: objects in the cat's world world :- break,attack. % humongous :: cat thinks they are huge! humongous(Name) :- break(Name,_,size(extra_large)). humongous(Name) :- attack(Name,_,size(extra_large)). humongous. % tiny :: cat doesn't notice them sometime tiny(Name) :- break(Name,_,size(small)). tiny(Name) :- attack(Name,_,size(small)). tiny. % breakable :: stuff cat can break breakable(Name) :- break(Name,level(L),size(S)),(L=<5,S\=extra_large). % attackable :: stuff cat can attack attackable(Name) :- attack(Name,catch(C),size(S)),(C=<5,S\=extra_large,S\=large). % play :: cat plays with Name play :- breakable(Name),write(Name),nl,fail. play :- attackable(Name),write(Name),nl,fail. play.