Remove obsolete code for organizing Advent of Code repository
This commit is contained in:
@@ -1,58 +0,0 @@
|
|||||||
import os
|
|
||||||
from datetime import datetime
|
|
||||||
# Define the base directory where you want to create the folders
|
|
||||||
base_dir = 'advent_of_code'
|
|
||||||
current_year = datetime.now().year
|
|
||||||
|
|
||||||
def create_advent_year(year=current_year):
|
|
||||||
'''Creates the folders for the advent of code year.
|
|
||||||
if no year is specified, the current year is used.
|
|
||||||
Args:
|
|
||||||
year (int): The year for which to create the folders.
|
|
||||||
Returns:
|
|
||||||
None
|
|
||||||
'''
|
|
||||||
# Loop over the range 1 to 25 (inclusive)
|
|
||||||
for i in range(3, 26):
|
|
||||||
# Construct the folder name
|
|
||||||
folder_name = f"day_{i}"
|
|
||||||
|
|
||||||
# Construct the full path to the folder
|
|
||||||
folder_path = os.path.join(base_dir,str(year), folder_name)
|
|
||||||
|
|
||||||
# Create the folder
|
|
||||||
os.makedirs(folder_path, exist_ok=True)
|
|
||||||
|
|
||||||
# Construct the full path to the placeholder file
|
|
||||||
input_file_path = os.path.join(folder_path, "input.txt")
|
|
||||||
puzzle_file_path = os.path.join(folder_path, "puzzle_text.md")
|
|
||||||
solution_file_path_1 = os.path.join(folder_path, "part 1 solution.py")
|
|
||||||
solution_file_path_2 = os.path.join(folder_path, "part 2 solution.py")
|
|
||||||
|
|
||||||
# Create the placeholder file
|
|
||||||
with open(input_file_path, "w") as file:
|
|
||||||
file.write("Paste any inputs into this file.")
|
|
||||||
|
|
||||||
# Create the puzzle file
|
|
||||||
with open(puzzle_file_path, "w") as file:
|
|
||||||
file.write( f"# Day {i} Puzzle Text.")
|
|
||||||
|
|
||||||
# Create the solution file
|
|
||||||
with open(solution_file_path_1, "w") as file:
|
|
||||||
file.write(f"""import os
|
|
||||||
|
|
||||||
with open(r'{input_file_path}', 'r') as file:
|
|
||||||
input = file.read()
|
|
||||||
|
|
||||||
print(input)
|
|
||||||
""")
|
|
||||||
with open(solution_file_path_2, "w") as file:
|
|
||||||
file.write(f"""import os
|
|
||||||
|
|
||||||
with open(r'{input_file_path}', 'r') as file:
|
|
||||||
input = file.read()
|
|
||||||
|
|
||||||
print(input)
|
|
||||||
""")
|
|
||||||
|
|
||||||
create_advent_year()
|
|
||||||
Reference in New Issue
Block a user