Skip to content

Commit 678b606

Browse files
committed
fix: clean-up project root files
1 parent 56a590a commit 678b606

File tree

4 files changed

+79
-85
lines changed

4 files changed

+79
-85
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3+
.cursor
34
.pytest_cache
45
.pdm-build
56
.mypy_cache

Makefile

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.md

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# advent-of-code-2024
1+
# Advent of Code
22

33
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.
44

@@ -7,7 +7,7 @@ Advent of Code is an Advent calendar of small programming puzzles for a variety
77
#### Clone the Repository:
88

99
```bash
10-
https://github.com/mbrickerd/advent-of-code-2024
10+
https://github.com/mbrickerd/advent-of-code
1111
```
1212

1313
#### Install Dependencies:
@@ -71,25 +71,63 @@ This repository is a modular and efficient framework designed to manage and solv
7171
│ └── utils
7272
│ ├── __init__.py
7373
│ └── initialise.py # Utilities for initializing daily solution files
74-
├── solutions
75-
│ ├── day01.py # Example solution for Day 1
76-
│ ├── day02.py # Example solution for Day 2
77-
│ └── ...
74+
├── 2024 # 2024 Advent of Code solutions
75+
│ ├── solutions
76+
│ │ ├── day01.py # Solution for Day 1, 2024
77+
│ │ ├── day02.py # Solution for Day 2, 2024
78+
│ │ └── ...
79+
│ ├── data
80+
│ │ ├── day01
81+
│ │ │ └── puzzle_input.txt
82+
│ │ ├── day02
83+
│ │ │ └── puzzle_input.txt
84+
│ │ └── ...
85+
│ └── tests
86+
│ ├── __init__.py
87+
│ ├── data
88+
│ │ ├── day01
89+
│ │ │ ├── test_01_input.txt
90+
│ │ │ └── test_02_input.txt
91+
│ │ ├── day02
92+
│ │ │ ├── test_01_input.txt
93+
│ │ │ └── test_02_input.txt
94+
│ │ └── ...
95+
│ ├── test_01.py # Tests for Day 1, 2024
96+
│ ├── test_02.py # Tests for Day 2, 2024
97+
│ └── ...
98+
├── 2023 # 2023 Advent of Code solutions
99+
│ ├── solutions
100+
│ │ ├── day01.py # Solution for Day 1, 2023
101+
│ │ ├── day02.py # Solution for Day 2, 2023
102+
│ │ └── ...
103+
│ ├── data
104+
│ │ ├── day01
105+
│ │ │ └── puzzle_input.txt
106+
│ │ ├── day02
107+
│ │ │ └── puzzle_input.txt
108+
│ │ └── ...
109+
│ └── tests
110+
│ ├── __init__.py
111+
│ ├── data
112+
│ │ ├── day01
113+
│ │ │ ├── test_01_input.txt
114+
│ │ │ └── test_02_input.txt
115+
│ │ ├── day02
116+
│ │ │ ├── test_01_input.txt
117+
│ │ │ └── test_02_input.txt
118+
│ │ └── ...
119+
│ ├── test_01.py # Tests for Day 1, 2023
120+
│ ├── test_02.py # Tests for Day 2, 2023
121+
│ └── ...
78122
├── templates
79123
│ ├── solutions
80-
│ │ └── sample.py # Template for new daily solution files
124+
│ │ └── sample.py # Template for new daily solution files
81125
│ └── tests
82-
│ └── sample.txt # Template for test cases
83-
├── tests
84-
│ ├── __init__.py
85-
│ ├── test_01.py # Tests for Day 1 solutions
86-
│ ├── test_02.py # Tests for Day 2 solutions
87-
│ └── ...
126+
│ └── sample.txt # Template for test cases
88127
├── .gitignore
89-
├── .pre-commit-config.yaml # Pre-commit hooks configuration
90-
├── main.py # Main script to manage tasks and run solutions
91-
├── Makefile # Development workflow automation
92-
├── pyproject.toml # Project dependencies and configuration
128+
├── .pre-commit-config.yaml # Pre-commit hooks configuration
129+
├── main.py # Main script to manage tasks and run solutions
130+
├── pyproject.toml # Project dependencies and configuration
93131
└── README.md
94132
```
95133

@@ -129,7 +167,7 @@ The central script to perform various tasks such as:
129167
Provides convenient commands for common development tasks:
130168
- Installing dependencies
131169
- Setting up pre-commit hooks
132-
- Running code quality checks (ruff, mypy)
170+
- Running code quality checks (`ruff`, `mypy`)
133171
- Executing tests
134172
- Formatting code
135173

@@ -176,10 +214,10 @@ Follow these steps to work on and solve a specific Advent of Code day using this
176214

177215
#### Create a new daily solution file and download puzzle input data
178216

179-
To scaffold a new Solution class for a specific day:
217+
To scaffold a new `Solution` class for a specific day:
180218

181219
```bash
182-
python main.py --day [day_number] --add
220+
python main.py --year [year_number] --day [day_number] --add
183221
```
184222

185223
This will create a new solution file in the `solutions/` directory (e.g., `solutions/dayXX.py`) and download the test input data for the specified day and create the corresponding `test_ZZ_input.txt` file in the `data/dayXX/` directory. Add your logic for `part1` and `part2` methods in the generated solution file.
@@ -193,7 +231,7 @@ To validate a specific part of your solution (e.g., `part1` or `part2`), follow
193231
Use the following command to fetch the test input for the desired part:
194232

195233
```bash
196-
python main.py --day [day_number] --part [part_number] --add-test-input
234+
python main.py --year [year_number] --day [day_number] --part [part_number] --add-test-input
197235
```
198236

199237
This will create a test input file in the appropriate location (e.g., `data/dayXX/test_ZZ_input.txt`).
@@ -203,7 +241,7 @@ This will create a test input file in the appropriate location (e.g., `data/dayX
203241
Execute your solution for the specified day and part to verify its correctness:
204242

205243
```bash
206-
python main.py --day [day_number] --part [part_number]
244+
python main.py --year [year_number] --day [day_number] --part [part_number]
207245
```
208246

209247
The framework will load the test input file and run the corresponding method from the `Solution` class for that part.
@@ -219,7 +257,7 @@ By ensuring your solution matches the expected output during these tests, you ca
219257
To run your solution on the full puzzle input after testing:
220258

221259
```bash
222-
python main.py --day [day_number] --part [part_number] --skip-test
260+
python main.py --year [year_number] --day [day_number] --part [part_number] --skip-test
223261
```
224262

225263
This bypasses the test phase and directly runs the solution on the full input dataset (`data/dayXX/puzzle_input.txt`).
@@ -229,7 +267,7 @@ This bypasses the test phase and directly runs the solution on the full input da
229267
If you're confident in your solution and want to submit the result to Advent of Code:
230268

231269
```bash
232-
python main.py --day [day_number] --part [part_number] --skip-test --submit
270+
python main.py --year [year_number] --day [day_number] --part [part_number] --skip-test --submit
233271
```
234272

235273
This will submit your answer for the specified day and part directly to Advent of Code.
@@ -244,7 +282,7 @@ Testing your solutions ensures that your logic is accurate and aligns with the p
244282
When you are ready to add test cases for a specific day, you can generate a test file using the following command:
245283

246284
```bash
247-
python main.py --day [day_number] --add-test-file
285+
python main.py --year [year_number] --day [day_number] --add-test-file
248286
```
249287

250288
This command will create a template test file in the `tests/` directory, named `test_<day_number>.py`. The template is pre-configured to match the structure of the Solution class for that day, making it easier to insert test cases.
@@ -271,4 +309,4 @@ This will output detailed results, showing which tests passed, failed, or encoun
271309

272310
## Acknowledgments
273311

274-
This project structure was inspired by [nitekat1124's Advent of Code 2024 repository](https://github.com/nitekat1124/advent-of-code-2024).
312+
This project structure was inspired by [nitekat1124's Advent of Code 2023 repository](https://github.com/nitekat1124/advent-of-code-2023).

main.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,19 @@ def main() -> None:
3737
0: Success
3838
1: Invalid day/part number (implicit through exit())
3939
"""
40+
_year = datetime.date.today().year
4041
_today = datetime.date.today().day
4142

4243
parser = ArgumentParser(description="Advent of Code solution runner")
44+
parser.add_argument(
45+
"-y",
46+
"--year",
47+
dest="year",
48+
default=_year,
49+
metavar="year_number",
50+
type=int,
51+
help="Required, year of the AoC event.",
52+
)
4353
parser.add_argument(
4454
"-d",
4555
"--day",
@@ -93,15 +103,15 @@ def main() -> None:
93103

94104
elif args.add:
95105
logger.info(f"Adding day {args.day}")
96-
File.add_day(args.day)
106+
File.add_day(args.year, args.day)
97107

98108
elif args.add_test_input:
99109
logger.info(f"Adding test input file for day {args.day}")
100-
File.add_test_input(args.day, args.part)
110+
File.add_test_input(args.year, args.day, args.part)
101111

102112
elif args.add_test_file:
103113
logger.info(f"Adding test file for day {args.day}")
104-
File.add_test_file(args.day)
114+
File.add_test_file(args.year, args.day)
105115

106116
elif args.part not in [1, 2]:
107117
logger.info("Part number must be 1 or 2")
@@ -132,7 +142,7 @@ def main() -> None:
132142
solution.benchmark(_print=True)
133143

134144
if answer and args.submit is True:
135-
Submission.submit(args.day, args.part, answer)
145+
Submission.submit(args.year, args.day, args.part, answer)
136146

137147

138148
if __name__ == "__main__":

0 commit comments

Comments
 (0)