% return a line of consecutive positions in the north direction % of other player's stones % example: % given % S = ([[.,.,.,.,.,.], % [.,.,.,.,.,.], % [.,.,2,1,.,.], % [.,.,1,2,.,.], % [.,.,.,2,.,.], % [.,.,.,x,.,.] ]). % % x is at [3,4] % % northLine(S,1,[3,4],[[3,3],[3,2]]) holds northLine(State,Plyr,Pos,[NorthOfPos|FollowingPositions]) :- otherPlyr(Plyr,OtherPlyr), north(Pos,NorthOfPos), get(State,NorthOfPos,OtherPlyr), northLine(State,Plyr,NorthOfPos,FollowingPositions). northLine(State,Plyr,Pos,[]) :- otherPlyr(Plyr,OtherPlyr), north(Pos,NorthOfPos), get(State,NorthOfPos,PosContent), OtherPlyr \== PosContent.