added templates and day 1's input and example1.

This commit is contained in:
gabe 2022-08-18 17:05:10 -05:00
parent e8deae0a61
commit 7fd7d753bb
6 changed files with 371 additions and 0 deletions

13
Pipfile Normal file
View file

@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
parse = "*"
pytest = "*"
[dev-packages]
[requires]
python_version = "3.9"

91
Pipfile.lock generated Normal file
View file

@ -0,0 +1,91 @@
{
"_meta": {
"hash": {
"sha256": "0f2e2e1eec7667a0a76ab90193491e106610a921be445eef118b5d170f2d175e"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.9"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"attrs": {
"hashes": [
"sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6",
"sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"
],
"markers": "python_version >= '3.5'",
"version": "==22.1.0"
},
"iniconfig": {
"hashes": [
"sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3",
"sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"
],
"version": "==1.1.1"
},
"packaging": {
"hashes": [
"sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",
"sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"
],
"markers": "python_version >= '3.6'",
"version": "==21.3"
},
"parse": {
"hashes": [
"sha256:9ff82852bcb65d139813e2a5197627a94966245c897796760a3a2a8eb66f020b"
],
"index": "pypi",
"version": "==1.19.0"
},
"pluggy": {
"hashes": [
"sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159",
"sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"
],
"markers": "python_version >= '3.6'",
"version": "==1.0.0"
},
"py": {
"hashes": [
"sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719",
"sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==1.11.0"
},
"pyparsing": {
"hashes": [
"sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb",
"sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"
],
"markers": "python_full_version >= '3.6.8'",
"version": "==3.0.9"
},
"pytest": {
"hashes": [
"sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c",
"sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"
],
"index": "pypi",
"version": "==7.1.2"
},
"tomli": {
"hashes": [
"sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
"sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
],
"markers": "python_version >= '3.7'",
"version": "==2.0.1"
}
},
"develop": {}
}

6
day1/example1 Normal file
View file

@ -0,0 +1,6 @@
1721
979
366
299
675
1456

200
day1/input Normal file
View 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

29
template.py Normal file
View file

@ -0,0 +1,29 @@
# aoc_template.py
import pathlib
import sys
import parse
def parse(puzzle_input):
"""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))

32
test_template.py Normal file
View file

@ -0,0 +1,32 @@
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) == ...