mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Enable ruff SIM102 rule (#11341)
* Enable ruff SIM102 rule * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -75,13 +75,19 @@ def search(
|
||||
for i in range(len(DIRECTIONS)): # to try out different valid actions
|
||||
x2 = x + DIRECTIONS[i][0]
|
||||
y2 = y + DIRECTIONS[i][1]
|
||||
if x2 >= 0 and x2 < len(grid) and y2 >= 0 and y2 < len(grid[0]):
|
||||
if closed[x2][y2] == 0 and grid[x2][y2] == 0:
|
||||
g2 = g + cost
|
||||
f2 = g2 + heuristic[x2][y2]
|
||||
cell.append([f2, g2, x2, y2])
|
||||
closed[x2][y2] = 1
|
||||
action[x2][y2] = i
|
||||
if (
|
||||
x2 >= 0
|
||||
and x2 < len(grid)
|
||||
and y2 >= 0
|
||||
and y2 < len(grid[0])
|
||||
and closed[x2][y2] == 0
|
||||
and grid[x2][y2] == 0
|
||||
):
|
||||
g2 = g + cost
|
||||
f2 = g2 + heuristic[x2][y2]
|
||||
cell.append([f2, g2, x2, y2])
|
||||
closed[x2][y2] = 1
|
||||
action[x2][y2] = i
|
||||
invpath = []
|
||||
x = goal[0]
|
||||
y = goal[1]
|
||||
|
Reference in New Issue
Block a user