Skip to content

Commit 742d6db

Browse files
author
Evgeni Gordeev
committed
2024 day 4 - polish
1 parent eb841a5 commit 742d6db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

2024/04.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ def get_x_chars(letters, x, y):
5959
if (
6060
char == 'A' # start with A
6161
and 0 < x < height - 1 and 0 < y < width - 1 # check for out of bounds, A must not be on the edge
62+
and get_x_chars(given, x, y) in ('MMSS', 'MSMS', 'SSMM', 'SMSM') # check corners of the square with A in the middle, options are
6263
# .M.M. .M.S. .S.S. .S.M.
6364
# ..A.. OR ..A.. OR ..A.. OR ..A..
6465
# .S.S. .M.S. .M.M. .S.M.
65-
and get_x_chars(given, x, y) in ('MMSS', 'MSMS', 'SSMM', 'SMSM')
6666
):
6767
found.append((x, y))
6868
return len(found)

0 commit comments

Comments
 (0)