diff --git a/2022/day_10/part 1 solution.py b/2022/day_10/part 1 solution.py deleted file mode 100644 index 441b7cc..0000000 --- a/2022/day_10/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_10\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_10/part 2 solution.py b/2022/day_10/part 2 solution.py deleted file mode 100644 index 441b7cc..0000000 --- a/2022/day_10/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_10\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_11/part 1 solution.py b/2022/day_11/part 1 solution.py deleted file mode 100644 index 49bb909..0000000 --- a/2022/day_11/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_11\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_11/part 2 solution.py b/2022/day_11/part 2 solution.py deleted file mode 100644 index 49bb909..0000000 --- a/2022/day_11/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_11\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_12/part 1 solution.py b/2022/day_12/part 1 solution.py deleted file mode 100644 index f326a62..0000000 --- a/2022/day_12/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_12\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_12/part 2 solution.py b/2022/day_12/part 2 solution.py deleted file mode 100644 index f326a62..0000000 --- a/2022/day_12/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_12\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_13/part 1 solution.py b/2022/day_13/part 1 solution.py deleted file mode 100644 index c6e1059..0000000 --- a/2022/day_13/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_13\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_13/part 2 solution.py b/2022/day_13/part 2 solution.py deleted file mode 100644 index c6e1059..0000000 --- a/2022/day_13/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_13\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_14/part 1 solution.py b/2022/day_14/part 1 solution.py deleted file mode 100644 index 402b8c8..0000000 --- a/2022/day_14/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_14\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_14/part 2 solution.py b/2022/day_14/part 2 solution.py deleted file mode 100644 index 402b8c8..0000000 --- a/2022/day_14/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_14\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_15/part 1 solution.py b/2022/day_15/part 1 solution.py deleted file mode 100644 index 8530d41..0000000 --- a/2022/day_15/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_15\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_15/part 2 solution.py b/2022/day_15/part 2 solution.py deleted file mode 100644 index 8530d41..0000000 --- a/2022/day_15/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_15\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_16/part 1 solution.py b/2022/day_16/part 1 solution.py deleted file mode 100644 index c3fdeea..0000000 --- a/2022/day_16/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_16\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_16/part 2 solution.py b/2022/day_16/part 2 solution.py deleted file mode 100644 index c3fdeea..0000000 --- a/2022/day_16/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_16\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_17/part 1 solution.py b/2022/day_17/part 1 solution.py deleted file mode 100644 index 6e27393..0000000 --- a/2022/day_17/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_17\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_17/part 2 solution.py b/2022/day_17/part 2 solution.py deleted file mode 100644 index 6e27393..0000000 --- a/2022/day_17/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_17\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_18/part 1 solution.py b/2022/day_18/part 1 solution.py deleted file mode 100644 index 0402d2b..0000000 --- a/2022/day_18/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_18\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_18/part 2 solution.py b/2022/day_18/part 2 solution.py deleted file mode 100644 index 0402d2b..0000000 --- a/2022/day_18/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_18\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_19/part 1 solution.py b/2022/day_19/part 1 solution.py deleted file mode 100644 index d26ac49..0000000 --- a/2022/day_19/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_19\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_19/part 2 solution.py b/2022/day_19/part 2 solution.py deleted file mode 100644 index d26ac49..0000000 --- a/2022/day_19/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_19\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_20/part 1 solution.py b/2022/day_20/part 1 solution.py deleted file mode 100644 index 56547ba..0000000 --- a/2022/day_20/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_20\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_20/part 2 solution.py b/2022/day_20/part 2 solution.py deleted file mode 100644 index 56547ba..0000000 --- a/2022/day_20/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_20\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_21/part 1 solution.py b/2022/day_21/part 1 solution.py deleted file mode 100644 index f0cf112..0000000 --- a/2022/day_21/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_21\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_21/part 2 solution.py b/2022/day_21/part 2 solution.py deleted file mode 100644 index f0cf112..0000000 --- a/2022/day_21/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_21\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_22/part 1 solution.py b/2022/day_22/part 1 solution.py deleted file mode 100644 index 982851f..0000000 --- a/2022/day_22/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_22\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_22/part 2 solution.py b/2022/day_22/part 2 solution.py deleted file mode 100644 index 982851f..0000000 --- a/2022/day_22/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_22\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_23/part 1 solution.py b/2022/day_23/part 1 solution.py deleted file mode 100644 index 38c0b43..0000000 --- a/2022/day_23/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_23\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_23/part 2 solution.py b/2022/day_23/part 2 solution.py deleted file mode 100644 index 38c0b43..0000000 --- a/2022/day_23/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_23\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_24/part 1 solution.py b/2022/day_24/part 1 solution.py deleted file mode 100644 index bcce36a..0000000 --- a/2022/day_24/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_24\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_24/part 2 solution.py b/2022/day_24/part 2 solution.py deleted file mode 100644 index bcce36a..0000000 --- a/2022/day_24/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_24\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_25/part 1 solution.py b/2022/day_25/part 1 solution.py deleted file mode 100644 index a9acb50..0000000 --- a/2022/day_25/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_25\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_25/part 2 solution.py b/2022/day_25/part 2 solution.py deleted file mode 100644 index a9acb50..0000000 --- a/2022/day_25/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_25\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_6/part 1 solution.py b/2022/day_6/part 1 solution.py deleted file mode 100644 index e8284a7..0000000 --- a/2022/day_6/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_6\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_6/part 2 solution.py b/2022/day_6/part 2 solution.py deleted file mode 100644 index e8284a7..0000000 --- a/2022/day_6/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_6\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_7/part 1 solution.py b/2022/day_7/part 1 solution.py deleted file mode 100644 index 873a32c..0000000 --- a/2022/day_7/part 1 solution.py +++ /dev/null @@ -1,11 +0,0 @@ -import os -from advent_of_code.get_puzzle_text import save_puzzle_text - -year = 2022 -day = 7 -save_puzzle_text(year, day) - -with open(r'advent_of_code\2022\day_7\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_7/part 2 solution.py b/2022/day_7/part 2 solution.py deleted file mode 100644 index d533295..0000000 --- a/2022/day_7/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_7\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_8/part 1 solution.py b/2022/day_8/part 1 solution.py deleted file mode 100644 index 451609a..0000000 --- a/2022/day_8/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_8\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_8/part 2 solution.py b/2022/day_8/part 2 solution.py deleted file mode 100644 index 451609a..0000000 --- a/2022/day_8/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_8\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_9/part 1 solution.py b/2022/day_9/part 1 solution.py deleted file mode 100644 index 8fd38d4..0000000 --- a/2022/day_9/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_9\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2022/day_9/part 2 solution.py b/2022/day_9/part 2 solution.py deleted file mode 100644 index 8fd38d4..0000000 --- a/2022/day_9/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2022\day_9\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_18/part 1 solution.py b/2023/day_18/part 1 solution.py deleted file mode 100644 index dd95443..0000000 --- a/2023/day_18/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_18\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_18/part 2 solution.py b/2023/day_18/part 2 solution.py deleted file mode 100644 index dd95443..0000000 --- a/2023/day_18/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_18\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_19/part 1 solution.py b/2023/day_19/part 1 solution.py deleted file mode 100644 index 8925331..0000000 --- a/2023/day_19/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_19\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_19/part 2 solution.py b/2023/day_19/part 2 solution.py deleted file mode 100644 index 8925331..0000000 --- a/2023/day_19/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_19\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_20/part 1 solution.py b/2023/day_20/part 1 solution.py deleted file mode 100644 index b51ef0c..0000000 --- a/2023/day_20/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_20\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_20/part 2 solution.py b/2023/day_20/part 2 solution.py deleted file mode 100644 index b51ef0c..0000000 --- a/2023/day_20/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_20\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_21/part 1 solution.py b/2023/day_21/part 1 solution.py deleted file mode 100644 index 581525e..0000000 --- a/2023/day_21/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_21\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_21/part 2 solution.py b/2023/day_21/part 2 solution.py deleted file mode 100644 index 581525e..0000000 --- a/2023/day_21/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_21\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_22/part 1 solution.py b/2023/day_22/part 1 solution.py deleted file mode 100644 index d3dfa5f..0000000 --- a/2023/day_22/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_22\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_22/part 2 solution.py b/2023/day_22/part 2 solution.py deleted file mode 100644 index d3dfa5f..0000000 --- a/2023/day_22/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_22\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_23/part 1 solution.py b/2023/day_23/part 1 solution.py deleted file mode 100644 index f86849b..0000000 --- a/2023/day_23/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_23\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_23/part 2 solution.py b/2023/day_23/part 2 solution.py deleted file mode 100644 index f86849b..0000000 --- a/2023/day_23/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_23\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_24/part 1 solution.py b/2023/day_24/part 1 solution.py deleted file mode 100644 index 8caffb1..0000000 --- a/2023/day_24/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_24\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_24/part 2 solution.py b/2023/day_24/part 2 solution.py deleted file mode 100644 index 8caffb1..0000000 --- a/2023/day_24/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_24\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_25/part 1 solution.py b/2023/day_25/part 1 solution.py deleted file mode 100644 index 5922575..0000000 --- a/2023/day_25/part 1 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_25\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/2023/day_25/part 2 solution.py b/2023/day_25/part 2 solution.py deleted file mode 100644 index 5922575..0000000 --- a/2023/day_25/part 2 solution.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -with open(r'advent_of_code\2023\day_25\input.txt', 'r') as file: - input = file.read() - -print(input) diff --git a/get_puzzle_text.py b/get_puzzle_text.py index 49338a0..c01844d 100644 --- a/get_puzzle_text.py +++ b/get_puzzle_text.py @@ -67,6 +67,7 @@ def save_part_2_puzzle_text(year, day): def get_puzzle_part(year, day): # Check if the puzzle text for the day equals "# Day {day} Puzzle Text." folder = rf"advent_of_code\{year}\day_{day}" + os.makedirs(folder, exist_ok=True) input_file = os.path.join(folder, "puzzle_text.md") # Create the file if it doesn't exist if not os.path.isfile(input_file): @@ -80,6 +81,18 @@ def get_puzzle_part(year, day): else: return 2 +def create_solution_file(year, day, part): + folder = rf"advent_of_code\{year}\day_{day}" + os.makedirs(folder, exist_ok=True) + solution_file = os.path.join(folder, f"part {part} solution.py") + input_file_path = os.path.join(folder, "input.txt") + with open(solution_file, "w") as file: + file.write(f"""with open(r'{input_file_path}', 'r') as file: + input = file.read() +""") + print(f"Created {solution_file}") + + # Usage example current_year = datetime.now().year current_day = datetime.now().day @@ -105,9 +118,11 @@ def populate_data(year = current_year, day=current_day): if part_check == 1: save_puzzle_text(year, day) save_puzzle_input(year, day) + create_solution_file(year, day, part_check) elif part_check == 2: save_part_2_puzzle_text(year, day) + create_solution_file(year, day, part_check) else: print("Something went wrong. Check the puzzle text.") -populate_data() +populate_data(2022,6)