Dear all ,
I need your help on this. I will say how I am thinking the solution and any help will be much aprreciated.
I will denote the husbands with the following notations h1 = 11, h2=12, h3=13 and their respective wives with the numbers w1 = 21, w2 = 22, w3 = 23. I will represent the boat being at the left side with the number 0 and being at the right side of the river demoted by 1.
So the notations will be as follows:
The initial state can be described as follows:
[(People on Left Side), (People on Right Side), (Location of the boat)]
Initial State: [(11 21 12 22 13 23), (empty), (0)]
Goal State: [(empty), (11 21 12 22 13 23), (1)]
Couples: couple 1 = h1w1, couple2 = h2w2, couple 3 = h3w3
Operators: The following operators can be added to the (People on the right side list) if the boat is at the right side of the river and subtracted from that list and added to the list people on the Left Side if the boat is moving to the left side of the river.
1st operator: Take two wife’s at the other side. Depending where is the boat add or subtract from the two banks (People on the Left side) and (People on the right side). When the boat moves from left to right I add to the (People on the right side) the people I am moving from the (People on the Left side) and vice versa. The 3 possible combinations are shown below:
1. [(21 22)] = w1w2
2. [(21 23)] = w1w3
3. [(22 23)] = w2w3
2nd t operator: Take one woman to the other side. Depending where is the boat add or subtract from the two banks (People on the Left side) and (People on the right side). When the boat moves from left to right add to the (People on the right side) the people I am moving from the (People on the Left side) and vice versa. The 3 possible combinations are shown below:
1. [(21)] = w1
2. [(22)] = w2
3. [(23)] = w3
3rd operator: Take a couple at the other side. Depending where is the boat add or subtract from the two banks (People on the Left side) and (People on the right side). When the boat moves from left to right I add to the (People on the right side) the people I am moving from the (People on the Left side) and vice versa. The 3 possible combinations are shown below:
1. [(11 21)]= h1w1
2. [(12 22)] = h2w2
3. [(13 23)] = h3w3
I will create legal states functions and then how I am going to implement it using linked lists?