Advent of Code Solver

This repository contains my solutions for the Advent of Code challenges. Each year and day have their respective directories with C# solution classes. The solutions are organized using the following structure:

/Year
    /Day01
        - Input.txt
        - SolutionClass01.cs
    /Day02
        - Input.txt
        - SolutionClass02.cs
  ...

The Input.txt file contains the input data for the challenge. The solution for daily challenges inherits from the abstract Solution class, which contains the logic for reading the input file and executing the concrete solution. The concrete solution class contains the Solve method, which is where the solution logic is implemented.

Getting Started

Prerequisites

.NET SDK installed on your machine.

Installation

  1. Clone this repository to your local machine:
   git clone https://github.com/your-username/advent-of-code.git
  1. Navigate to the project directory:
cd advent-of-code
  1. Run the provided script to add a new solution:
./add_solution.sh <year> <day> <solution_name>

Example:

./add_solution.sh 2023 1 MyNewSolution

Note: You may need to give the script execute permissions:

chmod +x add_solution.sh
  1. Open the newly created solution class file in your preferred IDE or text editor and implement the solution logic.

Running Solutions

The application supports two main commands:

Solve All Challenges:

  • To solve all available challenges, use the following command:
dotnet run all
  • This will execute the SolveAll method, which finds all solutions and outputs their results.

Solve Specific Challenge:

  • To solve a specific challenge for a given year and day, use the following command:
dotnet run solve -year <year> -day <day>
  • Replace <year> and <day> with the desired values.
  • This will execute the SolveDay method, which finds and solves the specified challenge.

Acknowledgments

Inspiration and challenges provided by Advent of Code.

https://adventofcode.com/