%% Test %% **** %% ** %% is stable %% Assume a single region and a single line at each level. %% 1. Find x co-ordinates of the base %% 2. Find number of blocks on each side %% 3. Return whether the number of blocks on each side is the same %% test([[[0,1],'*'],[[1,1],'*'],[[2,1],'*'],[[3,1],'*'],[[0,0],' '],[[1,0],'*'],[[2,0],'*'],[[3,0],' ']],0,3,0,1). %%test(Map,XMin,XMax,YMin,YMax) :- %% findbase(Map,XMin,XMax,0,[],Base), findbase1(Pixels,X,X,_Y1,Base,Base) :- findbase2(Pixels,X,X,_Y2,Base,Base). findbase1(Pixels,X,XMax,Y,Base1,Base2) :- findbase2(Pixels,X,XMax,Y,Base1,Base2). findbase2([Pixel|Pixels],X1,XMax,Y,Base1,Base2) :- Pixel = [Coords, '*'], Coords = [X1, Y], append(Base1,[X1],Base3), X2 is X1 + 1, findbase2(Pixels,X2,XMax,Y,Base3,Base2). /** findbase1([Pixel|Pixels],X1,XMax,Y,Base1,Base2) :- Pixel = [Coords, ' '], Coords = [X1, Y], X2 is X1 + 1, findbase1(Pixels,X2,XMax,Y,Base1,Base2),!. findbase1([Pixel|Pixels],X1,XMax,Y1,Base1,Base2) :- Pixel = [Coords, _Symbol], Coords = [X2, Y2], notsame(X1,X2,Y1,Y2), findbase1(Pixels,X1,XMax,Y1,Base1,Base2). notsame(X1,X2,_Y1,_Y2) :- not(X1=X2). notsame(_X1,_X2,Y1,Y2) :- not(Y1=Y2). **/