Created
January 18, 2018 12:23
-
-
Save KennethMurugu/08b874fe054b81ed0333a8f6856c95e3 to your computer and use it in GitHub Desktop.
Prolog solution to monkey-banana problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Facts | |
is_at(monkey, door). | |
is_at(box, window). | |
is_at(banana, middle). | |
hungry(monkey). | |
%Rules | |
grasp(monkey, banana):- hungry(monkey), climb(monkey, box), is_at(banana, middle). | |
climb(monkey, box) :- is_at(monkey, box, middle). | |
is_at(monkey, box, middle) :- push(monkey, box, middle). | |
push(monkey, box, middle) :- is_at(box, window), is_at(monkey, window). | |
is_at(monkey, window) :- walk_to(monkey, window). | |
walk_to(monkey, window) :- is_at(monkey, L), L \= window. | |
I also would like to know how to formulate it on console
write consult code too
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what do i write in the console