From b7159d83cc0c788be5c519a1737d6c7c345d5113 Mon Sep 17 00:00:00 2001 From: James Lawlor Date: Wed, 10 Dec 2025 07:25:33 +0200 Subject: [PATCH] update rocs, remove printing --- README.md | 70 +++++++++++++++++++++++++- src/advent_of_code/year_2025/day_01.py | 5 -- src/advent_of_code/year_2025/day_03.py | 1 - 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4fe2642..d4f45d2 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,78 @@ Some overengineered Python solutions for Advent of Code 2023 +Quick docker run (same behavior as running the package locally): + ``` docker build -t advent-of-code-python-app . docker run advent-of-code-python-app ``` +Running solutions (recommended) + +This project exposes a small CLI entrypoint implemented in `src/advent_of_code/cli.py`. +There are three common ways to run a day's solution: + +- Run directly from the repository (no install): + + ``` + PYTHONPATH=src python -m advent_of_code --year 2025 --day 1 + ``` + +- Run with the module flag (if you have the package importable): + + ``` + python -m advent_of_code --year 2025 --day 1 + ``` + +- Install editable and use the console script (recommended for convenience): + + ``` + pip install -e . + aoc --year 2025 --day 1 + ``` + +Notes on invocation + +- The CLI expects `--year` and `--day`. The `--day` value accepts either `1` or `01` — the code zero-pads the value to match input filenames. +- Input files live under `inputs/year_/.dat` where `` is zero-padded to two digits (e.g. `01.dat`). +- Each day module under `src/advent_of_code/year_/day_.py` should expose a `main(input_file)` function which the CLI calls. +- If you see "Could not find module" when running the CLI, either install the package (`pip install -e .`) or run with `PYTHONPATH=src` as shown above. + +Dependencies and `uv` + +- Project dependencies are listed in `pyproject.toml` and `requirements.txt`. +- This repository includes `uv` (version pinned in `requirements.txt` / `pyproject.toml`) as a dependency. Installing the project (or the requirements) will pull `uv` in. The core day-runner CLI (`aoc` / `python -m advent_of_code`) does not require `uv` to run a solution file, but `uv` is available for any tooling or extensions that may use it. + +Installing dependencies + +``` +pip install -r requirements.txt +# or for editable install (recommended if you want the `aoc` console script): +pip install -e . +``` + +Scripts + +- `scripts/run_day.py` — a small script that mirrors the CLI behavior but can be invoked directly with Python. +- `scripts/run_all_solutions.py` — discovers and runs available day solutions (skips days without an input file). + +### 2025 Progress + +| Day | Part 1 | Part 2 | +| :---: | :------: | :------: | +| 01 | ⭐️ | ⭐️ | +| 02 | ⭐️ | ⭐️ | +| 03 | ⭐️ | ⭐️ | + +### 2024 Progress + +| Day | Part 1 | Part 2 | +| :---: | :------: | :------: | +| 01 | ⭐️ | ⭐️ | +| 02 | ⭐️ | ⭐️ | +| 03 | ⭐️ | ⭐️ | + ### 2023 Progress | Day | Part 1 | Part 2 | @@ -16,5 +83,4 @@ docker run advent-of-code-python-app | 03 | ⭐️ | ⭐️ | | 04 | ⭐️ | ⭐️ | | 05 | todo | todo | -| 06 | ⭐️ | ⭐️ | -| 07 | todo | todo | \ No newline at end of file +| 06 | ⭐️ | ⭐️ | \ No newline at end of file diff --git a/src/advent_of_code/year_2025/day_01.py b/src/advent_of_code/year_2025/day_01.py index d97dfd9..732d192 100644 --- a/src/advent_of_code/year_2025/day_01.py +++ b/src/advent_of_code/year_2025/day_01.py @@ -36,8 +36,6 @@ def points_at_zero_counter(current_position, turn_direction, distance): full_loops = distance // DIAL_SIZE partial_loops = 0 - print("Case:", current_position, turn_direction, distance) - print(" Full loops:", full_loops) # Check if we passed zero in the remaining distance after full loops new_position = turn_dial(current_position, turn_direction, distance) @@ -58,11 +56,8 @@ def points_at_zero_counter(current_position, turn_direction, distance): # check if we landed on zero if current_position != 0 and new_position == 0: - print(" Landed on zero, updating partial loops") partial_loops += 1 - print(" Partial loops:", partial_loops) - return full_loops + partial_loops diff --git a/src/advent_of_code/year_2025/day_03.py b/src/advent_of_code/year_2025/day_03.py index 4bb8bc3..d62a43f 100644 --- a/src/advent_of_code/year_2025/day_03.py +++ b/src/advent_of_code/year_2025/day_03.py @@ -35,7 +35,6 @@ def calculate_largest_joltage(battery_bank_as_ints, n_batteries): start_ix = leftmost_index + 1 batteries_remaining -= 1 - print(f"list_of_joltages={list_of_joltages}") return combine_joltages(list_of_joltages)