Skip to content

apolichronopoulos/adventofcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adventofcode

Personal repository for advent of code challenges

1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25

1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25

Python

Create a venv with custom requirements

cd ./python
rm -rf venv
python3.11 -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt
pip install --upgrade pip

Run puzzles

Use venv (or any other python env you want)

. ./python/venv/bin/activate

Run specific puzzle

cd ./python && year=2024 && day=14
python -m ${year}.puzzle_${year}_${day} ../puzzles

Run all puzzles

Run as module

cd ./python
year=$(date -v -11m +%Y)
for day in {01..25}
do
  python -m ${year}.puzzle_${year}_${day} ../puzzles
done

or include path, to use utils

cd ./python
export PYTHONPATH=$(pwd)
year=$(date -v -11m +%Y)
for day in {01..25}
do
  python ./${year}/puzzle_${year}_${day}.py ../puzzles
done

aoc-cli

Download puzzle description and/or input using aoc-cli

Note: to use authenticated requests put your session token in ~/.adventofcode.session

year=$(date -v -11m +%Y)
for day in {01..25}
do
  mkdir -p ./puzzles/$year/$day/
  aoc download -y $year -d $day -o -P -p ./puzzles/$year/$day/puzzle.md
  aoc download -y $year -d $day -o -I -i ./puzzles/$year/$day/input.txt
done
pre-commit run --files ./puzzles/**/*

Releases

No releases published

Packages

No packages published

Languages