Puzzle | River Crossing

4.3

Aside the river there is 1 policeman, 1 robber, 1 blond hair woman and her 2 children and 1 red hair woman and her 2 children. There is a boat having a carrying capacity of a maximum of 2 people. Only adults can sail but not the kids. Please help all people to move across the river, knowing that if the policeman is absent, the robber will kill all people there. If the blond hair woman is absent, the red hair woman will beat the blond hair woman’s children (and vice versa).
Problem Figure :
river puzzle 1 (1)
Sulotion Steps:

    Step 1 :
    Let us suppose some basic assumption : 
    Let the right island = A and left island = B,
    Blond hair woman and her children be BW, B1 and B2,
    Red hair woman and her children be RW, R1 and R2.
    

    Pick Policeman and thief from island A into boat and sail to island B.
    river puzzle 1 (2)

    Step 2 :
    Drop Thief on island B and come back to island A with police.
    river puzzle 1 (3)

    Step 3 :
    Now, Put one of blond children B1 along with police in boat and sail to B.
    river puzzle 1 (4)

    Step 4 :
    Drop B1 to island B and come back to island A along with policeman and thief.
    river puzzle 1 (5)

    Step 5 :
    Drop Policeman and Thief to island A and put Blond women BW along with her second children B2 into boat and sail to island B.
    river puzzle 1 (6)

    Step 6 :
    Put B2 at island B and sail back to island A with women BW.
    river puzzle 1 (7)

    Step 7 :
    Put red hair women RW in boat along with BW and sail to island B.
    river puzzle 1 (8)

    Step 8 :
    Drop blond women BW at island B and sail back to island A with red hair women RW.
    river puzzle 1 (9)

    Step 9 :Put off red hair woman RW back to island A. Put thief and policeman back into boat and sail to island B.
    river puzzle 1 (10)

    Step 10 :
    Drop Policeman and thief at island B and sail to island A with Blond women BW.
    river puzzle 1 (11)

    Step 11 :
    Put Red hair women RW in boat with BW and sail to island B.
    river puzzle 1 (12)

    Step 12 :
    Drop BW to Island B and sail back to island A with RW only.
    river puzzle 1 (13)

    Step 13 :
    Put one of children of red hair women R1 into boat along with red hair women RW and sail to island B.
    river puzzle 1 (14)

    Step 14 :
    Put off both RW and R1 to island B and sail to island A with policeman and thief in boat.
    river puzzle 1 (15)

    Step 15 :
    Put thief back on island A and put last children R2 into boat along with police and sail to island B.
    river puzzle 1 (16)

    Step 16 :
    Put R2 on island B and sail to island A with policeman alone.
    river puzzle 1 (18)

    Step 17 :
    Put thief back in boat so that island A became empty and sail to island B.
    river puzzle 1 (19)

    Step 18 :
    Here, you have reached island B with every person without breaking any of given the rule.
    river puzzle 1 (20)

    Game Source : River Crossing

    This article is contributed by Shivam Pradhan (anuj_charm). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

    GATE CS Corner    Company Wise Coding Practice

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:



4.3 Average Difficulty : 4.3/5.0
Based on 6 vote(s)










Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.