Two points (x,y) and (x', y') are on the same row iff y == y'; they're on the same column iff x == x'; they're on the same 'upgoing' diagonal iff x-y == x'-y' and they're on the same 'downgoing' diagonal iff x+y == x'+y'. Also see the previous example posted here.