% predicates that return positions in 8 directions from the given position % north(Pos,NorthOfPos) north([X,Y], [X, YN]) :- YN is Y - 1. % south(Pos,SouthOfPos) south([X,Y], [X, YS]) :- YS is Y + 1. % west(Pos,WestOfPos) west([X,Y], [XW, Y]) :- XW is X - 1. % east(Pos,WestOfPos) east([X,Y], [XW, Y]) :- XW is X + 1. % diagonal positions are obtained from the major directions % northEast(Pos,NorthEastOfPos) northEast(Pos,NorthEastOfPos) :- north(Pos,NorthOfPos), east(NorthOfPos,NorthEastOfPos).