Created
January 19, 2021 03:00
-
-
Save nikhilc2710/9c4db6125417061fabdfa23e82c4eecf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for x2, y2 in ((x+1,y), (x-1,y), (x,y+1), (x,y-1)): | |
if ( 0 <= x2 < width and #X-axis in range | |
0 <= y2 < height and #y-axis in range | |
grid[y2][x2] != wall and #not a wall | |
(x2, y2) not in seen): #not visited | |
queue.append( (x2, y2)) | |
seen.add((x2, y2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment