Home

Awesome

Advent of Code Solutions and CLI

Buy Me a Coffee Advent of Code Made with Python Last commit

<!-- Badges of stars: begin -->

AoC 2015 AoC 2016 AoC 2017 AoC 2018 AoC 2019
AoC 2020 AoC 2021 AoC 2022 AoC 2023

<!-- Badges of stars: end -->

This project contains all my solutions for Advent of Code challenges.

[!WARNING] Note that this project can automatically download tasks and inputs and submit your solutions to the Advent of Code server. Please use it moderately.

A brief introduction taken from the website:

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.

In addition, this project contains a command-line application for managing, testing, solving and submitting Advent of Code challenges. This tool allows users to create challenge setups, run tests, generate test files, and provides solutions for various tasks.

[!IMPORTANT] Take into account that if all tests passed and you select the option -a or --answer then the puzzle will be solved, and the output will be copied to the clipboard, so it can be easily pasted in the Advent of Code website. Also note that if you select the option -s or --submit then this answer will be automatically submitted to the Advent of Code server and you will get a console message to let you know whether you answered the task correctly or not šŸ˜„

Table of Contents

Stats

For every year, the Advent of Code calendar has 25 challenges with 2 tasks per challenge. Every task gives you a star ā­ļø so the maximum amount of stars for a year is 50.

<!-- Table summary of years: begin -->
YearStarsAdvent of Code Link
2015ā­ļø12https://adventofcode.com/2015
2016ā­ļø10https://adventofcode.com/2016
2017ā­ļø10https://adventofcode.com/2017
2018ā­ļø10https://adventofcode.com/2018
2019ā­ļø10https://adventofcode.com/2019
2020ā­ļø10https://adventofcode.com/2020
2021ā­ļø10https://adventofcode.com/2021
2022ā­ļø10https://adventofcode.com/2022
2023ā­ļø10https://adventofcode.com/2023
<!-- Table summary of years: end -->

Features

The vscode_tasks directory along with the .vscode directory enhances the development experience for Advent of Code solutions by providing utility scripts and configurations specifically designed for use within Visual Studio Code. This feature streamlines the process of executing and testing solutions, making it easier to validate outputs and manage tasks. This will add a launch configuration to run the current open file solution and 2 tasks, one for running the solution and the other one for testing the solution.

Installation

This application is cross-platform, so it works on Linux, MacOS and Windows. To use it, ensure you have Python >= 3.10 installed. Clone the repository and install the required dependencies:

git clone https://github.com/jromero132/advent-of-code
cd advent-of-code
pip install -r requirements.txt
echo "AOC_COOKIE=<your-aoc-session-cookie>" > .env

[!NOTE] The AOC_COOKIE is your Advent of Code session cookie. You can search for it pressing F12 and going into the Network tab in your browser.

Usage

The application provides several commands. Use the --help option with the app or any command to see its usage.

Commands

Solutions

This project includes all my solutions for Advent of Code challenges. You can run the solutions directly or use the CLI to test them against provided inputs.

Directory Structure

Each solution is organized by year, day and task, allowing easy access to the implementations.

advent-of-code
ā”œā”€ā”€ ...
ā”œā”€ā”€ year
ā”‚   ā”œā”€ā”€ 2015
ā”‚   ā”‚   ā”œā”€ā”€ day01
ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ task1
ā”‚   ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ tests
ā”‚   ā”‚   ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ 01.in
ā”‚   ā”‚   ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ 01.out
ā”‚   ā”‚   ā”‚   ā”‚   ā”‚   ā””ā”€ā”€ ...
ā”‚   ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ description.md
ā”‚   ā”‚   ā”‚   ā”‚   ā””ā”€ā”€ main.py
ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ task2
ā”‚   ā”‚   ā”‚   ā”‚   ā””ā”€ā”€ ...
ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ task.in
ā”‚   ā”‚   ā”‚   ā”œā”€ā”€ task1.out
ā”‚   ā”‚   ā”‚   ā””ā”€ā”€ task2.out
ā”‚   ā”‚   ā”œā”€ā”€ ...
ā”‚   ā”‚   ā””ā”€ā”€ day25
ā”‚   ā”‚       ā””ā”€ā”€ ...
ā”‚   ā”œā”€ā”€ ...
ā”‚   ā””ā”€ā”€ 2023
ā”‚       ā””ā”€ā”€ ...
ā””ā”€ā”€ ...

year/**: Contains subdirectories for each year of challenges. For instance, from 2015 to 2023.

day##/**: Contains the solutions and additional files for each specified day of the Advent of Code challenges. The days are numbered from 01 to 25. Inside each day directory you will find:

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License - see the license file for details.

Happy Coding! šŸš€