Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flood fill.py with assert statements #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions flood fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ def fill(x, y):
# You can combine the two if statements below into one, but I think it's easier to read this way.
if x < 0 or x >= len(input_board) or y < 0 or y >= len(input_board[0]) or input_board[x][y] != old:
return

# Check if x and y are within valid coordinates
if x >= len(input_board) or y >= len(input_board[0]):
return input_board # Return the board unchanged

# if x < 0 or x >= len(input_board) or y < 0 or y >= len(input_board[0]):
# return
# if input_board[x][y] != old:
Expand Down