Skip to content

Commit

Permalink
2024 day 4 - polish
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeni Gordeev committed Jan 6, 2025
1 parent eb841a5 commit 742d6db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 2024/04.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def get_x_chars(letters, x, y):
if (
char == 'A' # start with A
and 0 < x < height - 1 and 0 < y < width - 1 # check for out of bounds, A must not be on the edge
and get_x_chars(given, x, y) in ('MMSS', 'MSMS', 'SSMM', 'SMSM') # check corners of the square with A in the middle, options are
# .M.M. .M.S. .S.S. .S.M.
# ..A.. OR ..A.. OR ..A.. OR ..A..
# .S.S. .M.S. .M.M. .S.M.
and get_x_chars(given, x, y) in ('MMSS', 'MSMS', 'SSMM', 'SMSM')
):
found.append((x, y))
return len(found)
Expand Down

0 comments on commit 742d6db

Please sign in to comment.