porting over AOC from previous years to a monorepo.
This commit is contained in:
commit
84c4cf9991
194 changed files with 30104 additions and 0 deletions
140
2020/.gitignore
vendored
Normal file
140
2020/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
1
2020/.python-version
Normal file
1
2020/.python-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
3.13
|
||||
3
2020/README.md
Normal file
3
2020/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# advent_of_code_2020
|
||||
|
||||
Python [advent of code](https://adventofcode.com/2020) 2020
|
||||
54
2020/days/01/day1.py
Executable file
54
2020/days/01/day1.py
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
def parse(puzzle_input):
|
||||
"""Parse input"""
|
||||
return [int(string) for string in puzzle_input.splitlines()]
|
||||
|
||||
def part1(data:list[int]):
|
||||
"""Solve part 1"""
|
||||
data.sort()
|
||||
while True:
|
||||
if len(data)<2:
|
||||
raise ValueError('no match found')
|
||||
s = data[0]+data[-1]
|
||||
if s>2020:
|
||||
data.pop(-1)
|
||||
elif s<2020:
|
||||
data.pop(0)
|
||||
else:
|
||||
return data[0]*data[-1]
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
data.sort()
|
||||
while True:
|
||||
if len(data)<3:
|
||||
raise ValueError('no match found')
|
||||
if data[0]+data[1]+data[-1]>2020:
|
||||
data.pop(-1)
|
||||
elif data[0]+data[-1]+data[-2]<2020:
|
||||
data.pop(0)
|
||||
elif data[0]+data[1]+data[-1]==2020:
|
||||
return data[0]*data[1]*data[-1]
|
||||
else:
|
||||
return data[0]*data[-1]*data[-2]
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data.copy())
|
||||
solution2 = part2(data.copy())
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
6
2020/days/01/example1
Normal file
6
2020/days/01/example1
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
1721
|
||||
979
|
||||
366
|
||||
299
|
||||
675
|
||||
1456
|
||||
200
2020/days/01/input
Normal file
200
2020/days/01/input
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
1772
|
||||
1065
|
||||
1827
|
||||
1671
|
||||
1181
|
||||
1915
|
||||
1657
|
||||
1632
|
||||
1053
|
||||
1546
|
||||
1039
|
||||
1388
|
||||
1698
|
||||
1174
|
||||
1275
|
||||
1250
|
||||
1988
|
||||
1078
|
||||
1075
|
||||
1958
|
||||
1617
|
||||
1387
|
||||
1543
|
||||
1965
|
||||
1867
|
||||
1771
|
||||
1755
|
||||
1331
|
||||
1677
|
||||
1935
|
||||
1488
|
||||
911
|
||||
1001
|
||||
1516
|
||||
1949
|
||||
1626
|
||||
1083
|
||||
1402
|
||||
1223
|
||||
1179
|
||||
2001
|
||||
1790
|
||||
1551
|
||||
1117
|
||||
1990
|
||||
1968
|
||||
1532
|
||||
1999
|
||||
1175
|
||||
1126
|
||||
1869
|
||||
1666
|
||||
1753
|
||||
513
|
||||
1349
|
||||
1139
|
||||
1941
|
||||
1823
|
||||
1647
|
||||
1835
|
||||
1943
|
||||
1459
|
||||
1833
|
||||
1398
|
||||
1877
|
||||
1625
|
||||
1749
|
||||
1631
|
||||
1864
|
||||
1826
|
||||
1499
|
||||
1336
|
||||
1264
|
||||
1091
|
||||
1558
|
||||
1321
|
||||
1754
|
||||
1729
|
||||
1585
|
||||
1740
|
||||
1767
|
||||
1774
|
||||
1164
|
||||
1318
|
||||
1930
|
||||
1236
|
||||
1995
|
||||
1611
|
||||
1319
|
||||
1361
|
||||
1119
|
||||
1563
|
||||
1578
|
||||
1047
|
||||
1797
|
||||
1787
|
||||
1038
|
||||
1921
|
||||
1656
|
||||
1898
|
||||
1828
|
||||
1727
|
||||
1825
|
||||
2010
|
||||
536
|
||||
1395
|
||||
1865
|
||||
1882
|
||||
1638
|
||||
1954
|
||||
1565
|
||||
1296
|
||||
1723
|
||||
1187
|
||||
60
|
||||
1130
|
||||
1102
|
||||
1963
|
||||
1048
|
||||
1493
|
||||
1795
|
||||
472
|
||||
1496
|
||||
1278
|
||||
1444
|
||||
1889
|
||||
860
|
||||
1975
|
||||
1961
|
||||
1070
|
||||
1570
|
||||
1495
|
||||
1644
|
||||
1881
|
||||
1293
|
||||
1090
|
||||
1906
|
||||
1385
|
||||
1549
|
||||
1143
|
||||
1195
|
||||
2004
|
||||
1397
|
||||
1032
|
||||
1681
|
||||
2000
|
||||
1574
|
||||
1400
|
||||
1911
|
||||
1868
|
||||
1917
|
||||
1872
|
||||
1696
|
||||
1086
|
||||
1291
|
||||
1761
|
||||
1703
|
||||
1202
|
||||
1486
|
||||
1705
|
||||
1924
|
||||
1186
|
||||
1676
|
||||
1615
|
||||
1951
|
||||
1556
|
||||
1604
|
||||
1534
|
||||
2002
|
||||
1334
|
||||
1109
|
||||
1108
|
||||
1713
|
||||
1422
|
||||
1909
|
||||
1418
|
||||
1592
|
||||
1887
|
||||
1037
|
||||
1568
|
||||
1914
|
||||
1780
|
||||
1929
|
||||
1973
|
||||
1684
|
||||
1581
|
||||
1148
|
||||
1931
|
||||
1619
|
||||
1082
|
||||
1166
|
||||
1913
|
||||
1312
|
||||
1330
|
||||
1540
|
||||
1841
|
||||
1977
|
||||
1769
|
||||
1691
|
||||
1821
|
||||
33
2020/days/01/test_day1.py
Normal file
33
2020/days/01/test_day1.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import day1 as aoc
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "example2").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == [1721, 979, 366, 299, 675, 1456]
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == 514579
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example1):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example1) == 241861950
|
||||
51
2020/days/02/day2.py
Executable file
51
2020/days/02/day2.py
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class PasswordSpec:
|
||||
first:int
|
||||
second:int
|
||||
letter:str
|
||||
password:str
|
||||
|
||||
def parse(puzzle_input: str):
|
||||
"""Parse input"""
|
||||
regex = re.compile(r'^(\d+)-(\d+) (\w): (\w+)$')
|
||||
toInt = lambda x: PasswordSpec(int(x[0]), int(x[1]), x[2], x[3])
|
||||
return [toInt(regex.match(i).groups()) for i in puzzle_input.splitlines()]
|
||||
|
||||
def part1(data):
|
||||
"""Solve part 1"""
|
||||
test = lambda x: x.first<=x.password.count(x.letter)<=x.second
|
||||
# these two lines are equivilant.
|
||||
# return sum(1 for p in data if test(p))
|
||||
return len([1 for p in data if test(p)])
|
||||
|
||||
def test_password(passwordSpec: PasswordSpec):
|
||||
if passwordSpec.password[passwordSpec.first-1]==passwordSpec.letter:
|
||||
return passwordSpec.password[passwordSpec.second-1]!=passwordSpec.letter
|
||||
else:
|
||||
return passwordSpec.password[passwordSpec.second-1]==passwordSpec.letter
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
return sum(1 for p in data if test_password(p))
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data)
|
||||
solution2 = part2(data)
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
3
2020/days/02/example1
Normal file
3
2020/days/02/example1
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1-3 a: abcde
|
||||
1-3 b: cdefg
|
||||
2-9 c: ccccccccc
|
||||
1000
2020/days/02/input
Normal file
1000
2020/days/02/input
Normal file
File diff suppressed because it is too large
Load diff
37
2020/days/02/test_day2.py
Normal file
37
2020/days/02/test_day2.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import day2 as aoc
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "example2").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == [
|
||||
aoc.PasswordSpec(first=1, second=3, letter='a', password='abcde'),
|
||||
aoc.PasswordSpec(first=1, second=3, letter='b', password='cdefg'),
|
||||
aoc.PasswordSpec(first=2, second=9, letter='c', password='ccccccccc')
|
||||
]
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == 2
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example1):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example1) == 1
|
||||
38
2020/days/03/day3.py
Executable file
38
2020/days/03/day3.py
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pprint import pprint
|
||||
|
||||
def parse(puzzle_input: str):
|
||||
"""Parse input"""
|
||||
# returns a 2 dimentional array where true means there is a tree there.
|
||||
return [[i=='#' for i in j] for j in puzzle_input.splitlines()]
|
||||
|
||||
def part1(data):
|
||||
"""Solve part 1"""
|
||||
return solveForSlope(data, 3, 1)
|
||||
|
||||
def solveForSlope(data, right: int, down: int):
|
||||
return sum(1 for index, row in enumerate(data[::down]) if row[(right*index)%len(row)])
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
return solveForSlope(data,1,1)*solveForSlope(data,3,1)*solveForSlope(data,5,1)*solveForSlope(data,7,1)*solveForSlope(data,1,2)
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data)
|
||||
solution2 = part2(data)
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
11
2020/days/03/example1
Normal file
11
2020/days/03/example1
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
..##.......
|
||||
#...#...#..
|
||||
.#....#..#.
|
||||
..#.#...#.#
|
||||
.#...##..#.
|
||||
..#.##.....
|
||||
.#.#.#....#
|
||||
.#........#
|
||||
#.##...#...
|
||||
#...##....#
|
||||
.#..#...#.#
|
||||
323
2020/days/03/input
Normal file
323
2020/days/03/input
Normal file
|
|
@ -0,0 +1,323 @@
|
|||
........#.............#........
|
||||
...#....#...#....#.............
|
||||
.#..#...#............#.....#..#
|
||||
..#......#..##............###..
|
||||
..........#......#..#..#.......
|
||||
.#..#.......#.........#.#......
|
||||
.........#..#....##..#.##....#.
|
||||
..#....##...#..................
|
||||
##..........#.##...#....##..#..
|
||||
...#....#...#..............#...
|
||||
...........................#..#
|
||||
..##.##.#..................#...
|
||||
...#.##..#............#........
|
||||
........#.......#...#.....##.#.
|
||||
.##..........#......#.......#..
|
||||
...#..........#...#..#.......#.
|
||||
......#...#...#.##.......#.#...
|
||||
........#...#...#...##.........
|
||||
#..............#.#....#.......#
|
||||
..#..#..#.#....#...............
|
||||
.....#........#...#..........#.
|
||||
##......#...#..#.##.......#....
|
||||
..#.#.....#.#.............#.#.#
|
||||
#..#..##......##...#...........
|
||||
..#......#........#.....#......
|
||||
.....#.......#....#.#...#......
|
||||
...#........#...........#...#..
|
||||
.......#.#...........###....#..
|
||||
...#...........##....##........
|
||||
#....#..####....#.....#..#....#
|
||||
..........#...........#........
|
||||
...#.......#....#.#.........#..
|
||||
....#...#.......#..###.........
|
||||
......#......#..#......#..#....
|
||||
...#.....#............#..#.....
|
||||
...#.#.#.#..#.......#.....#....
|
||||
#....##...#.........#...##.....
|
||||
#..#.......#..#..#..#...##.....
|
||||
#.......#............#.....#...
|
||||
.#........##....##...#........#
|
||||
.....#...#.....................
|
||||
.......#........#..............
|
||||
.....#............#.#.#...#.#..
|
||||
.....##..#.............#.......
|
||||
..#.##..#........#..#...#......
|
||||
.........#.#....#...........#..
|
||||
.#.....#..#....#.....#...#.....
|
||||
....#.#................#.......
|
||||
...............##......#...#...
|
||||
.##...#...#.......##.#....#....
|
||||
............#........#.......#.
|
||||
......##.#.#...................
|
||||
.#.#..............#.......#....
|
||||
#.....#...#.......#..#...#.....
|
||||
.............#....#..#......#..
|
||||
........#...##................#
|
||||
.......#...#..#..##............
|
||||
..#..#...##...#..#.#.....#...#.
|
||||
.#.#...#.........#.#...........
|
||||
...###....#.......#...#........
|
||||
........#......##.#...#..##..#.
|
||||
.....................#.#.......
|
||||
.............#...........#...#.
|
||||
#..#..#.....#.#...#............
|
||||
...#....#.....#...........#....
|
||||
..##.....##...#......#..##.....
|
||||
#.....#.....###.#.....#....##..
|
||||
.#...........###...............
|
||||
..................#..##.#...#..
|
||||
................#....##.#......
|
||||
.#.#.#...#....#.........#..#.#.
|
||||
#.......#........##............
|
||||
.......##.#....#.#............#
|
||||
..........#..##.#....#.........
|
||||
........##..#....#.............
|
||||
.........#....#...........##...
|
||||
#.........#.#..#..#..........#.
|
||||
.....#........#......#.........
|
||||
....#.#.#...............#......
|
||||
.#..#..##...#.##..........#....
|
||||
..#....................#.#.....
|
||||
.........#....#...........#.#.#
|
||||
........#....##.##.............
|
||||
..#.....#.......#..#......#....
|
||||
#..........#.#.....#.#....#....
|
||||
........##.#.....#..#.....#.#..
|
||||
...................#...#....#.#
|
||||
............#..#....#...#...#..
|
||||
..............#.#.........#....
|
||||
...#..#..#.#..##..##...........
|
||||
.#...........................#.
|
||||
.#.......#...........#....#.#.#
|
||||
......#..#...#........#...##...
|
||||
.........#......#.#.......#...#
|
||||
...#..##................#......
|
||||
.............#.#..##....#.#....
|
||||
...............#..#......#.....
|
||||
.#......#.#.#....#........#....
|
||||
........#..#.##..#..#.........#
|
||||
...#....#.#...#..#.......#..#..
|
||||
..#...##.........#..#...#......
|
||||
...#...........#.............#.
|
||||
....#.....................#....
|
||||
.....#..#...............#.#...#
|
||||
....#..........#........#......
|
||||
..#....#........##..##.........
|
||||
...#....#..#.#.......#...#.....
|
||||
..#........#....#...##....#.#..
|
||||
.#...#........##.....#....###..
|
||||
#....#....##......#........#...
|
||||
.........#..#.#..........#....#
|
||||
....#...#.....#.......##.......
|
||||
..............#..........#.##..
|
||||
#...#..#..............#......#.
|
||||
.................#......##....#
|
||||
..#..##..#.......#..#.#......#.
|
||||
.............#........#.....#.#
|
||||
.#.##............#..#..........
|
||||
..#...#...........#..##........
|
||||
.#....#...#....#.......#.......
|
||||
...#.#..#..#..#....#.....#..#..
|
||||
....#..##..............#...#...
|
||||
#..........###......###........
|
||||
.##.##......#..#............#..
|
||||
.#...........#.#.....#...#.....
|
||||
#.#..#...#............#........
|
||||
.........#...#...#..........##.
|
||||
.......###..#..........#.......
|
||||
...........###.....#........#..
|
||||
.#.............#.....#......#..
|
||||
...#.....#....#.#.........##...
|
||||
....##..##...#.......##........
|
||||
......#....##.........#......#.
|
||||
..........#.....##..#.....#..#.
|
||||
..........####...#..#.........#
|
||||
.##....#..#.#...#.......#......
|
||||
...#.#.##.#.#...#....#.#.#.....
|
||||
.........#...##........##.....#
|
||||
..#........#..........##...##.#
|
||||
##...##..........#.#...........
|
||||
..............#......#.........
|
||||
........#.....#.#.......#......
|
||||
.#...#.....#....#.#..#.........
|
||||
.....#....................##...
|
||||
....#..................#.#...##
|
||||
.....#............#..##........
|
||||
#..........#....#.#.......##.#.
|
||||
....#..#.....................#.
|
||||
#..#....##.....#...............
|
||||
..#...#..#..##....#.#..........
|
||||
.......#......#.#.......#.....#
|
||||
...#.#.......#...#.##..........
|
||||
....#..........#....#.#.#......
|
||||
.......#..#..........#..##.....
|
||||
#......#......#...#......#...#.
|
||||
###..#....##......##........#..
|
||||
.#..........#.....#.......#.#..
|
||||
.......#.....#.....#.#.........
|
||||
..#...#....#...................
|
||||
..............#.##.............
|
||||
.#...#.......#.##...#.#.......#
|
||||
.......#......................#
|
||||
....#.#...#.#........#.........
|
||||
.#......#....#...#.............
|
||||
#.......#...###.....#.#.#..#...
|
||||
#....##.#...............##.....
|
||||
..#.......#..................#.
|
||||
.....####...............#......
|
||||
.##......#......#.#.......##.#.
|
||||
#......##..###....#....#......#
|
||||
.##.......##.##...#.##.........
|
||||
......##............#.......#..
|
||||
......#..#.....##.#............
|
||||
.#..........#.....##...........
|
||||
#.........#......#......##.#...
|
||||
.........#.......#..#......#.#.
|
||||
.........#.......#...........#.
|
||||
.#..##.#..................##...
|
||||
.............#.............#...
|
||||
.....##........#......##...##..
|
||||
..#..#.#.....#..#....#.........
|
||||
.....#....#.....#.....#........
|
||||
#......##.....#....#....#......
|
||||
#.................#..#.#......#
|
||||
.......#..#......#....#.#...#.#
|
||||
....#.........#..#..........#.#
|
||||
##......#............#...#...#.
|
||||
....##......#...#.....#....##..
|
||||
.#...##.........#..............
|
||||
......#.....................#..
|
||||
..#..........###....#..........
|
||||
#....#...#..#.............#....
|
||||
#........#.#......#....#.......
|
||||
.#...#.......#..#...#.#...#..#.
|
||||
................##.#.....#.....
|
||||
###.......#...#................
|
||||
...#.......#...#.#.....#.......
|
||||
..#.........#.....#.#.......#..
|
||||
......#.......................#
|
||||
#.....#.#..#....#.......#......
|
||||
...#....#..#....####...........
|
||||
.............#.....#...##......
|
||||
.......#.........#...#..#......
|
||||
.##..#.........#....#.#........
|
||||
....##...#.#...........#....#..
|
||||
.........................##....
|
||||
..###.......##....#.#.........#
|
||||
.#....#.#.#...........##....#..
|
||||
......#...#..#..#..#..#.......#
|
||||
..#....#.#.......#..#..#..#...#
|
||||
.....##...#.##....#.#...#......
|
||||
.........#..#....#..#..........
|
||||
.##..##.........#.#.....#......
|
||||
..........#...##...#.#...#.....
|
||||
#.##..#..#.............#.......
|
||||
...#...........#.......#......#
|
||||
.......#....#....#...##.......#
|
||||
..#.##........###..#......#....
|
||||
...#...........###......#..#..#
|
||||
.#.........#.#.........#.#.....
|
||||
##.......##.##.##......##......
|
||||
............#...#..........#...
|
||||
....................#..........
|
||||
...#..#...........#...#...#....
|
||||
.................#...#......###
|
||||
...#................#.#.##.....
|
||||
...............#........#......
|
||||
#.............##......#.#..#...
|
||||
..#.#.....#..#.##.....##...#...
|
||||
......#.........#......#.......
|
||||
#.......#......#....#........#.
|
||||
.#..##.....#.........#.........
|
||||
....##.##.#...#.........##.#...
|
||||
...............#..#..#..##.....
|
||||
.#..#...............###........
|
||||
.##............##..............
|
||||
...............#...##...#...#.#
|
||||
..#.#......#.#..#.............#
|
||||
#.#..#..##.........#.#.#...#...
|
||||
....##.#....................##.
|
||||
.........#..#.....#.....#..#..#
|
||||
....#......#......#.##....#....
|
||||
........###..#.............#..#
|
||||
##................#.........#..
|
||||
#.....#.......#....#...........
|
||||
..#.......#..#........#....#...
|
||||
..#.#.##..#.#...##........#.##.
|
||||
..#..........#............#....
|
||||
..........#...............##...
|
||||
..........###........#.#.......
|
||||
.....###..#.............#......
|
||||
##.............#...#.....#.....
|
||||
.....#......#....#........#.#..
|
||||
............#..#..............#
|
||||
.................#...........##
|
||||
#........#.........###.....#...
|
||||
..#.#..............##......#.#.
|
||||
.#...........#.........#..##..#
|
||||
...............................
|
||||
.#.....#..#....#....#......#...
|
||||
.#...#......#.#..#....#.......#
|
||||
......#.##.......#......#......
|
||||
......#..###..#................
|
||||
#..#.....#........##...#.......
|
||||
......##.........##....#...##..
|
||||
.#..........#.................#
|
||||
#..#.......#...............#...
|
||||
.........#..###....#.#.##.#....
|
||||
..#...#.##..##...............##
|
||||
.........#.....................
|
||||
.#....##...#......#....#.......
|
||||
............#..........#..#....
|
||||
...#......##....#....#........#
|
||||
.#...................#.........
|
||||
#.#........###....#..........#.
|
||||
.........#....#....#........##.
|
||||
.#....#..#.........#..#........
|
||||
...............#..#...#..#...##
|
||||
.........#....##....#......#...
|
||||
.#.............................
|
||||
...#........#...#.#...#.#..#...
|
||||
.....#..##...#.#...............
|
||||
#.....#....#.........#.........
|
||||
#...#...........##.........#...
|
||||
..##........#.#...#...#......#.
|
||||
...........#.....#...#.#.......
|
||||
......###....#.....#...........
|
||||
......##...#..........#....#.#.
|
||||
.......##..##..........#.......
|
||||
....#............#..#....##....
|
||||
..##...................#.#.....
|
||||
...#.#..#.#....................
|
||||
.#..##..#............##.###..#.
|
||||
#.#...#....#.#..........#.#....
|
||||
........#....#.....#...........
|
||||
..##....#...#.......#..........
|
||||
...........##.##....#..........
|
||||
.....#............#............
|
||||
.......#.............#....#....
|
||||
.................#......#......
|
||||
......##.......#....#..##...#..
|
||||
.#..#....#.....................
|
||||
...#.#.#...#......##...........
|
||||
##........##.#....#....#.......
|
||||
.......#.....#..#..#...#.##....
|
||||
#..........#....#.#..#..#..#...
|
||||
...##..............#...........
|
||||
.........#.....#.#....#.......#
|
||||
.........#....##..#..##..#.....
|
||||
.....#......................#..
|
||||
...###...#..#......#...........
|
||||
....#.....................#....
|
||||
...............................
|
||||
..#.....###.......#..#....#....
|
||||
#..........#.................#.
|
||||
......#.......###.......#..##..
|
||||
.............#.##..............
|
||||
......#..#.#..#...........#....
|
||||
...#....##.#...#..#.#...#....#.
|
||||
..................#...#....#.##
|
||||
......#.#....#.................
|
||||
......#.#.....#.....#..##......
|
||||
#..##...........#..#.....#.##..
|
||||
43
2020/days/03/test_day3.py
Normal file
43
2020/days/03/test_day3.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import day3 as aoc
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == [[False, False, True, True, False, False, False, False, False, False, False],
|
||||
[True, False, False, False, True, False, False, False, True, False, False],
|
||||
[False, True, False, False, False, False, True, False, False, True, False],
|
||||
[False, False, True, False, True, False, False, False, True, False, True],
|
||||
[False, True, False, False, False, True, True, False, False, True, False],
|
||||
[False, False, True, False, True, True, False, False, False, False, False],
|
||||
[False, True, False, True, False, True, False, False, False, False, True],
|
||||
[False, True, False, False, False, False, False, False, False, False, True],
|
||||
[True, False, True, True, False, False, False, True, False, False, False],
|
||||
[True, False, False, False, True, True, False, False, False, False, True],
|
||||
[False, True, False, False, True, False, False, False, True, False, True]]
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == 7
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example2):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example2) == 336
|
||||
132
2020/days/04/day4.py
Executable file
132
2020/days/04/day4.py
Executable file
|
|
@ -0,0 +1,132 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pprint import pprint
|
||||
|
||||
@dataclass
|
||||
class Passport:
|
||||
birthYear: int | None
|
||||
issueYear: int | None
|
||||
expirationYear: int | None
|
||||
height: str | None
|
||||
hairColor: str | None
|
||||
eyeColor: str | None
|
||||
passportId: str | None
|
||||
countryId: str | None
|
||||
|
||||
def regexUnwrap(match, group:int)->str | None:
|
||||
return match[group] if match is not None else None
|
||||
|
||||
def parse(puzzle_input: str)->list[Passport]:
|
||||
"""Parse input"""
|
||||
rawRecords = [i.replace('\n', ' ') for i in puzzle_input.split('\n\n')]
|
||||
records = []
|
||||
for rawRecord in rawRecords:
|
||||
birthYear=re.search(r'byr:(\S+)', rawRecord)
|
||||
issueYear=re.search(r'iyr:(\S+)', rawRecord)
|
||||
expirationYear=re.search(r'eyr:(\S+)', rawRecord)
|
||||
height=re.search(r'hgt:(\S+)', rawRecord)
|
||||
hairColor=re.search(r'hcl:(\S+)', rawRecord)
|
||||
eyeColor=re.search(r'ecl:(\S+)', rawRecord)
|
||||
passportId=re.search(r'pid:(\S+)', rawRecord)
|
||||
countryId=re.search(r'cid:(\S+)', rawRecord)
|
||||
records.append(Passport(
|
||||
int(birthYear[1]) if birthYear is not None else None,
|
||||
int(issueYear[1]) if issueYear is not None else None,
|
||||
int(expirationYear[1]) if expirationYear is not None else None,
|
||||
regexUnwrap(height,1),
|
||||
regexUnwrap(hairColor,1),
|
||||
regexUnwrap(eyeColor,1),
|
||||
regexUnwrap(passportId,1),
|
||||
regexUnwrap(countryId,1),
|
||||
))
|
||||
return records
|
||||
|
||||
def lazyCheckPassport(passport: Passport)->bool:
|
||||
return (
|
||||
passport.birthYear is not None
|
||||
and passport.issueYear is not None
|
||||
and passport.expirationYear is not None
|
||||
and passport.height is not None
|
||||
and passport.hairColor is not None
|
||||
and passport.eyeColor is not None
|
||||
and passport.passportId is not None
|
||||
)
|
||||
|
||||
def part1(data):
|
||||
"""Solve part 1"""
|
||||
return sum(1 for record in data if lazyCheckPassport(record))
|
||||
|
||||
def checkBirthYear(passport: Passport)->bool:
|
||||
if passport.birthYear is None: return False
|
||||
return (1920<=passport.birthYear<=2002)
|
||||
|
||||
def checkIssueYear(passport: Passport)->bool:
|
||||
if passport.issueYear is None: return False
|
||||
return (2010<=passport.issueYear<=2020)
|
||||
|
||||
def checkExpirationYear(passport: Passport)->bool:
|
||||
if passport.expirationYear is None: return False
|
||||
return (2020<=passport.expirationYear<=2030)
|
||||
|
||||
def checkHeight(passport: Passport)->bool:
|
||||
if passport.height is None: return False
|
||||
rematch = re.match(r'(\d+)((?:in)|(?:cm))', passport.height)
|
||||
if rematch is None: return False
|
||||
number = int(rematch.group(1))
|
||||
unit = rematch.group(2)
|
||||
if unit == 'in':
|
||||
return (59<=number<=76)
|
||||
else:
|
||||
return (150<=number<=193)
|
||||
|
||||
def checkHairColour(passport: Passport)->bool:
|
||||
if passport.hairColor is None: return False
|
||||
return (re.match(r'#[0123456789abcdef]{6}$', passport.hairColor) is not None)
|
||||
|
||||
def checkEyeColour(passport: Passport)->bool:
|
||||
if passport.eyeColor is None: return False
|
||||
return (passport.eyeColor == 'amb'
|
||||
or passport.eyeColor == 'blu'
|
||||
or passport.eyeColor == 'brn'
|
||||
or passport.eyeColor == 'gry'
|
||||
or passport.eyeColor == 'grn'
|
||||
or passport.eyeColor == 'hzl'
|
||||
or passport.eyeColor == 'oth'
|
||||
)
|
||||
|
||||
def checkPassportId(passport: Passport)->bool:
|
||||
if passport.passportId is None: return False
|
||||
return (re.match(r'[0-9]{9}$', passport.passportId) is not None)
|
||||
|
||||
def checkPassport(passport: Passport)->bool:
|
||||
return (checkBirthYear(passport)
|
||||
and checkIssueYear(passport)
|
||||
and checkExpirationYear(passport)
|
||||
and checkHeight(passport)
|
||||
and checkHairColour(passport)
|
||||
and checkEyeColour(passport)
|
||||
and checkPassportId(passport)
|
||||
)
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
return sum(1 for record in data if checkPassport(record))
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data)
|
||||
solution2 = part2(data)
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
13
2020/days/04/example1
Normal file
13
2020/days/04/example1
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
|
||||
byr:1937 iyr:2017 cid:147 hgt:183cm
|
||||
|
||||
iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884
|
||||
hcl:#cfa07d byr:1929
|
||||
|
||||
hcl:#ae17e1 iyr:2013
|
||||
eyr:2024
|
||||
ecl:brn pid:760753108 byr:1931
|
||||
hgt:179cm
|
||||
|
||||
hcl:#cfa07d eyr:2025 pid:166559648
|
||||
iyr:2011 ecl:brn hgt:59in
|
||||
1146
2020/days/04/input
Normal file
1146
2020/days/04/input
Normal file
File diff suppressed because it is too large
Load diff
65
2020/days/04/test_day4.py
Normal file
65
2020/days/04/test_day4.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import day4 as aoc
|
||||
from day4 import Passport
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "example2").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == [Passport(birthYear=1937,
|
||||
issueYear=2017,
|
||||
expirationYear=2020,
|
||||
height='183cm',
|
||||
hairColor='#fffffd',
|
||||
eyeColor='gry',
|
||||
passportId='860033327',
|
||||
countryId='147'),
|
||||
Passport(birthYear=1929,
|
||||
issueYear=2013,
|
||||
expirationYear=2023,
|
||||
height=None,
|
||||
hairColor='#cfa07d',
|
||||
eyeColor='amb',
|
||||
passportId='028048884',
|
||||
countryId='350'),
|
||||
Passport(birthYear=1931,
|
||||
issueYear=2013,
|
||||
expirationYear=2024,
|
||||
height='179cm',
|
||||
hairColor='#ae17e1',
|
||||
eyeColor='brn',
|
||||
passportId='760753108',
|
||||
countryId=None),
|
||||
Passport(birthYear=None,
|
||||
issueYear=2011,
|
||||
expirationYear=2025,
|
||||
height='59in',
|
||||
hairColor='#cfa07d',
|
||||
eyeColor='brn',
|
||||
passportId='166559648',
|
||||
countryId=None)]
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == 2
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example1):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example1) == 2
|
||||
46
2020/days/05/day5.py
Executable file
46
2020/days/05/day5.py
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pprint import pprint
|
||||
|
||||
def row_to_int(string: str)->int:
|
||||
return int(string.replace('F','0').replace('B','1'),2)
|
||||
|
||||
def col_to_int(string: str)->int:
|
||||
return int(string.replace('L','0').replace('R','1'),2)
|
||||
|
||||
def parse(puzzle_input: str):
|
||||
"""Parse input"""
|
||||
rows_and_cols = [(row_to_int(x[:7]),col_to_int(x[7:])) for x in puzzle_input.splitlines()]
|
||||
return set([x[0]*8+x[1] for x in rows_and_cols])
|
||||
|
||||
def part1(data):
|
||||
"""Solve part 1"""
|
||||
return max(data)
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
for row in range(128):
|
||||
for col in range(8):
|
||||
potentialID=row*8+col
|
||||
if potentialID not in data:
|
||||
if (potentialID+1 in data) and (potentialID-1 in data):
|
||||
return potentialID
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data)
|
||||
solution2 = part2(data)
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
4
2020/days/05/example1
Normal file
4
2020/days/05/example1
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
FBFBBFFRLR
|
||||
BFFFBBFRRR
|
||||
FFFBBBFRRR
|
||||
BBFFBBFRLL
|
||||
859
2020/days/05/input
Normal file
859
2020/days/05/input
Normal file
|
|
@ -0,0 +1,859 @@
|
|||
BBFFBFFRRR
|
||||
FBBFFBBLRR
|
||||
FFBFBFBRRR
|
||||
FFFBFBFRRR
|
||||
BBFFBBFLRR
|
||||
BFFBFBFLRL
|
||||
FBBBBBFRRR
|
||||
FFFFBFFLLR
|
||||
BFBFFBFLLR
|
||||
FFBBFFFLRR
|
||||
BFFFFFFLLL
|
||||
FBFFBFFRLL
|
||||
FFBFFBFRLR
|
||||
FBBBFBFRRR
|
||||
FBFFBBBRRL
|
||||
FBFFBFFLRL
|
||||
BFBBFFFLLL
|
||||
FBBFBFBRRL
|
||||
BFFBFFFLRR
|
||||
FFFFBFFRLR
|
||||
FFFBBBFRLR
|
||||
FBFFFBFLLL
|
||||
BFBFBBBLRR
|
||||
FBBBFFBRLR
|
||||
BBFFFFFLLL
|
||||
BFFFFBFRRL
|
||||
FBBBFBFRRL
|
||||
FFBBBFBRLR
|
||||
FFFFBBFLLL
|
||||
FBFBFBBRLL
|
||||
BFFFBFBRLL
|
||||
FFBFBFBRLR
|
||||
FBFFFBBRLR
|
||||
BBFFFBBLRR
|
||||
BFFBBFFRRL
|
||||
BFBBBFFRRR
|
||||
FFBFBFFRRL
|
||||
FBFBBFBLLR
|
||||
BFFBFBBRRR
|
||||
BFFFFBFLLR
|
||||
FFFBFFFRRR
|
||||
FBFFFBFRLR
|
||||
BFBFFBFRLR
|
||||
FBBBFFFLLR
|
||||
FBBFFBFLLL
|
||||
BFBBFBFLLR
|
||||
FFBFBBFLLL
|
||||
BFFFBFBLRL
|
||||
FBBFBBBLLL
|
||||
FFFBFFBLLR
|
||||
BFFFFFFRRR
|
||||
BFBBBBFRRL
|
||||
FFBFBBFRLL
|
||||
FBBBFBBLRL
|
||||
BFFBFBFLRR
|
||||
BBFFFBFRRL
|
||||
BFFBBFFLRR
|
||||
BFBFFFFLLR
|
||||
FBFBFFFLRR
|
||||
BFBBFBBLRL
|
||||
FBFBFFFRLR
|
||||
FFBBBFFRLR
|
||||
BBFBBFFRLR
|
||||
BFFFFBBRLL
|
||||
FFFBFBBLRR
|
||||
FFFFBFBRRL
|
||||
BFFBFBFRRL
|
||||
FBFFBBBRRR
|
||||
BFBBFFBLRL
|
||||
FFBBFFFLLL
|
||||
FBFBBFBRRR
|
||||
FBBBFFFLRL
|
||||
FBBFFBFLRR
|
||||
FBBBBBFRRL
|
||||
BFFFBBBLRL
|
||||
FFFBBFBRLL
|
||||
FFFFFBBLLR
|
||||
FFBFBBBRLL
|
||||
FFBBFBFLLR
|
||||
FBFBBFFLLL
|
||||
FFFBFFBRLL
|
||||
BFBBFBFRLR
|
||||
BFBFBBFRRL
|
||||
FFFBFFFLRL
|
||||
FBBFBBFRLR
|
||||
BFFBFFBRRL
|
||||
BBFFFBBRLR
|
||||
FBBBBBFRLL
|
||||
FFBBFFFRLL
|
||||
BBFBFBBRLR
|
||||
FFBBBFFLLR
|
||||
BFBBBBBLLL
|
||||
FFFBFBBLLL
|
||||
FBFFBFFRRL
|
||||
FBFBFFBLLL
|
||||
BFFBBBFRRL
|
||||
FBBBBBFLLL
|
||||
FBFBBFBLRR
|
||||
FFBBBBFLLR
|
||||
BBFFBFFRRL
|
||||
FBBBBBFLRR
|
||||
FBFFFFFRLR
|
||||
FBFFBBFLLR
|
||||
FFBBBFBLRR
|
||||
BFFFBBBRRL
|
||||
FBFBFBFRRL
|
||||
FFFBFBBRLL
|
||||
FFBFBFBLRL
|
||||
FBBBFBBLLL
|
||||
FBBBFBFLRL
|
||||
FBBBBFFLRL
|
||||
FBFBBBBRLR
|
||||
FBBFFBFLLR
|
||||
FBFFBBFLRR
|
||||
FBFFFBBLLL
|
||||
BBFFBBFRRR
|
||||
FBBFBBBRLL
|
||||
BFFBBBFLLR
|
||||
FBFFFFFLRR
|
||||
FBFFBBFRRL
|
||||
BFFBBFBLLL
|
||||
FBBBFBBLLR
|
||||
FBBBBFBLRL
|
||||
FBBBFFFRRR
|
||||
FFFFBBFRRR
|
||||
BFBFFFFRRR
|
||||
BFBFFBBLRL
|
||||
BFFFFFBLLR
|
||||
BFBBFFFRRR
|
||||
FBFFFBFRRL
|
||||
BFFBBFFLRL
|
||||
FFFBFFBRRL
|
||||
FFBFBFBLLL
|
||||
FFBFBFFLLL
|
||||
BBFFFBBRRR
|
||||
FFFFFBFLRL
|
||||
BFBFFFBLRL
|
||||
BFBFBFFLRR
|
||||
BFFBBBBRLL
|
||||
BFFFBFFRRR
|
||||
BBFBFFBRLL
|
||||
FBFFFBBRRL
|
||||
FFBBFBBRRL
|
||||
FFBFFFFLLR
|
||||
FFFBFFFLLL
|
||||
FBBFFBBLRL
|
||||
BFBFBBFLLR
|
||||
FBFBFFFRRL
|
||||
BBFFFFFLRR
|
||||
BBFFFBFLRL
|
||||
BBFFBBBLLL
|
||||
BFBBFBFLLL
|
||||
BFBFFBFRRL
|
||||
FBFFFFBRRL
|
||||
FBFFBBBRLR
|
||||
BFBBFBBRLL
|
||||
BFFBBFFLLR
|
||||
FBBBFFBLRL
|
||||
BFFFBFFRLR
|
||||
FFFBFFBRLR
|
||||
BFFBBBFLLL
|
||||
FBBBBFFRLL
|
||||
FFFFBBBRLR
|
||||
FBFFBFFLRR
|
||||
FBFBFBBRRL
|
||||
FFFFFFBRRR
|
||||
FFFBBBFLRL
|
||||
FBFFBFBLLR
|
||||
FFFBBBBLRL
|
||||
BBFBFFBLLL
|
||||
FBFFFFBLLR
|
||||
BBFBFBBRRR
|
||||
BFBFFFBRRR
|
||||
FBBFBFFRLL
|
||||
FBBBBFFRLR
|
||||
FFBBFBBLRL
|
||||
BBFBFFBLLR
|
||||
FBBBBBBLRL
|
||||
BFFFBBFLLL
|
||||
BBFBBFFLLR
|
||||
FBFFBFBLRL
|
||||
BFFFBBBLRR
|
||||
BBFFFFFRRR
|
||||
BFBFBBBRLR
|
||||
BBFFFBFLRR
|
||||
FBBFBBFLLR
|
||||
BBFBFFBLRR
|
||||
BFBBBFFLRR
|
||||
FBBFBFFRRL
|
||||
FBFBFBBLRR
|
||||
BFBBFFBRLL
|
||||
FFFBBFBRLR
|
||||
BFFBBBFRRR
|
||||
FBFFBFFRLR
|
||||
FFFBBBBRLL
|
||||
FFFFFBBRLR
|
||||
FBBFBFBLLR
|
||||
FBBFBBFLRR
|
||||
BBFFBBFLLR
|
||||
FFFBFBBLLR
|
||||
FFBFBFFLRR
|
||||
BFBBFBFRLL
|
||||
BFFFFBFRRR
|
||||
BBFBFFFLRL
|
||||
BFFFFBFLLL
|
||||
FBFBFBFLRL
|
||||
BFBBFBBLLR
|
||||
BFFBFFFRLL
|
||||
BBFBFFFRLR
|
||||
BBFFBFFRLL
|
||||
FFFBFBBRLR
|
||||
FBFBBBFLRL
|
||||
FFBFFBBRLR
|
||||
BBFFFBBLRL
|
||||
BFBBBBFLRR
|
||||
FFBFFFBLRL
|
||||
FFBBBFBRLL
|
||||
BBFFBFFLRR
|
||||
BBFFBFFRLR
|
||||
FFFFFBFRRR
|
||||
BBFBFBBLRL
|
||||
BFFBBBBLLL
|
||||
FBBBBFBRRR
|
||||
FFBBBBBLRL
|
||||
FBBFBBFRRR
|
||||
FFBBFFBRLL
|
||||
BFBFBFBLRR
|
||||
BBFBFFFRRR
|
||||
BFFFBBFRRR
|
||||
FBFBFFFLLL
|
||||
FBBFBFBRRR
|
||||
BBFFBFBLLR
|
||||
BBFBFBFLRR
|
||||
BFFFFBBLRL
|
||||
BFBBBFFLRL
|
||||
BBFBFFBLRL
|
||||
BFFBBFFRLL
|
||||
FBFFBFFLLR
|
||||
FBFBFBBLLL
|
||||
BBFBFBFLRL
|
||||
BBFFBBBLRL
|
||||
FFFFFBBRLL
|
||||
FFFBBBBRRR
|
||||
FFBBFFFRLR
|
||||
FFBFFFBRRR
|
||||
FBFBFFBLRR
|
||||
FFBFFBBLLL
|
||||
FBBFBBFLRL
|
||||
FBFFBBBLRL
|
||||
FBBBBFFRRR
|
||||
BFBBBBBLLR
|
||||
FFBFBBBLRR
|
||||
FFFFBFBLRR
|
||||
BFFFFFFRLL
|
||||
FBBFFFBLRR
|
||||
BFBBBBBRLL
|
||||
FFBBFFBLRL
|
||||
BFBBBFFRLR
|
||||
FFBFFBFLLL
|
||||
FFBBFBFRLR
|
||||
BFBFFBBLRR
|
||||
FFFFBFFLRR
|
||||
FFBFFBFLRL
|
||||
BBFFBBFRRL
|
||||
FFBFFFFLLL
|
||||
BBFBFFBRLR
|
||||
FBFBFBBRLR
|
||||
BBFFBBBRRR
|
||||
FBFFBBBRLL
|
||||
BFBFFBBRRR
|
||||
BBFFFBFRLL
|
||||
FBBFBBBLRL
|
||||
FBBFFFFLRR
|
||||
BBFFFBBLLL
|
||||
FFBFFFFLRL
|
||||
FBBFFBFLRL
|
||||
FBBBBFFLLR
|
||||
BFBBFBFRRR
|
||||
FBBFFFBLLL
|
||||
FFBFBFFRLL
|
||||
FFFBBBFLRR
|
||||
FFFBFFFLRR
|
||||
FBFFBFFRRR
|
||||
BFFFBFFLLR
|
||||
BFFFFFFRLR
|
||||
BFFFBFFLLL
|
||||
FBBBFBBRRL
|
||||
BFBFFFBLLL
|
||||
FBFBBBBRRR
|
||||
BFBBBFBRLR
|
||||
BBFFFFBRLR
|
||||
FBFFFFFRLL
|
||||
FBBFFBBRLR
|
||||
BBFBBFFLRR
|
||||
BBFFBFFLLR
|
||||
BBFFBBFRLL
|
||||
FBFFFFFRRL
|
||||
FFBFBBFRRR
|
||||
FFBFFFFRLL
|
||||
BFFFFBBLRR
|
||||
BFBFBFBLRL
|
||||
FBBFFFFRRR
|
||||
FFBBFBBRRR
|
||||
BFBBBBBRLR
|
||||
FBFFFBBLLR
|
||||
BBFFFBFRLR
|
||||
FBFFFBBRRR
|
||||
FBBFFBFRLR
|
||||
BFFFBFBRRR
|
||||
FFBBBBBLLL
|
||||
FFFFFBFLLR
|
||||
FBBFBFBRLL
|
||||
BFBFBFBRRL
|
||||
BBFFFFBRRL
|
||||
FFBFBBFLLR
|
||||
FFBBBFFRRL
|
||||
FBFFBFBRLR
|
||||
FBBFFFFRLL
|
||||
BFFBFFFLLR
|
||||
FBFFFBBLRR
|
||||
BFFBFFFLLL
|
||||
BFBFBBBRRR
|
||||
BFFFFBFLRL
|
||||
FFFFBFBLLL
|
||||
FFFBFFBLLL
|
||||
BFFFBBFRRL
|
||||
BFBFBBFRLL
|
||||
FFFBBBBLLL
|
||||
BFFBFBBRLR
|
||||
BFBBBBBLRR
|
||||
BFBBBFBRRL
|
||||
FFBFFFBRLR
|
||||
BFFBFFFLRL
|
||||
FFBFBBBLLL
|
||||
BFBFBBFRRR
|
||||
BFBFFBFRRR
|
||||
FFBFFFBRLL
|
||||
FBFFFFFLRL
|
||||
BBFFBBFLLL
|
||||
BFBFBBBRLL
|
||||
FFFBFFFRRL
|
||||
FBBBBBBLLR
|
||||
FFFBFBBLRL
|
||||
FBBFBBFRLL
|
||||
FFBFFFFRRR
|
||||
FFFBBBFLLR
|
||||
BFFBBFFRLR
|
||||
FFFFFBFLRR
|
||||
FFFBBBBLLR
|
||||
FBFFBFBRRL
|
||||
FBBFFFFLLL
|
||||
FFFFFBFRRL
|
||||
BFFBBBFRLL
|
||||
FFFBBFFRLL
|
||||
FFFBBFFLRR
|
||||
FFFFBBFRLL
|
||||
BFBBBBBRRR
|
||||
BFFBFBFLLL
|
||||
BBFBFBFLLR
|
||||
FFBBBBFRLR
|
||||
FFFBBBFRLL
|
||||
BFBBBBFRRR
|
||||
FBFBFFBRLR
|
||||
FFBFBBFRRL
|
||||
BBFFBBBRRL
|
||||
FFBFBBFRLR
|
||||
FFFFBFFRLL
|
||||
FBFFFBBRLL
|
||||
BBFFBFBRRL
|
||||
BFBFBFBLLR
|
||||
FBFBFBBLRL
|
||||
FBBFFFFRRL
|
||||
FFFBBFFRRR
|
||||
FFBBBBBLRR
|
||||
BBFBFBBLRR
|
||||
FFFFBBBLRR
|
||||
FFBBBBBRLL
|
||||
FFBFFFBRRL
|
||||
BFBBFFFRLL
|
||||
FBBBFBFRLL
|
||||
BBFFBFFLRL
|
||||
BBFFBFBRLR
|
||||
BFFBBBBRRR
|
||||
FBBBBBBRRL
|
||||
BBFBFFFRLL
|
||||
BFFBBFFRRR
|
||||
BFBBFFFRRL
|
||||
FFBFFBFLRR
|
||||
FBFBBFFRLL
|
||||
FBBFBBFRRL
|
||||
BBFBBFFRRR
|
||||
FFBBFBFRRL
|
||||
FFBBFBFLLL
|
||||
FBBFFFFLLR
|
||||
BFBFFBBRLR
|
||||
BFBBFFFLLR
|
||||
FBBBFFFLLL
|
||||
FFFBFFBLRR
|
||||
FFFBFBFRLR
|
||||
BFFBBBBRLR
|
||||
FBFFBBBLLR
|
||||
FFFFBBBRRR
|
||||
FFBBBBFLLL
|
||||
FBBBBFBLLR
|
||||
BFBFBFFRRL
|
||||
BBFFBBBLRR
|
||||
FBBFFBFRRL
|
||||
FFFBBBFLLL
|
||||
BFFFFBBLLL
|
||||
BBFBFBFRRR
|
||||
BFBBBFBLRR
|
||||
FBBFBBBLLR
|
||||
FFBBBBFLRL
|
||||
FFFBFFBLRL
|
||||
FBBBFFBRRL
|
||||
BFFBBFBRLL
|
||||
BFBFBFBRRR
|
||||
BBFBFBBRLL
|
||||
FBFFFBFRLL
|
||||
BFFFBFBLRR
|
||||
BFBFFFFLRL
|
||||
BBFFFFBLRR
|
||||
BFBBFFBRRL
|
||||
BBFBFBBLLR
|
||||
FFFBBBFRRL
|
||||
BFBBBFFRRL
|
||||
FFBFFBFLLR
|
||||
FFBBBFBLLL
|
||||
FBFBBBFLLL
|
||||
FFBBBBBRLR
|
||||
BBFFBBBRLL
|
||||
BFBFBBBRRL
|
||||
FFBBFBBRLL
|
||||
FBFBBFBLRL
|
||||
BBFFBFBLLL
|
||||
FBFBFFFLRL
|
||||
FFBFFBBLRL
|
||||
FFBFBBFLRL
|
||||
BBFBFBBLLL
|
||||
FFBBFBFRLL
|
||||
BBFBBFFLLL
|
||||
FBFFFFBLRL
|
||||
FBFBBBFRLR
|
||||
FFBFFBFRLL
|
||||
FBBFFFBRRR
|
||||
FBFBFFBLRL
|
||||
BFFFFBBLLR
|
||||
FBFBFBBRRR
|
||||
BBFFBBFLRL
|
||||
BFBBFFFRLR
|
||||
FBFFFFFLLR
|
||||
FBBFFBBLLL
|
||||
FFFFFBBRRL
|
||||
FFFBBFBRRL
|
||||
BFFBBBBRRL
|
||||
FBFFFBFLRL
|
||||
FFBBFFFLLR
|
||||
FBBBBBBLRR
|
||||
BFFFBBFRLL
|
||||
FFBFFFBLLR
|
||||
FBBBFFFRLL
|
||||
FFFFBBBLRL
|
||||
BBFFBFBLRR
|
||||
FFFFBBFLRR
|
||||
BFFBFBFRLR
|
||||
FFBFBBBLRL
|
||||
FBFBFBFLLR
|
||||
FFBBFBBRLR
|
||||
BFBFBFFRRR
|
||||
BBFFFFBRLL
|
||||
FFBFBFFRRR
|
||||
FFBFBBFLRR
|
||||
BFBBFBFLRR
|
||||
FFFFBBBLLR
|
||||
FFBBBBBRRL
|
||||
FBBFFBBRRR
|
||||
FFFBBBBRLR
|
||||
BFFBBBFLRL
|
||||
BFBBFFBRRR
|
||||
BBFFBBFRLR
|
||||
FBBBBBFLRL
|
||||
FFFBBFFLLL
|
||||
BFBBBFFRLL
|
||||
FBFFFFFLLL
|
||||
FBFBBFBLLL
|
||||
FFFBFFBRRR
|
||||
BFBFBFFLLL
|
||||
BFBFBFBLLL
|
||||
BFBBBFFLLL
|
||||
FFFFBBFRLR
|
||||
BFFBBFBRRL
|
||||
BFBBFBBLLL
|
||||
FBBFBFBRLR
|
||||
BFFFBFFLRL
|
||||
FBFBBFFLRL
|
||||
FFFFFBFLLL
|
||||
FBBFFBFRRR
|
||||
FBFBBBBLLL
|
||||
FBBBBBFRLR
|
||||
FBFFBBFRLL
|
||||
FFBFFBFRRR
|
||||
FFBFFFFRRL
|
||||
BFFBFBBLLR
|
||||
BFBBFBBRRR
|
||||
FFBBFBBLRR
|
||||
FBFFFFBRLR
|
||||
FFBBBBFRLL
|
||||
BBFFFBFRRR
|
||||
FFFBFBBRRR
|
||||
BFFFBFFRLL
|
||||
BFFBBBBLRR
|
||||
FBBBBFBLLL
|
||||
BFFFFFFLLR
|
||||
BFBFFFFLRR
|
||||
BFFBBBBLLR
|
||||
FFBBBFBRRR
|
||||
FBBFBFFRRR
|
||||
FBBFFFBRLR
|
||||
BFBFBBFRLR
|
||||
BFFBFFBRLL
|
||||
FBFBBFBRLR
|
||||
BFFFFFBLRR
|
||||
BFFBFFBRRR
|
||||
BFBFFBFLRL
|
||||
BBFFFBFLLL
|
||||
BBFBFBFLLL
|
||||
BFBFBFFLRL
|
||||
FBBFBFFLLL
|
||||
FBFFBFBLLL
|
||||
BFFFBFBRLR
|
||||
FFFBFFFRLL
|
||||
BBFBFFFLLL
|
||||
BFFFBBBRLR
|
||||
FBFBFBFLRR
|
||||
FFBBBBFRRR
|
||||
FBFBFBFRLR
|
||||
BBFFBFFLLL
|
||||
FBBBBFBLRR
|
||||
FBBBBBFLLR
|
||||
BFBFFFFRLL
|
||||
FBFFFBFLRR
|
||||
FFBFFFBLLL
|
||||
BFBFFBBLLR
|
||||
FFBBBFBLLR
|
||||
FBFFFBBLRL
|
||||
FFBBBFFRRR
|
||||
FBBBFBFLLR
|
||||
FBBBBFFLRR
|
||||
FBFFBBBLLL
|
||||
FFBFBFFLLR
|
||||
FFFFFBBLLL
|
||||
BFFFFFBLRL
|
||||
BBFFFFBRRR
|
||||
BFBFFFBRRL
|
||||
BBFFFFFRRL
|
||||
BFBBBBBLRL
|
||||
FBBBBFBRLL
|
||||
FFBFFFFLRR
|
||||
BFBBBFFLLR
|
||||
BFFFFBBRLR
|
||||
FFBBFFBRRL
|
||||
BFBFBFFRLR
|
||||
FFBBBBFLRR
|
||||
BFBFFBFLLL
|
||||
FBBFFBBRRL
|
||||
FFFBBFFLLR
|
||||
FFFFBFFRRR
|
||||
BFFBBBFRLR
|
||||
BFFFFFBRRR
|
||||
FFBFBFBLLR
|
||||
FFFBBBFRRR
|
||||
BBFBFBFRLR
|
||||
FFBBFFBLLR
|
||||
FBFBBBBLRL
|
||||
FFFBFBFLRL
|
||||
FFFFBBBRLL
|
||||
FBFFFFBRRR
|
||||
FFBBBFFRLL
|
||||
FBFBFFBRRL
|
||||
BFFBFFBLLL
|
||||
FFFFFBFRLL
|
||||
BBFFFBBRLL
|
||||
FBBFBFBLRL
|
||||
BFBFBFFLLR
|
||||
BFBBFBBRLR
|
||||
FFBFFFBLRR
|
||||
BBFBFFFLRR
|
||||
FBBFBBBLRR
|
||||
FBBBFFBLLR
|
||||
BFBBBBBRRL
|
||||
BFBBFFBLLR
|
||||
FBBBFBFLRR
|
||||
BFFBFBBLLL
|
||||
BFFBFFBLRL
|
||||
BFBFBFBRLR
|
||||
FBFFBBBLRR
|
||||
FBFBBBBRRL
|
||||
BFBFBBFLLL
|
||||
FBFBBBBLRR
|
||||
BFFBBFBRLR
|
||||
FFFBFBFRRL
|
||||
BFFFFBBRRR
|
||||
FBFFBBFRLR
|
||||
BFBBFBFLRL
|
||||
BFFFBBBLLL
|
||||
BFFFFFBRLR
|
||||
BBFFFFBLRL
|
||||
BFFBFFFRRR
|
||||
BFBBBBFRLL
|
||||
FBFBBFBRLL
|
||||
FBBFFFBLLR
|
||||
FFFBBFBRRR
|
||||
FBFBBBBLLR
|
||||
FFFFBFFLLL
|
||||
FFFFFBFRLR
|
||||
BFFFFBFRLR
|
||||
FBBFFFBLRL
|
||||
BFBFFBFLRR
|
||||
FFFFFFBRLL
|
||||
FFBBFFFLRL
|
||||
BBFFFFBLLL
|
||||
FFFBBFFRRL
|
||||
FBBFBBFLLL
|
||||
FBFFBFBLRR
|
||||
FFBBFBBLLL
|
||||
BFFFBBBRRR
|
||||
BFFFBBBLLR
|
||||
BBFBFBFRLL
|
||||
BFFFBBFRLR
|
||||
FFBFBBBRRL
|
||||
FBFBFFFRRR
|
||||
FBBBBBBRRR
|
||||
FFBBBFFLRL
|
||||
BFFBFBBRRL
|
||||
BFBFBFFRLL
|
||||
BFFFBFFRRL
|
||||
BBFFBBBRLR
|
||||
BBFFFFFRLL
|
||||
FFBBFFBRRR
|
||||
FBBFBFFLLR
|
||||
FBBBFBBRLR
|
||||
FFBFFBBRRL
|
||||
FBBBFFBLLL
|
||||
FBBFFFBRRL
|
||||
BFFBFFFRRL
|
||||
FBBFBFFRLR
|
||||
BFFBBBBLRL
|
||||
FFBFFBBRRR
|
||||
FBFBBBFLRR
|
||||
BFBBBBFRLR
|
||||
FFFBFBFLLL
|
||||
FBBBBBBRLL
|
||||
FFBFFBBLRR
|
||||
BBFFFFFLLR
|
||||
FFFFBBFRRL
|
||||
BBFFFFFRLR
|
||||
FBFBFFBRLL
|
||||
BBFFBFBRRR
|
||||
FBFFFBFLLR
|
||||
FFBBFBBLLR
|
||||
FBFBFFFRLL
|
||||
BFBBBFBRLL
|
||||
FFFFFFBRLR
|
||||
FFBBFFFRRL
|
||||
BBFBBFFRLL
|
||||
FBBFFFFRLR
|
||||
BBFBBFFLRL
|
||||
FBBFFBBLLR
|
||||
BFFFBBFLLR
|
||||
BBFBFBBRRL
|
||||
BFFBFFBLLR
|
||||
FFBBFBFRRR
|
||||
FBBBBFBRLR
|
||||
FFFBFBFLLR
|
||||
FFBBBFBRRL
|
||||
FFBBBFFLLL
|
||||
FFBFBBBRLR
|
||||
FBFBBFFLRR
|
||||
FFFBFBBRRL
|
||||
FFFFBFBRRR
|
||||
FFFFBBBLLL
|
||||
FFFBFBFLRR
|
||||
BFBBBFBLLR
|
||||
BFBFFFFRRL
|
||||
BFBBFFBLRR
|
||||
FFBFFBFRRL
|
||||
BFBBFBFRRL
|
||||
BFFFFFBRRL
|
||||
FBBBBFFLLL
|
||||
FFBFBBBLLR
|
||||
FBBBFBFRLR
|
||||
FFFBBFFRLR
|
||||
BBFFBFBRLL
|
||||
BBFBFBFRRL
|
||||
FFBBBBFRRL
|
||||
FBBBFBBLRR
|
||||
BFFBFFBRLR
|
||||
FFBBFFBRLR
|
||||
FFBFBFBLRR
|
||||
BFBFFFBLLR
|
||||
BFFFBBFLRL
|
||||
FBBBFBBRLL
|
||||
BBFFFBFLLR
|
||||
BBFFFBBRRL
|
||||
BFBFFFBRLL
|
||||
BFBFFFBLRR
|
||||
FFBFBFFRLR
|
||||
BFFFFFFRRL
|
||||
BFFFBFFLRR
|
||||
BFBBBBFLRL
|
||||
FFFBFFFLLR
|
||||
BFFFFFFLRR
|
||||
BBFBBFFRRL
|
||||
BFFFFFFLRL
|
||||
FFFFBFBRLL
|
||||
BFFBBFBLRR
|
||||
FFFFBFFLRL
|
||||
BBFFFFFLRL
|
||||
FBBFBFBLRR
|
||||
FBFBBFFRLR
|
||||
FFFFFBBRRR
|
||||
BFFFBFBRRL
|
||||
FBFFBFBRRR
|
||||
BBFFFBBLLR
|
||||
BFFBFBBLRR
|
||||
FFFBFBFRLL
|
||||
FBFBBFFRRR
|
||||
FFBFBBBRRR
|
||||
BFBFFFBRLR
|
||||
FBBFFFBRLL
|
||||
FFBFBFBRRL
|
||||
FFBBBFBLRL
|
||||
FBBFBBBRRL
|
||||
FBFFBFBRLL
|
||||
BFBFBBFLRL
|
||||
FFFBBBBLRR
|
||||
BFFBFBBRLL
|
||||
FFFBFFFRLR
|
||||
FBFBFFBLLR
|
||||
FBFFBBFLLL
|
||||
FBBBFBBRRR
|
||||
FBBFBBBRRR
|
||||
FBFBBBFRRL
|
||||
BFBBFBBRRL
|
||||
BFBFBBBLRL
|
||||
FBBFBBBRLR
|
||||
FFBBFFBLRR
|
||||
FBBFBFFLRL
|
||||
FBFBFFBRRR
|
||||
FFBBBBBLLR
|
||||
BFBBFFFLRR
|
||||
FFBBFBFLRR
|
||||
BFBBBBFLLR
|
||||
BFBFFBBRRL
|
||||
FBFBBFFRRL
|
||||
BFFFFFBLLL
|
||||
FBBBBFBRRL
|
||||
FBBBFFBRLL
|
||||
BBFBFFFLLR
|
||||
FFFBBFBLLL
|
||||
BFFFBBBRLL
|
||||
BFBFFBBLLL
|
||||
BFBFBBBLLR
|
||||
FBFFBBFLRL
|
||||
FFFFBBFLRL
|
||||
FBBFFFFLRL
|
||||
FBBBBFFRRL
|
||||
BFBBFBBLRR
|
||||
BFBFBFBRLL
|
||||
FBBBFBFLLL
|
||||
FBFBBBBRLL
|
||||
FBBBFFBLRR
|
||||
FFBBFBFLRL
|
||||
FFFFBFBLRL
|
||||
FFBBBFFLRR
|
||||
FFBBFFFRRR
|
||||
FFBFFBBRLL
|
||||
FFFFBFFRRL
|
||||
FBBFFBFRLL
|
||||
BFFFBBFLRR
|
||||
BFBFFBBRLL
|
||||
BFFBBFFLLL
|
||||
FBBBBBBLLL
|
||||
BFFBFBFRRR
|
||||
BFBFFFFRLR
|
||||
BFFBFBBLRL
|
||||
BFBBBFBLRL
|
||||
FBFBFBFRLL
|
||||
FBBFBFFLRR
|
||||
BFBBBFBLLL
|
||||
BFFBBBFLRR
|
||||
BFBBBBFLLL
|
||||
BFBBFFBRLR
|
||||
FFFBBFBLRR
|
||||
FFFFBBFLLR
|
||||
FFBFFBBLLR
|
||||
FBFBBBFLLR
|
||||
BFBBBFBRRR
|
||||
BFFFFFBRLL
|
||||
BBFBFFBRRL
|
||||
BFBBFFBLLL
|
||||
FFFBBBBRRL
|
||||
FBFBBBFRRR
|
||||
BFFBBFBLRL
|
||||
BFFBFFFRLR
|
||||
FFFFFBBLRR
|
||||
FBFBFFFLLR
|
||||
FFBFFFFRLR
|
||||
FBFFFBFRRR
|
||||
FBFBFBFRRR
|
||||
FFBFBFBRLL
|
||||
FFFFFFBRRL
|
||||
FFBBBBBRRR
|
||||
FFFBBFFLRL
|
||||
BFFFBFBLLL
|
||||
FBFFFFBLRR
|
||||
FBBBBBBRLR
|
||||
FBFBBFBRRL
|
||||
FFBBFFBLLL
|
||||
FBFFBBFRRR
|
||||
FBFFFFBLLL
|
||||
BBFBFFFRRL
|
||||
FFFFBFBLLR
|
||||
BFFBFBFLLR
|
||||
BBFBFFBRRR
|
||||
FBFFFFFRRR
|
||||
FFBFBFFLRL
|
||||
BFFBBFBLLR
|
||||
FBBBFFFRRL
|
||||
BFFBBFBRRR
|
||||
BFBFBBFLRR
|
||||
FBBBFFFRLR
|
||||
FBBFBFBLLL
|
||||
FBFBFBFLLL
|
||||
BFBBFFFLRL
|
||||
BBFFBBBLLR
|
||||
BFFFFBBRRL
|
||||
FFFBBFBLLR
|
||||
BFFFFBFRLL
|
||||
FFFFFBBLRL
|
||||
FBFBBBFRLL
|
||||
BFBFFBFRLL
|
||||
FBFFBFFLLL
|
||||
FBFBFBBLLR
|
||||
FFFFBFBRLR
|
||||
BFFFBFBLLR
|
||||
BFFBFFBLRR
|
||||
BFFFFBFLRR
|
||||
FBBFFBBRLL
|
||||
FFFFBBBRRL
|
||||
FBBBFFBRRR
|
||||
BFFBFBFRLL
|
||||
BBFFBFBLRL
|
||||
FFFBBFBLRL
|
||||
BBFFFFBLLR
|
||||
FBFFFFBRLL
|
||||
BFBFBBBLLL
|
||||
FBFBBFFLLR
|
||||
FBBBFFFLRR
|
||||
33
2020/days/05/test_day5.py
Normal file
33
2020/days/05/test_day5.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import day5 as aoc
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "input").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == {119, 357, 567, 820}
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == 820
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example2):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example2) == 640
|
||||
47
2020/days/06/day6.py
Executable file
47
2020/days/06/day6.py
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pprint import pprint
|
||||
|
||||
def parse(puzzle_input: str):
|
||||
"""Parse input"""
|
||||
records = [[list(y) for y in x.splitlines()] for x in puzzle_input.split('\n\n')]
|
||||
return records
|
||||
|
||||
def part1(data):
|
||||
"""Solve part 1"""
|
||||
results = []
|
||||
for group in data:
|
||||
result = set()
|
||||
for person in group:
|
||||
result |= set(person)
|
||||
results.append(len(result))
|
||||
return sum(results)
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
results = []
|
||||
for group in data:
|
||||
result = set(group[0])
|
||||
for person in group:
|
||||
result &= set(person)
|
||||
results.append(len(result))
|
||||
return sum(results)
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data)
|
||||
solution2 = part2(data)
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
15
2020/days/06/example1
Normal file
15
2020/days/06/example1
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
abc
|
||||
|
||||
a
|
||||
b
|
||||
c
|
||||
|
||||
ab
|
||||
ac
|
||||
|
||||
a
|
||||
a
|
||||
a
|
||||
a
|
||||
|
||||
b
|
||||
2199
2020/days/06/input
Normal file
2199
2020/days/06/input
Normal file
File diff suppressed because it is too large
Load diff
55
2020/days/06/test_day6.py
Normal file
55
2020/days/06/test_day6.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import day6 as aoc
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "example2").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == [
|
||||
[
|
||||
['a', 'b', 'c']
|
||||
],
|
||||
[
|
||||
['a'],
|
||||
['b'],
|
||||
['c']
|
||||
],
|
||||
[
|
||||
['a', 'b'],
|
||||
['a', 'c']
|
||||
],
|
||||
[
|
||||
['a'],
|
||||
['a'],
|
||||
['a'],
|
||||
['a']
|
||||
],
|
||||
[
|
||||
['b']
|
||||
]
|
||||
]
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == 11
|
||||
|
||||
# @pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example1):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example1) == 6
|
||||
6
2020/main.py
Normal file
6
2020/main.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def main():
|
||||
print("Hello from 2020!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
9
2020/pyproject.toml
Normal file
9
2020/pyproject.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[project]
|
||||
name = "AOC-2020"
|
||||
version = "0.1.0"
|
||||
description = "Advent of code 2020 in python."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"pytest>=9.0.3",
|
||||
]
|
||||
31
2020/template/template.py
Executable file
31
2020/template/template.py
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pprint import pprint
|
||||
|
||||
def parse(puzzle_input: str):
|
||||
"""Parse input"""
|
||||
|
||||
def part1(data):
|
||||
"""Solve part 1"""
|
||||
|
||||
def part2(data):
|
||||
"""Solve part 2"""
|
||||
|
||||
def solve(puzzle_input):
|
||||
"""Solve the puzzle for the given input"""
|
||||
data = parse(puzzle_input)
|
||||
solution1 = part1(data)
|
||||
solution2 = part2(data)
|
||||
|
||||
return solution1, solution2
|
||||
|
||||
if __name__ == "__main__":
|
||||
for path in sys.argv[1:]:
|
||||
print(f"{path}:")
|
||||
puzzle_input = pathlib.Path(path).read_text().strip()
|
||||
solutions = solve(puzzle_input)
|
||||
print("\n".join(str(solution) for solution in solutions))
|
||||
33
2020/template/test_template.py
Normal file
33
2020/template/test_template.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import pytest
|
||||
import template as aoc
|
||||
|
||||
PUZZLE_DIR = pathlib.Path(__file__).parent
|
||||
|
||||
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
|
||||
@pytest.fixture
|
||||
def example1():
|
||||
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.fixture
|
||||
def example2():
|
||||
puzzle_input = (PUZZLE_DIR / "example2").read_text().strip()
|
||||
return aoc.parse(puzzle_input)
|
||||
|
||||
@pytest.mark.skip(reason="Not implemented")
|
||||
def test_parse_example1(example1):
|
||||
"""Test that input is parsed properly"""
|
||||
assert example1 == ...
|
||||
|
||||
@pytest.mark.skip(reason="Not implemented")
|
||||
def test_part1_example1(example1):
|
||||
"""Test part 1 on example input"""
|
||||
assert aoc.part1(example1) == ...
|
||||
|
||||
@pytest.mark.skip(reason="Not implemented")
|
||||
def test_part2_example2(example2):
|
||||
"""Test part 2 on example input"""
|
||||
assert aoc.part2(example2) == ...
|
||||
75
2020/uv.lock
generated
Normal file
75
2020/uv.lock
generated
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
version = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.13"
|
||||
|
||||
[[package]]
|
||||
name = "aoc-2020"
|
||||
version = "0.1.0"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "pytest" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "pytest", specifier = ">=9.0.3" }]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "26.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/df/de/0d2b39fb4af88a0258f3bac87dfcbb48e73fbdea4a2ed0e2213f9a4c2f9a/packaging-26.1.tar.gz", hash = "sha256:f042152b681c4bfac5cae2742a55e103d27ab2ec0f3d88037136b6bfe7c9c5de", size = 215519, upload-time = "2026-04-14T21:12:49.362Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/c2/920ef838e2f0028c8262f16101ec09ebd5969864e5a64c4c05fad0617c56/packaging-26.1-py3-none-any.whl", hash = "sha256:5d9c0669c6285e491e0ced2eee587eaf67b670d94a19e94e3984a481aba6802f", size = 95831, upload-time = "2026-04-14T21:12:47.56Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.20.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991, upload-time = "2026-03-29T13:29:33.898Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151, upload-time = "2026-03-29T13:29:30.038Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "9.0.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "iniconfig" },
|
||||
{ name = "packaging" },
|
||||
{ name = "pluggy" },
|
||||
{ name = "pygments" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7d/0d/549bd94f1a0a402dc8cf64563a117c0f3765662e2e668477624baeec44d5/pytest-9.0.3.tar.gz", hash = "sha256:b86ada508af81d19edeb213c681b1d48246c1a91d304c6c81a427674c17eb91c", size = 1572165, upload-time = "2026-04-07T17:16:18.027Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/24/a372aaf5c9b7208e7112038812994107bc65a84cd00e0354a88c2c77a617/pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9", size = 375249, upload-time = "2026-04-07T17:16:16.13Z" },
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue