Simplified code for determining valid moves for rook.