Skip to content

blckr/advent-of-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code

Here are my solutions of advent-of-code. The creator asked not to make the puzzles or input public, and I respect that of course.

If you plan to use my code, I recommend recreating the following folder structure. In my case, I included a git submodule to a private repository with the puzzles.

.
├── Cargo.lock
├── Cargo.toml
├── flake.lock
├── flake.nix
├── inputs (not included in this Repository)
│   └── y25
│       ├── d01
│       │   ├── input.txt
│       │   └── README.md
│       ├── d02
│       │   ├── input.txt
│       │   └── README.md
├── src
│   ├── main.rs
│   └── y25
│       ├── d01
│       │   ├── mod.rs
│       │   ├── part1.rs
│       │   └── part2.rs
│       ├── d02
│       │   ├── mod.rs
│       │   ├── part1.rs
│       │   └── part2.rs

Getting Started

Cloning the Repository

git clone git@codeberg.org:blckr/advent-of-code.git
cd advent-of-code

Setting Up Your Input Files

Since this repository does not include puzzle descriptions or personal input files, you need to set them up yourself:

  1. Create the input directory structure:

    mkdir -p inputs/y25/d01
    mkdir -p inputs/y25/d02
    mkdir -p inputs/y25/d03
    mkdir -p inputs/y25/d04
  2. Add your input files:

    • Download your puzzle input from adventofcode.com
    • Place input.txt in each day's folder (e.g., inputs/y25/d01/input.txt)
  3. (Optional) Use a private submodule: If you want to version control your inputs in a private repository, you can use a git submodule. See the "Using a Private Submodule" section below.

Running the Project

Execute solutions using the following syntax: cargo run <Year>.<Day>.<Part>. The year uses only the last 2 digits.

cargo run 25.1.1    # Year 2025, Day 1, Part 1
cargo run 25.4.2    # Year 2025, Day 4, Part 2

Running with Nix

This project includes a flake.nix that defines all dependencies for a reproducible development environment. To use it:

direnv allow    # Automatically load the environment

Or run it without direnv:

nix flake shell

If you're not using Nix, simply ignore flake.nix and flake.lock.

Using a Private Submodule

Why Use a Submodule?

If you want to version control your puzzle inputs and descriptions, but keep them private, you can use a git submodule to reference a private repository.

Setup Instructions

  1. Create a private repository for your inputs on your Git Provider.

  2. Add the submodule to this repository:

    With SSH config alias:

    git submodule add git@codeberg-blckr:blckr/advent-of-code-riddles.git inputs

    Or with direct SSH URL:

    git submodule add ssh://git@codeberg.org/blckr/advent-of-code-riddles.git inputs
  3. Commit the changes:

    git add .gitmodules inputs
    git commit -m "Add private inputs submodule"

Cloning with Submodules

When cloning this repository with a configured submodule, use:

git clone --recurse-submodules git@codeberg.org:blckr/advent-of-code.git

If you've already cloned without submodules, initialize them:

git submodule update --init --recursive

Updating the Submodule

To pull the latest changes from your private inputs repository:

git submodule update --remote

Or navigate into the inputs directory and pull manually:

cd inputs
git pull origin main
cd ..
git add inputs
git commit -m "Update inputs"

Notes

The inputs/ directory is intentionally not included in this repository to respect the Advent of Code creator's request not to share puzzle descriptions and personal input files publicly.

About

The solutions for the Advent of Code Riddles posted at https://adventofcode.com/

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors