- Notifications
You must be signed in to change notification settings - Fork0
Kaba8081/advent-of-code
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository contains my sollutions in Python to a series of programming challanges calledAdvent of code.
To skip the hustle of making a new directory every time i want to move on to the next problem, I've created this simple program that automates that process and grabs the specified input file directly from AOC website.
By default the program will try to get the problem's input based on the current date, but it can also be specified by changing some of these paremeters in the console window:
-y
or--year
Default: current year
specify desired year of the challange (>=2015)-d
or--day
Default: current day
specify desired day of the challange (between 1 - 25)-c
or--create
Default: False
When set toTrue
creates amain.py
file inside the./year/day/
directory with the following contents:# 'Advent of code' solution for year {YEAR} day {DAY}importosimportsysglobalDIR_PATHDIR_PATH=os.path.dirname(os.path.realpath(__file__))defget_input():input=Noneifos.path.isfile(os.path.join(DIR_PATH,"input.txt")):withopen(os.path.join(DIR_PATH,"input.txt"),"r")asfile:input=file.read().strip().splitlines()returninputelse:print("Error! Input file does not exist!")sys.exit()if__name__=="__main__":input=get_input()ifnotinput:print("Error! Input file is empty!")sys.exit()# your code goes heresys.exit()
Advent of code's input files are generated based on the user's id inside the browser cookies. In order to retrieve this file from the server, a variable needs to be specified in a new file called.env
so that inside it should look like this:
AOC_COOKIE="..."# secret cookie id goes here
To find the value, press F12 while logged in onhttps://adventofcode.com/, go tostorage
tab and copy thesession
cookie value.
About
My solutions for 'Advent of code' challanges using python
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.