-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ted Cassirer
committed
Dec 1, 2023
1 parent
f971ffe
commit 36a3600
Showing
244 changed files
with
1,558 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
.vscode | ||
__pycache__/ | ||
venv/ | ||
*.egg-info/ | ||
*.pyc | ||
*.pyc | ||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ |
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[tool.poetry] | ||
name = "advent-of-code" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Ted Cassirer <[email protected]>"] | ||
readme = "README.md" | ||
|
||
packages = [ | ||
{include = "aoc2015", from = "src/"}, | ||
{include = "aoc2016", from = "src/"}, | ||
{include = "aoc2019", from = "src/"}, | ||
{include = "aoc2020", from = "src/"}, | ||
{include = "aoc2021", from = "src/"}, | ||
{include = "aoc2022", from = "src/"}, | ||
{include = "scripts", from = "src/"}, | ||
] | ||
|
||
|
||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
advent-of-code-data = "^2.0.1" | ||
black = "^23.11.0" | ||
numpy = "^1.26.2" | ||
pytest = "^7.4.3" | ||
poetry = "^1.7.1" | ||
click = "^8.1.7" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
# | ||
#[tool.poetry.scripts] | ||
#aoccas = "scripts.cli:main" | ||
#bsamseth = "aoc_runner:plugin" | ||
|
||
[tool.poetry.plugins."cli"] | ||
foo = "cli" | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = "tests/" | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import importlib | ||
|
||
|
||
def solve(day, year, data): | ||
moduleName = "aoc{}.day{}".format(year, day) | ||
mod = importlib.import_module(moduleName) | ||
part1 = mod.part1(data) | ||
part2 = mod.part2(data) | ||
return part1, part2 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
def part1(data): | ||
def get_edge_sum(line): | ||
digits = [int(char) for char in line if char.isdigit()] | ||
res = digits[0] * 10 + digits[-1] | ||
return res | ||
|
||
return sum(map(get_edge_sum, data.splitlines())) | ||
|
||
|
||
def part2(data): | ||
spelled_out = { | ||
"1": 1, | ||
"2": 2, | ||
"3": 3, | ||
"4": 4, | ||
"5": 5, | ||
"6": 6, | ||
"7": 7, | ||
"8": 8, | ||
"9": 9, | ||
"one": 1, | ||
"two": 2, | ||
"three": 3, | ||
"four": 4, | ||
"five": 5, | ||
"six": 6, | ||
"seven": 7, | ||
"eight": 8, | ||
"nine": 9, | ||
} | ||
result = 0 | ||
for line in data.splitlines(): | ||
left_digit = min(((line + k).find(k), v) for k, v in spelled_out.items())[1] | ||
right_digit = max((line.rfind(k), v) for k, v in spelled_out.items())[1] | ||
result += 10 * left_digit + right_digit | ||
return result | ||
|
||
|
||
if __name__ == "__main__": | ||
from aocd import get_data | ||
|
||
data = get_data(year=2023, day=1) | ||
print(part1(data)) | ||
print(part2(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import importlib | ||
|
||
# def solve(day, year, data): | ||
# moduleName = "aoc{}.day{}".format(year, day) | ||
# mod = importlib.import_module(moduleName) | ||
# part1 = mod.part1(data) | ||
# part2 = mod.part2(data) | ||
# return part1, part2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# import argparse | ||
# import importlib | ||
# from aocd import get_data | ||
# parser = argparse.ArgumentParser(description="Process some integers.") | ||
# parser.add_argument("--year", "-y", type=int, default=2021) | ||
# parser.add_argument("--day", "-d", type=int) | ||
# parser.add_argument("--file", "-f", type=argparse.FileType("r")) | ||
# | ||
# args = parser.parse_args() | ||
# | ||
# | ||
# | ||
# | ||
# def main(): | ||
# moduleName = "aoc{}.day{}".format(args.year, args.day) | ||
# try: | ||
# mod = importlib.import_module(moduleName) | ||
# except: | ||
# raise Exception(f"Unable to load module %s" % moduleName) | ||
# if args.file: | ||
# data = args.file.read() | ||
# else: | ||
# data = get_data(day=args.day, year=args.year) | ||
# part1 = mod.part1(data) | ||
# part2 = mod.part2(data) | ||
# | ||
# return part1, part2 | ||
# | ||
# | ||
# if __name__ == "__main__": | ||
# print(main()) | ||
|
||
|
||
import click | ||
|
||
|
||
@click.command() | ||
def mycommand(): | ||
"""Your command description.""" | ||
# Your command logic here | ||
print("Running my command...") | ||
|
||
|
||
print("poop") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2019 import day16 as aoc | ||
from aoc2019 import day16 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2019 import day20 as aoc | ||
from aoc2019 import day20 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2019 import day22 as aoc | ||
from aoc2019 import day22 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2019 import day7 as aoc | ||
from aoc2019 import day7 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import aoc_cas.aoc2020.day1 as aoc | ||
import aoc2020.day1 as aoc | ||
|
||
testData1 = """ | ||
1721 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day10 as aoc | ||
from aoc2020 import day10 as aoc | ||
|
||
|
||
data = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day11 as aoc | ||
from aoc2020 import day11 as aoc | ||
|
||
|
||
data = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day12 as aoc | ||
from aoc2020 import day12 as aoc | ||
|
||
|
||
data = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day13 as aoc | ||
from aoc2020 import day13 as aoc | ||
|
||
|
||
data = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day14 as aoc | ||
from aoc2020 import day14 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day15 as aoc | ||
from aoc2020 import day15 as aoc | ||
import pytest | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day16 as aoc | ||
from aoc2020 import day16 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day17 as aoc | ||
from aoc2020 import day17 as aoc | ||
|
||
|
||
data = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day18 as aoc | ||
from aoc2020 import day18 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day19 as aoc | ||
from aoc2020 import day19 as aoc | ||
|
||
data1 = """ | ||
0: 4 1 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import aoc_cas.aoc2020.day2 as aoc | ||
import aoc2020.day2 as aoc | ||
|
||
testData = """ | ||
1-3 a: abcde | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from aoc_cas.aoc2020 import day20 as aoc | ||
from aoc2020 import day20 as aoc | ||
|
||
|
||
def testPart1(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.