%% checkdepth([[1,1,white],[1,-1,white],[-1,-1,white],[-1,1,white]],[[0,1,red],[0.7,0.7,red],[0,-1,red]],apple,Depth) :- %% Depth = apple_in_hand ; checkdepth(Item1,Item2,apple,apple_in_hand) :- checkdepth(Item1,Item2). checkdepth([[X2,Y2,_],_,[X1,Y1,_],_],Item2) :- checkcoord([X1,Y1,X2,Y2],Item2). checkcoord(_,[]). checkcoord([X1,Y1,X2,Y2],[[X,Y,_]|Coords]) :- X1=