initial commit, day 10

This commit is contained in:
Ikatono
2024-12-10 14:36:10 -06:00
commit e9df3737e1
19 changed files with 2157 additions and 0 deletions

27
04b_alt.py Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/python
import re
with open('04a.txt') as f:
text = f.read().strip().replace('\n', 'Z')
TOP = r'M[^Z]M.{139}A.{139}S[^Z]S'
LEFT = r'M[^Z]S.{139}A.{139}M[^Z]S'
BOTTOM = r'S[^Z]S.{139}A.{139}M[^Z]M'
RIGHT = r'S[^Z]M.{139}A.{139}S[^Z]M'
T = re.compile(f'(?={TOP})')
L = re.compile(f'(?={LEFT})')
B = re.compile(f'(?={BOTTOM})')
R = re.compile(f'(?={RIGHT})')
T_ = len(T.findall(text))
L_ = len(L.findall(text))
B_ = len(B.findall(text))
R_ = len(R.findall(text))
print(f'TOP {T_}')
print(f'LEFT {L_}')
print(f'BOTTOM {B_}')
print(f'RIGHT {R_}')
print(f'TOTAL {T_ + L_ + B_ + R_}')