From c166b01f38b2bddc3f443773c18f5d5691007c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niko=20B=C3=B6ckerman?= Date: Thu, 17 Oct 2024 22:30:27 +0000 Subject: [PATCH] Introduce year selector Introduce year into the code base but not yet to the user API. --- adventofcode/answers.py | 108 +++++++++++++++---- adventofcode/main.py | 140 ++++++++++++++----------- adventofcode/y2023/__init__.py | 0 adventofcode/{ => y2023}/d1.py | 0 adventofcode/{ => y2023}/d10.py | 0 adventofcode/{ => y2023}/d11.py | 0 adventofcode/{ => y2023}/d12.py | 0 adventofcode/{ => y2023}/d13.py | 0 adventofcode/{ => y2023}/d14.py | 0 adventofcode/{ => y2023}/d15.py | 0 adventofcode/{ => y2023}/d16.py | 0 adventofcode/{ => y2023}/d17.py | 0 adventofcode/{ => y2023}/d18.py | 0 adventofcode/{ => y2023}/d19.py | 0 adventofcode/{ => y2023}/d2.py | 0 adventofcode/{ => y2023}/d20.py | 0 adventofcode/{ => y2023}/d3.py | 0 adventofcode/{ => y2023}/d4.py | 0 adventofcode/{ => y2023}/d5.py | 0 adventofcode/{ => y2023}/d6.py | 0 adventofcode/{ => y2023}/d7.py | 0 adventofcode/{ => y2023}/d8.py | 0 adventofcode/{ => y2023}/d9.py | 0 adventofcode/{ => y2023}/input-d1.txt | 0 adventofcode/{ => y2023}/input-d10.txt | 0 adventofcode/{ => y2023}/input-d11.txt | 0 adventofcode/{ => y2023}/input-d12.txt | 0 adventofcode/{ => y2023}/input-d13.txt | 0 adventofcode/{ => y2023}/input-d14.txt | 0 adventofcode/{ => y2023}/input-d15.txt | 0 adventofcode/{ => y2023}/input-d16.txt | 0 adventofcode/{ => y2023}/input-d17.txt | 0 adventofcode/{ => y2023}/input-d18.txt | 0 adventofcode/{ => y2023}/input-d19.txt | 0 adventofcode/{ => y2023}/input-d2.txt | 0 adventofcode/{ => y2023}/input-d20.txt | 0 adventofcode/{ => y2023}/input-d3.txt | 0 adventofcode/{ => y2023}/input-d4.txt | 0 adventofcode/{ => y2023}/input-d5.txt | 0 adventofcode/{ => y2023}/input-d6.txt | 0 adventofcode/{ => y2023}/input-d7.txt | 0 adventofcode/{ => y2023}/input-d8.txt | 0 adventofcode/{ => y2023}/input-d9.txt | 0 tests/{ => y2023}/test_d11.py | 2 +- tests/{ => y2023}/test_d13.py | 2 +- tests/{ => y2023}/test_d14.py | 2 +- tests/{ => y2023}/test_d20.py | 2 +- tests/{ => y2023}/test_d5.py | 2 +- tests/{ => y2023}/test_d8.py | 2 +- 49 files changed, 172 insertions(+), 88 deletions(-) create mode 100644 adventofcode/y2023/__init__.py rename adventofcode/{ => y2023}/d1.py (100%) rename adventofcode/{ => y2023}/d10.py (100%) rename adventofcode/{ => y2023}/d11.py (100%) rename adventofcode/{ => y2023}/d12.py (100%) rename adventofcode/{ => y2023}/d13.py (100%) rename adventofcode/{ => y2023}/d14.py (100%) rename adventofcode/{ => y2023}/d15.py (100%) rename adventofcode/{ => y2023}/d16.py (100%) rename adventofcode/{ => y2023}/d17.py (100%) rename adventofcode/{ => y2023}/d18.py (100%) rename adventofcode/{ => y2023}/d19.py (100%) rename adventofcode/{ => y2023}/d2.py (100%) rename adventofcode/{ => y2023}/d20.py (100%) rename adventofcode/{ => y2023}/d3.py (100%) rename adventofcode/{ => y2023}/d4.py (100%) rename adventofcode/{ => y2023}/d5.py (100%) rename adventofcode/{ => y2023}/d6.py (100%) rename adventofcode/{ => y2023}/d7.py (100%) rename adventofcode/{ => y2023}/d8.py (100%) rename adventofcode/{ => y2023}/d9.py (100%) rename adventofcode/{ => y2023}/input-d1.txt (100%) rename adventofcode/{ => y2023}/input-d10.txt (100%) rename adventofcode/{ => y2023}/input-d11.txt (100%) rename adventofcode/{ => y2023}/input-d12.txt (100%) rename adventofcode/{ => y2023}/input-d13.txt (100%) rename adventofcode/{ => y2023}/input-d14.txt (100%) rename adventofcode/{ => y2023}/input-d15.txt (100%) rename adventofcode/{ => y2023}/input-d16.txt (100%) rename adventofcode/{ => y2023}/input-d17.txt (100%) rename adventofcode/{ => y2023}/input-d18.txt (100%) rename adventofcode/{ => y2023}/input-d19.txt (100%) rename adventofcode/{ => y2023}/input-d2.txt (100%) rename adventofcode/{ => y2023}/input-d20.txt (100%) rename adventofcode/{ => y2023}/input-d3.txt (100%) rename adventofcode/{ => y2023}/input-d4.txt (100%) rename adventofcode/{ => y2023}/input-d5.txt (100%) rename adventofcode/{ => y2023}/input-d6.txt (100%) rename adventofcode/{ => y2023}/input-d7.txt (100%) rename adventofcode/{ => y2023}/input-d8.txt (100%) rename adventofcode/{ => y2023}/input-d9.txt (100%) rename tests/{ => y2023}/test_d11.py (90%) rename tests/{ => y2023}/test_d13.py (89%) rename tests/{ => y2023}/test_d14.py (88%) rename tests/{ => y2023}/test_d20.py (91%) rename tests/{ => y2023}/test_d5.py (93%) rename tests/{ => y2023}/test_d8.py (92%) diff --git a/adventofcode/answers.py b/adventofcode/answers.py index a6c2596..c4cfba5 100644 --- a/adventofcode/answers.py +++ b/adventofcode/answers.py @@ -1,24 +1,86 @@ -from typing import Any - -ANSWERS: dict[int, dict[int, Any]] = { - 1: {1: 54239, 2: 55343}, - 2: {1: 1931, 2: 83105}, - 3: {1: 556367, 2: 89471771}, - 4: {1: 20107, 2: 8172507}, - 5: {1: 111627841, 2: 69323688}, - 6: {1: 1108800, 2: 36919753}, - 7: {1: 251106089, 2: 249620106}, - 8: {1: 16271, 2: 14265111103729}, - 9: {1: 1731106378, 2: 1087}, - 10: {1: 6951, 2: 563}, - 11: {1: 9742154, 2: 411142919886}, - 12: {1: 7173, 2: 29826669191291}, - 13: {1: 37561, 2: 31108}, - 14: {1: 102497, 2: 105008}, - 15: {1: 515495, 2: 229349}, - 16: {1: 7482, 2: 7896}, - 17: {1: 870, 2: 1063}, - 18: {1: 45159, 2: 134549294799713}, - 19: {1: 406849, 2: 138625360533574}, - 20: {1: 731517480, 2: 244178746156661}, +from collections.abc import Iterator +from typing import Literal, NewType, overload + +from attrs import frozen + +type Problem = Literal[1, 2] +type AnswerType = int + +_ANSWERS: dict[int, dict[int, dict[Problem, AnswerType]]] = { + 2023: { + 1: {1: 54239, 2: 55343}, + 2: {1: 1931, 2: 83105}, + 3: {1: 556367, 2: 89471771}, + 4: {1: 20107, 2: 8172507}, + 5: {1: 111627841, 2: 69323688}, + 6: {1: 1108800, 2: 36919753}, + 7: {1: 251106089, 2: 249620106}, + 8: {1: 16271, 2: 14265111103729}, + 9: {1: 1731106378, 2: 1087}, + 10: {1: 6951, 2: 563}, + 11: {1: 9742154, 2: 411142919886}, + 12: {1: 7173, 2: 29826669191291}, + 13: {1: 37561, 2: 31108}, + 14: {1: 102497, 2: 105008}, + 15: {1: 515495, 2: 229349}, + 16: {1: 7482, 2: 7896}, + 17: {1: 870, 2: 1063}, + 18: {1: 45159, 2: 134549294799713}, + 19: {1: 406849, 2: 138625360533574}, + 20: {1: 731517480, 2: 244178746156661}, + }, } + +Year = NewType("Year", int) +Day = NewType("Day", int) + + +@frozen +class ProblemId: + year: Year + day: Day + problem: Problem + + +@frozen +class Answer(ProblemId): + answer: AnswerType + + +ANSWERS: dict[Year, dict[Day, dict[Problem, Answer]]] = { + (y := Year(year)): { + (d := Day(day)): { + problem: Answer(year=y, day=d, problem=problem, answer=answer) + for problem, answer in problems.items() + } + for day, problems in days.items() + } + for year, days in _ANSWERS.items() +} + + +def get_from_id(id_: ProblemId, /) -> Answer | None: + return ANSWERS.get(id_.year, {}).get(id_.day, {}).get(id_.problem) + + +@overload +def get() -> Iterator[Answer]: ... +@overload +def get(year: Year, /) -> Iterator[Answer]: ... +@overload +def get(year: Year, day: Day, /) -> Iterator[Answer]: ... + + +def get(year: Year | None = None, day: Day | None = None) -> Iterator[Answer]: + if year is None: + for year_ in ANSWERS: + yield from get(year_) + return + + if day is None: + days = ANSWERS[year] + for day_ in days: + yield from get(year, day_) + return + + yield from ANSWERS[year][day].values() diff --git a/adventofcode/main.py b/adventofcode/main.py index 6f81134..02adc6c 100644 --- a/adventofcode/main.py +++ b/adventofcode/main.py @@ -1,21 +1,27 @@ +from __future__ import annotations + import importlib import logging import pathlib import sys import time -from collections.abc import Callable, Iterable -from enum import StrEnum -from typing import Annotated, Any, assert_never +from enum import Enum, StrEnum +from typing import TYPE_CHECKING, Annotated, Any, TypeGuard, assert_never import joblib import typer from attrs import define, frozen -from adventofcode.answers import ANSWERS +from adventofcode import answers + +if TYPE_CHECKING: + from collections.abc import Callable, Iterable app = typer.Typer() state = {"day_suffix": ""} +YEAR = answers.Year(2023) + @app.callback() def callback( @@ -41,12 +47,16 @@ def callback( @app.command(name="all") def all_() -> None: - sys.exit(_multiple_problems(ANSWERS.keys(), day_suffix=state["day_suffix"])) + sys.exit(_multiple_problems(answers.get(), day_suffix=state["day_suffix"])) @app.command(name="day") def day_(day: int) -> None: - sys.exit(_multiple_problems((day,), day_suffix=state["day_suffix"])) + sys.exit( + _multiple_problems( + answers.get(YEAR, answers.Day(day)), day_suffix=state["day_suffix"] + ) + ) class _Profiler(StrEnum): @@ -54,20 +64,34 @@ class _Profiler(StrEnum): Pyinstrument = "pyinstrument" +class _ProblemArg(Enum): + _1 = 1 + _2 = 2 + + @app.command() def single( day: int, - problem: int, + problem: _ProblemArg, profiler: Annotated[_Profiler | None, typer.Option("-p", "--profiler")] = None, ) -> None: - sys.exit(_specific_problem(day, state["day_suffix"], problem, profiler)) + problem_: answers.Problem = problem # type: ignore[reportAssignmentType, assignment] + sys.exit( + _specific_problem( + answers.ProblemId(YEAR, answers.Day(day), problem_), + state["day_suffix"], + profiler, + ) + ) def _specific_problem( - day: int, day_suffix: str, problem: int, profiler: _Profiler | None + id_: answers.ProblemId, + day_suffix: str, + profiler: _Profiler | None, ) -> int: try: - input_ = _get_problem_input(day, day_suffix, problem) + input_ = _get_problem_input(id_, day_suffix) if profiler is not None: output = _profiler_problem(input_, profiler) else: @@ -94,16 +118,12 @@ def _specific_problem( return 0 -def _multiple_problems(days: Iterable[int], day_suffix: str) -> int: +def _multiple_problems(answers: Iterable[answers.Answer], day_suffix: str) -> int: all_passed = None slowest = None start = time.perf_counter() with joblib.Parallel(n_jobs=-1, return_as="generator") as parallel: - inputs = [ - _get_problem_input(day, day_suffix, problem) - for day in days - for problem in ANSWERS.get(day, {}) - ] + inputs = [_get_problem_input(answer, day_suffix) for answer in answers] outputs = parallel(joblib.delayed(_exec_problem)(x) for x in inputs) results = (_process_output(x) for x in outputs) for result in results: @@ -123,12 +143,12 @@ def _multiple_problems(days: Iterable[int], day_suffix: str) -> int: if slowest is not None: print( - f"Slowest: Day {slowest.day} Problem {slowest.problem}: " + f"Slowest: {slowest.id.year} {slowest.id.day:2} {slowest.id.problem}: " f"{slowest.duration:.3f}s" ) if all_passed is None: - print(f"No answers known for requested day. Duration {duration:.3f}s") + print(f"No answers known. Duration {duration:.3f}s") return 0 if all_passed: @@ -155,28 +175,22 @@ def __init__(self, problem: int) -> None: @define class _ProblemResult: - day: int - problem: int - - answer: str + id: answers.ProblemId + answer: answers.AnswerType duration: float | None - correct_answer: str | None - - @property - def answer_known(self) -> bool: - return self.correct_answer is not None + correct_answer: answers.AnswerType | None @property def correct(self) -> bool: - return self.answer_known and self.answer == self.correct_answer + return self.correct_answer is not None and self.correct_answer == self.answer @property def incorrect(self) -> bool: - return self.answer_known and self.answer != self.correct_answer + return self.correct_answer is not None and self.answer != self.correct_answer def _report_one_of_many_problems(result: _ProblemResult) -> bool: - msg = f"Day {result.day:2} Problem {result.problem}: " + msg = f"{result.id.year} {result.id.day:2} {result.id.problem}: " msg += f"{result.duration:.3f}s: " if result.incorrect: msg += ( @@ -191,62 +205,66 @@ def _report_one_of_many_problems(result: _ProblemResult) -> bool: @frozen class _ProblemInput: - day: int - problem: int + id: answers.ProblemId func: Callable[[str], Any] input_str: str @frozen class _ProblemOutput: - input_: _ProblemInput + id_: answers.ProblemId duration: float | None - result: str + result: answers.AnswerType - @property - def day(self) -> int: - return self.input_.day - - @property - def problem(self) -> int: - return self.input_.problem - -def _get_problem_input(day: int, day_suffix: str, problem: int) -> _ProblemInput: +def _get_problem_input(id_: answers.ProblemId, day_suffix: str) -> _ProblemInput: try: - mod_name = f"adventofcode.d{day}{day_suffix}" + mod_name = f"adventofcode.y{id_.year}.d{id_.day}{day_suffix}" mod = importlib.import_module(mod_name) except ModuleNotFoundError: - raise _DayNotFoundError(day) from None + raise _DayNotFoundError(id_.day) from None try: - func = getattr(mod, f"p{problem}") + func = getattr(mod, f"p{id_.problem}") except AttributeError: - raise _ProblemNotFoundError(problem) from None + raise _ProblemNotFoundError(id_.problem) from None input_str = ( - (pathlib.Path(__file__).parent / f"input-d{day}.txt").read_text().strip() + (pathlib.Path(__file__).parent / f"y{id_.year}" / f"input-d{id_.day}.txt") + .read_text() + .strip() ) - return _ProblemInput(day, problem, func, input_str) + return _ProblemInput(id_, func, input_str) def _process_output(output: _ProblemOutput) -> _ProblemResult: - answer = ANSWERS.get(output.day, {}).get(output.problem) + answer = answers.get_from_id(output.id_) return _ProblemResult( - output.day, - output.problem, + output.id_, output.result, output.duration, - str(answer) if answer is not None else None, + answer.answer if answer is not None else None, ) +class InvalidResultTypeError(TypeError): + def __init__(self, result_type: type) -> None: + super().__init__(f"Invalid result type: {result_type}") + + +def is_valid_result_type(result: Any) -> TypeGuard[answers.AnswerType]: # noqa: ANN401 + return isinstance(result, int) + + def _exec_problem(input_: _ProblemInput) -> _ProblemOutput: start_time = time.perf_counter() - result = input_.func(input_.input_str) + result: Any = input_.func(input_.input_str) duration = time.perf_counter() - start_time - return _ProblemOutput(input_, duration, str(result)) + if not is_valid_result_type(result): + raise InvalidResultTypeError(type(result)) # type: ignore[reportUnknownArgumentType] + + return _ProblemOutput(input_.id, duration, result) def _profiler_problem(input_: _ProblemInput, profiler: _Profiler) -> _ProblemOutput: @@ -259,7 +277,9 @@ def _profiler_problem(input_: _ProblemInput, profiler: _Profiler) -> _ProblemOut stats = pstats.Stats(pr).strip_dirs() stats.sort_stats("tottime").print_stats(0.2) stats.sort_stats("cumtime").print_stats(0.2) - return _ProblemOutput(input_, None, str(result)) + if not is_valid_result_type(result): + raise InvalidResultTypeError(type(result)) # type: ignore[reportUnknownArgumentType] + return _ProblemOutput(input_.id, None, result) elif profiler is _Profiler.Pyinstrument: import pyinstrument @@ -275,9 +295,11 @@ def _profiler_problem(input_: _ProblemInput, profiler: _Profiler) -> _ProblemOut ) ): result = input_.func(input_.input_str) - return _ProblemOutput(input_, None, str(result)) - else: - assert_never(profiler) + if not is_valid_result_type(result): + raise InvalidResultTypeError(type(result)) # type: ignore[reportUnknownArgumentType] + return _ProblemOutput(input_.id, None, result) + + assert_never(profiler) if __name__ == "__main__": diff --git a/adventofcode/y2023/__init__.py b/adventofcode/y2023/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/adventofcode/d1.py b/adventofcode/y2023/d1.py similarity index 100% rename from adventofcode/d1.py rename to adventofcode/y2023/d1.py diff --git a/adventofcode/d10.py b/adventofcode/y2023/d10.py similarity index 100% rename from adventofcode/d10.py rename to adventofcode/y2023/d10.py diff --git a/adventofcode/d11.py b/adventofcode/y2023/d11.py similarity index 100% rename from adventofcode/d11.py rename to adventofcode/y2023/d11.py diff --git a/adventofcode/d12.py b/adventofcode/y2023/d12.py similarity index 100% rename from adventofcode/d12.py rename to adventofcode/y2023/d12.py diff --git a/adventofcode/d13.py b/adventofcode/y2023/d13.py similarity index 100% rename from adventofcode/d13.py rename to adventofcode/y2023/d13.py diff --git a/adventofcode/d14.py b/adventofcode/y2023/d14.py similarity index 100% rename from adventofcode/d14.py rename to adventofcode/y2023/d14.py diff --git a/adventofcode/d15.py b/adventofcode/y2023/d15.py similarity index 100% rename from adventofcode/d15.py rename to adventofcode/y2023/d15.py diff --git a/adventofcode/d16.py b/adventofcode/y2023/d16.py similarity index 100% rename from adventofcode/d16.py rename to adventofcode/y2023/d16.py diff --git a/adventofcode/d17.py b/adventofcode/y2023/d17.py similarity index 100% rename from adventofcode/d17.py rename to adventofcode/y2023/d17.py diff --git a/adventofcode/d18.py b/adventofcode/y2023/d18.py similarity index 100% rename from adventofcode/d18.py rename to adventofcode/y2023/d18.py diff --git a/adventofcode/d19.py b/adventofcode/y2023/d19.py similarity index 100% rename from adventofcode/d19.py rename to adventofcode/y2023/d19.py diff --git a/adventofcode/d2.py b/adventofcode/y2023/d2.py similarity index 100% rename from adventofcode/d2.py rename to adventofcode/y2023/d2.py diff --git a/adventofcode/d20.py b/adventofcode/y2023/d20.py similarity index 100% rename from adventofcode/d20.py rename to adventofcode/y2023/d20.py diff --git a/adventofcode/d3.py b/adventofcode/y2023/d3.py similarity index 100% rename from adventofcode/d3.py rename to adventofcode/y2023/d3.py diff --git a/adventofcode/d4.py b/adventofcode/y2023/d4.py similarity index 100% rename from adventofcode/d4.py rename to adventofcode/y2023/d4.py diff --git a/adventofcode/d5.py b/adventofcode/y2023/d5.py similarity index 100% rename from adventofcode/d5.py rename to adventofcode/y2023/d5.py diff --git a/adventofcode/d6.py b/adventofcode/y2023/d6.py similarity index 100% rename from adventofcode/d6.py rename to adventofcode/y2023/d6.py diff --git a/adventofcode/d7.py b/adventofcode/y2023/d7.py similarity index 100% rename from adventofcode/d7.py rename to adventofcode/y2023/d7.py diff --git a/adventofcode/d8.py b/adventofcode/y2023/d8.py similarity index 100% rename from adventofcode/d8.py rename to adventofcode/y2023/d8.py diff --git a/adventofcode/d9.py b/adventofcode/y2023/d9.py similarity index 100% rename from adventofcode/d9.py rename to adventofcode/y2023/d9.py diff --git a/adventofcode/input-d1.txt b/adventofcode/y2023/input-d1.txt similarity index 100% rename from adventofcode/input-d1.txt rename to adventofcode/y2023/input-d1.txt diff --git a/adventofcode/input-d10.txt b/adventofcode/y2023/input-d10.txt similarity index 100% rename from adventofcode/input-d10.txt rename to adventofcode/y2023/input-d10.txt diff --git a/adventofcode/input-d11.txt b/adventofcode/y2023/input-d11.txt similarity index 100% rename from adventofcode/input-d11.txt rename to adventofcode/y2023/input-d11.txt diff --git a/adventofcode/input-d12.txt b/adventofcode/y2023/input-d12.txt similarity index 100% rename from adventofcode/input-d12.txt rename to adventofcode/y2023/input-d12.txt diff --git a/adventofcode/input-d13.txt b/adventofcode/y2023/input-d13.txt similarity index 100% rename from adventofcode/input-d13.txt rename to adventofcode/y2023/input-d13.txt diff --git a/adventofcode/input-d14.txt b/adventofcode/y2023/input-d14.txt similarity index 100% rename from adventofcode/input-d14.txt rename to adventofcode/y2023/input-d14.txt diff --git a/adventofcode/input-d15.txt b/adventofcode/y2023/input-d15.txt similarity index 100% rename from adventofcode/input-d15.txt rename to adventofcode/y2023/input-d15.txt diff --git a/adventofcode/input-d16.txt b/adventofcode/y2023/input-d16.txt similarity index 100% rename from adventofcode/input-d16.txt rename to adventofcode/y2023/input-d16.txt diff --git a/adventofcode/input-d17.txt b/adventofcode/y2023/input-d17.txt similarity index 100% rename from adventofcode/input-d17.txt rename to adventofcode/y2023/input-d17.txt diff --git a/adventofcode/input-d18.txt b/adventofcode/y2023/input-d18.txt similarity index 100% rename from adventofcode/input-d18.txt rename to adventofcode/y2023/input-d18.txt diff --git a/adventofcode/input-d19.txt b/adventofcode/y2023/input-d19.txt similarity index 100% rename from adventofcode/input-d19.txt rename to adventofcode/y2023/input-d19.txt diff --git a/adventofcode/input-d2.txt b/adventofcode/y2023/input-d2.txt similarity index 100% rename from adventofcode/input-d2.txt rename to adventofcode/y2023/input-d2.txt diff --git a/adventofcode/input-d20.txt b/adventofcode/y2023/input-d20.txt similarity index 100% rename from adventofcode/input-d20.txt rename to adventofcode/y2023/input-d20.txt diff --git a/adventofcode/input-d3.txt b/adventofcode/y2023/input-d3.txt similarity index 100% rename from adventofcode/input-d3.txt rename to adventofcode/y2023/input-d3.txt diff --git a/adventofcode/input-d4.txt b/adventofcode/y2023/input-d4.txt similarity index 100% rename from adventofcode/input-d4.txt rename to adventofcode/y2023/input-d4.txt diff --git a/adventofcode/input-d5.txt b/adventofcode/y2023/input-d5.txt similarity index 100% rename from adventofcode/input-d5.txt rename to adventofcode/y2023/input-d5.txt diff --git a/adventofcode/input-d6.txt b/adventofcode/y2023/input-d6.txt similarity index 100% rename from adventofcode/input-d6.txt rename to adventofcode/y2023/input-d6.txt diff --git a/adventofcode/input-d7.txt b/adventofcode/y2023/input-d7.txt similarity index 100% rename from adventofcode/input-d7.txt rename to adventofcode/y2023/input-d7.txt diff --git a/adventofcode/input-d8.txt b/adventofcode/y2023/input-d8.txt similarity index 100% rename from adventofcode/input-d8.txt rename to adventofcode/y2023/input-d8.txt diff --git a/adventofcode/input-d9.txt b/adventofcode/y2023/input-d9.txt similarity index 100% rename from adventofcode/input-d9.txt rename to adventofcode/y2023/input-d9.txt diff --git a/tests/test_d11.py b/tests/y2023/test_d11.py similarity index 90% rename from tests/test_d11.py rename to tests/y2023/test_d11.py index 732bd23..0d58518 100644 --- a/tests/test_d11.py +++ b/tests/y2023/test_d11.py @@ -1,4 +1,4 @@ -from adventofcode import d11 +from adventofcode.y2023 import d11 _example_input = """ ...#...... diff --git a/tests/test_d13.py b/tests/y2023/test_d13.py similarity index 89% rename from tests/test_d13.py rename to tests/y2023/test_d13.py index 2c42149..9bc82ca 100644 --- a/tests/test_d13.py +++ b/tests/y2023/test_d13.py @@ -1,4 +1,4 @@ -from adventofcode import d13 +from adventofcode.y2023 import d13 _example_input = """ #.##..##. diff --git a/tests/test_d14.py b/tests/y2023/test_d14.py similarity index 88% rename from tests/test_d14.py rename to tests/y2023/test_d14.py index 1a49118..1183a88 100644 --- a/tests/test_d14.py +++ b/tests/y2023/test_d14.py @@ -1,4 +1,4 @@ -from adventofcode import d14 +from adventofcode.y2023 import d14 _example_input = """ O....#.... diff --git a/tests/test_d20.py b/tests/y2023/test_d20.py similarity index 91% rename from tests/test_d20.py rename to tests/y2023/test_d20.py index 27df473..56dfb5e 100644 --- a/tests/test_d20.py +++ b/tests/y2023/test_d20.py @@ -1,4 +1,4 @@ -from adventofcode import d20 +from adventofcode.y2023 import d20 _example1_input = r""" broadcaster -> a, b, c diff --git a/tests/test_d5.py b/tests/y2023/test_d5.py similarity index 93% rename from tests/test_d5.py rename to tests/y2023/test_d5.py index 08691dd..ac97bab 100644 --- a/tests/test_d5.py +++ b/tests/y2023/test_d5.py @@ -1,4 +1,4 @@ -from adventofcode import d5 +from adventofcode.y2023 import d5 _example_input = """ seeds: 79 14 55 13 diff --git a/tests/test_d8.py b/tests/y2023/test_d8.py similarity index 92% rename from tests/test_d8.py rename to tests/y2023/test_d8.py index 2c9cac6..cde4152 100644 --- a/tests/test_d8.py +++ b/tests/y2023/test_d8.py @@ -1,4 +1,4 @@ -from adventofcode import d8 +from adventofcode.y2023 import d8 _example_input_p1 = """ LLR