3 ms·
I suggested using Prolog in the comments. His problem description was not quite good enough for me to assess whether or not Prolog will be a good choice, but at
by exDM69 14y ago
I suggested using Prolog in the comments. His problem description was not quite good enough for me to assess whether or not Prolog will be a good choice, but at least it's a candidate.
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 :)
- cartosys 14y agoAnd we're waiting for a link.
- exDM69 14y agoThere you go: http://programmers.stackexchange.com/a/165126/65434 http://programmers.stackexchange.com/a/165126/65434
- bumbledraven 14y agoGood answer. Nice to see the original questioner accepted it. To take it a bit further, so-called "answer set solvers" like clasp (http://potassco.sourceforge.net/ http://potassco.sourceforge.net/) provide a fast way to run these kinds of logic programs.