% check if 2 squares colide sides col( x, y, s, x2, y2, s2):- endx x + s, endy y + s, endx2 x2 + s2, endy2 y2 + s2, ( ( endx =:= x2, ( (y >= y2, y =< endy2);(endy >= y2, endy =< endy2))); % left-l side ( x =:= x2, ( (y >= y2, y =< endy2);(endy >= y2, endy =< endy2))); % left-r side ( endx =:= endx2, ( (y >= y2, y =< endy2);(endy >= y2, endy =< endy2))); % right-l side ( x =:= endx2, ( (y >= y2, y =< endy2);(endy >= y2, endy =< endy2))); % right-r side ( endy =:= y2, ( (x >= x2, x =< endx2);(endx >= x2, endx =< endx2))); % top-t side ( y =:= y2, ( (x >= x2, x =< endx2);(endx >= x2, endx =< endx2))); % top-b side ( endy =:= endy2, ( (x >= x2, x =< endx2);(endx >= x2, endx =< endx2))); % bottom-t side ( y =:= endy2, ( (x >= x2, x =< endx2);(endx >= x2, endx =< endx2))) % bottom-b side ). it's working when set variables, wanted ask ho...