Advent of Code is an annual Advent calendar of programming puzzles. This year I am doing it in Python.
To run the code of a specific day from the root directory run the following, replacing xx
with the day number, 01
- 25
. Make sure you use Python 3.9+.
python3 day_xx/main.py
You may want to replace python3
with python3.9
if the command above doesn't work.
To run the code of all days run the script:
./run_all.sh
Make sure you have given permission to execute (chmod +x run_all.sh
).
Day | Name | Stars |
---|---|---|
01 | Sonar Sweep | ββ |
02 | Dive! | ββ |
03 | Binary Diagnostic | ββ |
04 | Giant Squid | ββ |
05 | Hydrothermal Venture | ββ |
06 | Lanternfish | ββ |
07 | The Treachery of Whales | ββ |
08 | Seven Segment Search | ββ |
09 | Smoke Basin | ββ |
10 | Syntax Scoring | ββ |
11 | Dumbo Octopus | ββ |
12 | Passage Pathing | ββ |
13 | Transparent Origami | ββ |
14 | Extended Polymerization | ββ |
15 | Chiton | ββ |
16 | Packet Decoder | |
17 | Trick Shot | ββ |
18 | Snailfish | |
19 | Beacon Scanner | |
20 | Trench Map | ββ |
21 | Dirac Dice | β |
22 | Reactor Reboot | β |
23 | Amphipod | |
24 | Arithmetic Logic Unit | |
25 | Sea Cucumber | β |
To generate the directory for the current day, save your browser cookie in a file called cookie.txt
at the root level and run the new day script:
./new_day.sh
A session cookie is a small piece of data used to authenticate yourself to the
Advent of Code web servers. It is not human-readable and might look something
like this 53616c7465645f5fbd2d445187c5dc5463efb7020021c273c3d604b5946f9e87e2dc30b649f9b2235e8cd57632e415cb
.
To learn more about authentication cookies check this Wikipedia article
To get your cookie, go to the Advent of Code website, and while logged in.
- For Firefox: right and select "Inspect Element" and in the "Storage" tab select "Cookies" β "https://adventofcode.com"
- For Chrome: right and select "Inspect" and in the "Application" tab select "Cookies" β "https://adventofcode.com"
Then find the row with "session" as name, copy the value and paste it in your newly created cookie.txt
file
black . && isort . && flake8 --max-line-length=100