by exDM69 · 14y ago · 0 comments
A Prolog program is essentially a list of rules that are written as an implication. Something like:
moves_to(Cow, Location) :-
hungry(Cow),
current_location(Cow, OldLoc),
food_in(OldLoc, OldFood), food_in(Location, Food),
Food > OldFood.
In human language: a cow moves to a location if it's hungry and there's more food in that location than in current location.I should probably write a proper answer.
edit: Added a proper answer to the stackoverflow with an almost complete introductory Prolog example. It's waiting for your upvotes :)