monkeys banana problem
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)
Grasp the banana if standing on the box directly under the banana.
Answers code:
move(state(middel, onbox, middle, hasnot),
grasp,
state(middle, onbox, middle, has)).
move(state(P, onfloor, P, H),
climb,
state(P, onbox, P, H)).
move(state(P1, onfloor, P1, H),
push(P1, P2),
state(P2, onfloor, P2, H)).
move(state(P1, onfloor, B, H),
walk(P1, P2),
state(P2, onfloor, B, H)).
canget(state(_,_,_,has)).
canget(State1) :-
move(State1, Move, State2),
canget(State2).
No comments:
Post a Comment
Don't forget to Reply if you like my post.
If you don't Reply Post will Die........