Skip to content

askmadsen/code-puzzles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Puzzles

Welcome to my Code Puzzles repository, a collection of Python solutions for challenges from multiple years of Advent of Code. To access the problems and puzzle inputs see the official webpage: Advent of Code

Requirements

Before running any of the puzzle solutions, make sure you have the following installed:

  • Python 3.10+
  • Tyro (for running the CLI commands)
  • NumPy (used in some solutions for numerical operations)

Install all Python dependencies via:

pip install -r requirements.txt

Project Structure

code-puzzles/
├─ run.py                 # Unified CLI to run all solutions. Prints output and execution time
├─ setup.py               # Unified CLI for complete folder setup or resetting solutions
├─ requirements.txt       # Requirements for running the puzzle solutions
├─ README.md              # Project overview and usage instructions
├─ aoc_templates/         # Folder with templates
|   ├─ template.md        # Used to autogenerate the README file for a generated year
|   ├─ template.py        # Used to autogenerate the solutions file for a given day
├─ y2025/                 # Folder for Advent of Code year 2025
│   ├─ README.md          # Year overview highlighting solved puzzles and interesting solutions
│   ├─ Day01/             # Folder for each day 1 in year 2025
│   │   ├─ solution.py    # Fast and slow implementations of the puzzle for that day
│   │   └─ (optional test/input files)
│   ├─ Day02/             
│   │   ├─ solution.py
│   │   └─ (optional test/input files)
│   └─ Day03/ …
├─ y2024/
│   ├─ README.md
│   ├─ Day01/
│   │   ├─ solution.py
│   │   └─ …
│   └─ Day02/ …
└─ y2023/ …

Setup

Clone the repository

git clone https://github.com/askmadsen/code-puzzles.git

To generate the entire folder structure for a given Advent of Code year

# Generates the folder structure for year 2025 with 12 puzzle days.
python setup.py mode:generate --mode.year 2025 --mode.num-days 12

To reset an entire year or part of solutions for a given Advent of Code year

# Resets the solutions for year 2025 from day 2 until day 5.
python setup.py mode:reset --mode.year 2025 --mode.start 2 --mode.end 5

# Resets all solutions for year 2024.
python setup.py mode_reset --mode.year 2024 

Usage

To run any puzzle solution, navigate to the root folder and use the following CLI:

# Runs both solutions to part 1 of the puzzle from year 2015, day 1 on the given input file
python run.py --year 2015 --day 1 --part 1 --method both --input y2015/Day1/input.txt

# Runs the fast solution to part 2 of the puzzle from year 2020, day 20 on the given input file
python run.py --year 2020 --day 20 --part 2 --method fast --input y2020/Day20/input.txt

# Runs the slow solution to part 2 of the puzzle from year 2020, day 20 on the input 203023
python run.py --year 2020 --day 20 --part 2 --method fast --input 203023

Years

Year Progress Link
2015 15/50 ⭐ 2015
2016 0/50 ⭐ 2016
2017 0/50 ⭐ 2017
2018 0/50 ⭐ 2018
2019 0/50 ⭐ 2019
2020 0/50 ⭐ 2020
2021 0/50 ⭐ 2021
2022 0/50 ⭐ 2022
2023 0/50 ⭐ 2023
2024 0/50 ⭐ 2024
2025 0/50 ⭐ 2025

Note: Resetting solutions for a specific year will clear that year's solution files and regenerate its README table. The global progress table above is not affected.

Additional Information

  • This repository does not include official puzzle inputs, puzzle descriptions, or any other Advent of Code content. Only my own solutions to the puzzles are provided. The repository does not use the Advent of Code brand beyond mentioning the brand name and linking to the official site.
  • Optional small test inputs may exist within each day’s folder to quickly verify correctness.
  • Fast and slow implementations allow comparing brute-force vs optimized approaches.

About

A collection of Python solutions for Advent of Code puzzles, organized by year and day. Includes both fast and slow implementations, and a unified CLI for running any puzzle with custom input.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages