checks board horizontally and vertically.