Skip to content

My solutions to the Advent of Code 2021 problems in Python 🎄

License

Notifications You must be signed in to change notification settings

orfeasa/advent-of-code-2021

Repository files navigation

🎄 Advent of Code 2021 🎄

AoC2021 logo

Summary

Advent of Code is an annual Advent calendar of programming puzzles. This year I am doing it in Python.

Running the code

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).

Overview

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

New Day

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

How to get your cookie

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.

Then find the row with "session" as name, copy the value and paste it in your newly created cookie.txt file

Linting

black . && isort . && flake8 --max-line-length=100

About

My solutions to the Advent of Code 2021 problems in Python 🎄

Topics

Resources

License

Stars

Watchers

Forks