the problem is ; we have a funtion take 3 argument, like; func ( [[0, 0, 0, 1, 0], [0, 1, 1, 1, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0]], (1, 1), X ) the first one is nested list, which is show 5x5 matrix and 1s means it is full, 0 means empty and, the second parameter (1,1) our starting point 1st row 1st column, the 3rd parameter X is ; variable that we will unify with the points that are accessible from the starting point which is (1,1) so if asked;
?- func ( [ [0,0,0,1] [0,0,1,0] [0,0,1,1] [0,0,1,0] ], (1,1), X).
output is:
X = (1, 1);
X = (1, 2);
X = (1, 3);
X = (2, 2);
X = (3, 2);
X = (4, 1);
X = (4, 2);
false.
when we start from (1,1) we can move up, down, left and right; since no left and up movement while on (1,1) look right if empty, write it, look down empty write down, go the (1,2) again, move right or left or up or down, and so on.
here the reason why we didnot write the outputs, (2,4) (4,4) if for example point (2,3) is full and (2,4) is empty we look that can we go point (2,4) one by one, I mean, if left , up and down of them is full, we can't go point (2,4) using this point, since they are full.
I try to explain the problem. If there is a question please write?
I wait for the possible solutions or algorithms;) thanks