orfeasa / advent-of-code-2022

My solutions to the Advent of Code 2022 problems in Python πŸŽ„

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸŽ„ Advent of Code 2022 πŸŽ„

AoC2022 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.10+.

python3 day_xx/main.py

You may want to replace python3 with python3.10 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 Calorie Counting ⭐⭐
02 Rock Paper Scissors ⭐⭐
03 Rucksack Reorganization ⭐⭐
04 Camp Cleanup ⭐⭐
05 Supply Stacks ⭐⭐
06 Tuning Trouble ⭐⭐
07 No Space Left On Device ⭐⭐
08 Treetop Tree House ⭐⭐
09 Rope Bridge ⭐⭐
10 Cathode-Ray Tube ⭐⭐
11 Monkey in the Middle ⭐⭐
12 Hill Climbing Algorithm ⭐⭐
13 Distress Signal ⭐⭐
14 Regolith Reservoir ⭐⭐
15 Beacon Exclusion Zone
16 Proboscidea Volcanium
17 Pyroclastic Flow
18 Boiling Boulders
19 Not Enough Minerals
20 Grove Positioning System ⭐⭐
21 Monkey Math ⭐⭐
22 Monkey Map ⭐
23 Unstable Diffusion ⭐⭐
24 Blizzard Basin ⭐⭐
25 Full of Hot Air ⭐⭐

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 site, 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

Linting

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

About

My solutions to the Advent of Code 2022 problems in Python πŸŽ„

License:MIT License


Languages

Language:Python 98.5%Language:Shell 1.5%