[proj3].

plan_transport( [ [ farmer, fox, chicken, grain ], [] ],
                [ [], [ farmer, fox, chicken, grain ] ],
                [ [ fox, chicken ],
                  [ chicken, grain ],
                  [ fox, chicken, grain ] ],
                [ farmer ],
                7,
                Plan ).
;;


plan_transport( [ X, [] ],
                [ [ farmer, fox, chicken, grain ], [] ],
                [ [ fox, chicken ],
                  [ chicken, grain ],
                  [ fox, chicken, grain ] ],
                [ farmer ],
                2,
                Plan ).

plan_transport( Initial_State,
                [ [ farmer, fox, chicken, grain ], [] ],
                [ [ fox, chicken ],
                  [ chicken, grain ],
                  [ fox, chicken, grain ] ],
                [ farmer ],
                2,
                [[go_right, farmer]] ).


plan_transport( [ [ farmer, fox, chicken, grain ], [] ],
                Final_State,
                [ [ fox, chicken ],
                  [ chicken, grain ],
                  [ fox, chicken, grain ] ],
                [ farmer ],
                2,
                Plan ).

plan_transport( Initial_State,
                [ [], [ farmer, fox, chicken, grain ] ],
                [ [ fox, chicken ],
                  [ chicken, grain ],
                  [ fox, chicken, grain ] ],
                [ farmer ],
                2,
                [[go_left, farmer]] ).


% 1
plan_transport([[farmer, fox, chicken, grain], []], [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 7, P).

% 2!
plan_transport(IS, GS, I, D, M, P).

% 3 !
plan_transport([[farmer, fox, chicken, grain], []], [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], foo, P).

% 4!
plan_transport([[farmer, fox, chicken, grain], []],  [[], [farmer, fox, chicken, grain]], foo, [farmer], 7, P).

% 5
plan_transport([[farmer, fox, chicken, grain], []], [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 10, P).

% 6
plan_transport(IS, [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 8, [[go_right, chicken, farmer], [go_left, farmer], [go_right, farmer, grain], [go_left, chicken, farmer], [go_right, farmer, fox], [go_left, farmer], [go_right, chicken, farmer]]).

% 7
plan_transport([[farmer, fox, chicken, grain], []], G, [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 2, P).

% 8
plan_transport([[farmer, fox, chicken, grain], []], [[farmer, fox, chicken, grain], []], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 2, P).

% 9!
plan_transport([[farmer, fox, chicken, grain], []], [[farmer, fox, chicken, grain], []], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], D, 2, P).

% 10!
plan_transport([[farmer, fox, chicken, grain], []], [[farmer, fox, chicken, grain], []], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], foo, 2, P).

% 11!
plan_transport([[farmer, fox, chicken, grain], []],  [[farmer, fox, chicken, grain], []],  [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], -1, P).

% 12
plan_transport(GS, [[farmer, fox, chicken, grain], []], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 2, [[go_right, farmer]]).

% 13
plan_transport([[farmer, fox, chicken, grain], []], G, [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 2, P).

% 14
plan_transport(IS, [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 2, [[go_left, farmer]]).

% 15
plan_transport(IS, [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 2, P).

% 16!
plan_transport([[farmer, fox, chicken, grain], [chicken]], [[], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 10, P).

% 17
plan_transport([[farmer, fox, chicken, grain], []], [[chicken], [farmer, fox, chicken, grain]], [[fox, chicken], [chicken, grain], [fox, chicken, grain]], [farmer], 10, P).