Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Raab70/advent-of-code

Repository files navigation

Advent of Code

This repository contains solutions for the Advent of Code challenges.

Getting Started

To get started with this project, you need to have uv installed. With uv installed you can use make sync to create and synchronize a virtual environment with all the dependencies needed.

Credentials Setup

If you want to use the aoc commands below such as looking at a leaderboard or downloading puzzle inputs you'll need a session token from adventofcode.com. Visit the website and login, then use devtools to inspect your requests and copy your session token. It'll be in the headers of your request as a cookie called session. This needs to be put into an environment variable called AOC_SESSION which is easiest to do by creating a .env file which has the contents:

AOC_SESSION=your_session_token

How I Solved

To get started with I used make setup to install tools like ipython that I use for solving problems.

To prepare for a new puzzle I follow this process:

  1. run advent create <day> where <day> is the current puzzle number to solve. This uses _template.py to create a file that's ready for development with a few utilities like the pr function which makes copying answers easy.
  2. Open a terminal and get ready with advent download <day>, you'll be running this as soon as the puzzle drops
  3. Open another terminal with ipython which you'll use for development. I mostly used the %run dayXX.py magic function to allow me to run scripts quickly but still have an interactive shell. By keeping code at the module-level after you use run you have access to all variables for further development. As you finish logic you can pull it out into a function for readability.

Available CLI Commands

The advent package provides several CLI commands to help you manage and run your solutions. Below are the available commands:

  • advent create <day>: Initialize the solution for a specific day.

    advent create 1
  • advent download <day>: Download the puzzle input to the data/ directory for use in your script

    advent download 1
  • advent download-all: Download all currently released puzzle inputs

    advent download-all
  • advent lb --day <day>: print the top of the leaderboard for the given day filter (optional), shows actual submission times instead of just stars

    advent lb --day 1

Use advent --help for more information as all commands are documented and be sure to checkout all of the solution utilities like aoc/grid.py

About

Advent of Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published