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 that the monkey can use. The monkey can perform the following actions: walk on the floor, climb the box, push the box around (if he is already at it), and grasp the banana if he is standing on the box and directly underneath the banana.
Can the monkey grasp the banana?
Answer the question by writing a Prolog Program.
2. Water Jug Problem.
There are two water jugs with capacities of 4 litres and 3 litres respectively. Neither have any measuring markers on them. The water jugs are both initially empty. One can fill the water jugs with water completely or partially. One can empty completely or partially filled jugs both completely or partially. One can transfer the content (water) of one jug (partially or completely} to another jug. Write Prolog program that outputs the steps to get exactly 2 litres of water in 4 litres jug.
3. Missionaries and Cannibals Problem.
Three missionaries and three cannibals must cross a river using a boat which can carry at most two people, under the constraint that, for both banks, if there are missionaries present on the bank, they cannot be outnumbered by cannibals (if they were, the cannibals would eat the missionaries). The boat cannot cross the river by itself with no people on board. Write a Prolog program to write the steps to illustrate how can missionaries and cannibals can cross the river?
4. Tiger, Goat and Cabbage Problem.
A man is traveling with a tiger, a goat, and a cabbage. We have no idea why he would be travelling with such a strange assortment, but there he is anyway. At one point in his journey he comes to a river which is too deep to wade across, and too wide to swim across so he is in a quandary on how to continue. He notices a small boat tied to the near shore, but the boat is too small to fit all his belongings into, but it is large enough so that he can safely row across with one belonging at a time.
The problem is that if he rows across with the tiger first, then the goat will eat the cabbage, and if he rows across with the cabbage first, the tiger will eat the goat.
How can he safely cross the river with all his things intact? Write a Prolog program to illustrate the steps.