This repository contains solutions to the Advent of Code challenges implemented in Go. It is designed to streamline the process of running and generating solutions for specific days and years of the event.
- Solutions implemented in Go for various Advent of Code challenges.
- A Makefile for convenient build, run, and clean operations.
- Dynamic generation and execution of solution files.
- Go (version 1.22 or later is recommended)
- A Unix-like shell with
make
installed.
-
Clone the repository:
git clone https://github.com/your-username/advent-of-code-go.git cd advent-of-code-go
-
Install required Go modules:
go mod tidy
Before running or generating solutions, build the project using:
make build
This compiles the aoc
binary into the root directory.
To run a specific solution, use the following format:
make run YEAR=<year> DAY=<day> [ARGS...]
Example:
make run 2024 1
This runs the solution for Day 1 of Advent of Code 2024.
You can optionally pass additional arguments required by your solution:
make run 2024 1 arg1 arg2
To generate a new solution file, use:
make generate YEAR=<year> DAY=<day>
Example:
make generate 2024 1
This prepares a skeleton for the solution of Day 1 of 2024.
To clean up the compiled binary:
make clean
cmd/aoc
: Contains the main application logic for managing solutions.inputs/
: Stores input files for specific days and years.internal/
: Contains Go files implementing solutions for each day.
Ensure you have the session cookie for Advent of Code stored in an .env
file in the root directory:
SESSION_COOKIE=your-session-cookie-here
This allows the program to fetch puzzle inputs automatically.