day by day folder building for neatness
This commit is contained in:
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
@@ -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)
|
|
||||||
+16
-1
@@ -67,6 +67,7 @@ def save_part_2_puzzle_text(year, day):
|
|||||||
def get_puzzle_part(year, day):
|
def get_puzzle_part(year, day):
|
||||||
# Check if the puzzle text for the day equals "# Day {day} Puzzle Text."
|
# Check if the puzzle text for the day equals "# Day {day} Puzzle Text."
|
||||||
folder = rf"advent_of_code\{year}\day_{day}"
|
folder = rf"advent_of_code\{year}\day_{day}"
|
||||||
|
os.makedirs(folder, exist_ok=True)
|
||||||
input_file = os.path.join(folder, "puzzle_text.md")
|
input_file = os.path.join(folder, "puzzle_text.md")
|
||||||
# Create the file if it doesn't exist
|
# Create the file if it doesn't exist
|
||||||
if not os.path.isfile(input_file):
|
if not os.path.isfile(input_file):
|
||||||
@@ -80,6 +81,18 @@ def get_puzzle_part(year, day):
|
|||||||
else:
|
else:
|
||||||
return 2
|
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
|
# Usage example
|
||||||
current_year = datetime.now().year
|
current_year = datetime.now().year
|
||||||
current_day = datetime.now().day
|
current_day = datetime.now().day
|
||||||
@@ -105,9 +118,11 @@ def populate_data(year = current_year, day=current_day):
|
|||||||
if part_check == 1:
|
if part_check == 1:
|
||||||
save_puzzle_text(year, day)
|
save_puzzle_text(year, day)
|
||||||
save_puzzle_input(year, day)
|
save_puzzle_input(year, day)
|
||||||
|
create_solution_file(year, day, part_check)
|
||||||
elif part_check == 2:
|
elif part_check == 2:
|
||||||
save_part_2_puzzle_text(year, day)
|
save_part_2_puzzle_text(year, day)
|
||||||
|
create_solution_file(year, day, part_check)
|
||||||
else:
|
else:
|
||||||
print("Something went wrong. Check the puzzle text.")
|
print("Something went wrong. Check the puzzle text.")
|
||||||
|
|
||||||
populate_data()
|
populate_data(2022,6)
|
||||||
|
|||||||
Reference in New Issue
Block a user