Implementation of Monkey Banana Problem using PROLOG.

  Implementation of Monkey Banana Problem using PROLOG.

Description : Monkey -Banana Problem

The Monkey-Banana Problem can be stated as follows.

There is a monkey at the door into a room. In the middle of the room a banana is hanging from the ceiling. The monkey is hungry and wants to get the banana, but he cannot stretch high enough from the floor. At the window of the room there is a box the monkey may use. The monkey can perform the following actions: walk on the floor, climb the box, push the box around (if it is already at the box) and grasp the banana if standing on the box directly under the banana. Can the monkey get the banana?









in(monkey,room). in(chair,room). at(monkey,floor). at(banana,ceiling). at(chair,floor). strong(monkey). grasp(monkey). climb(monkey,chair). push(monkey,chair):-strong(monkey). under(chair,banana):-push(monkey,chair). canreach(monkey,banana):-at(banana,floor);at(banana,ceiling),under(chair,banana),climb(monkey,chair). canget(monkey,banana):-canreach(monkey,banana),grasp(monkey). code-box


OutPut :

- canget(monkey, banana).

true.

?- canget(X,Y).

X = monkey,

Y = banana.

?- canget(X, banana).

X = monkey.

?- canget(monkey, apple).

false.

?-


0/Post a Comment/Comments

Thanks, for contacting us.
We will reviewing us on your comments . Please wait an hour.
Air Reality Team....

Previous Post Next Post