bsamseth / advent-of-code

Solutions to Advent of Code puzzles.

Home Page:https://adventofcode.com

Repository from Github https://github.combsamseth/advent-of-codeRepository from Github https://github.combsamseth/advent-of-code

Advent of Code

Solutions to Advent of Code puzzles.

Many days solved in Python, a good portion of earier years in C++, a pinch of Haskell, and more recently using Rust. All days are written as standalone solutions and can be run independently.

Python

Use poetry to install dependencies from the pyproject.toml.

> poetry install
> cd <path to solution>
> poetry run python day_XX.py

C++

Compile using any reasonably recent C++ compiler, unless otherwise specified:

> cd aoc-20XX/day-XX
> g++ -O3 -o day_XX day_XX.cpp

Haskell

To run Haskell solutions in a way that ensures any potential extra packages are available, use stack. Once installed, the solutions can be run as stack scripts:

> cd aoc-20XX/day-XX
> stack day_XX.hs

Rust

Each rust solution is written as a binary crate, and can be compiled and run using Cargo.

> cd aoc-20XX/day-XX
> cargo run --release

init_day.py

This script will fetch the description and input data for a given day and year. If run without any options, it tries to fetch the current day.

> mkdir aoc-2018  # The folder must exist first.
> python init_day.py --day 25 --year 2018

Your AoC session key must be provided, and by default it is assumed to be the content of a file located in ~/.config/aocd/token. To get the session key, open the input file url when logged in to AoC and use the inspector to look for the cookie that was sent with the request.

About

Solutions to Advent of Code puzzles.

https://adventofcode.com

License:MIT License


Languages

Language:Rust 36.3%Language:Python 33.9%Language:C++ 21.5%Language:Haskell 7.8%Language:Makefile 0.2%Language:CMake 0.2%