If 1 reached corner first
if ( t == 1 and ( i == n - 1 and j == m - 1 ) ) : NEW_LINE INDENT return True NEW_LINE DEDENT for d in range ( 4 ) : NEW_LINE INDENT ni = i + dx [ d ] NEW_LINE nj = j + dy [ d ] NEW_LINE DEDENT