remove duplication and fix logical error in row win conditions