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.
.NET SDK installed on your machine.
- Clone this repository to your local machine:
git clone https://github.com/your-username/advent-of-code.git
- Navigate to the project directory:
cd advent-of-code
- 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
- Open the newly created solution class file in your preferred IDE or text editor and implement the solution logic.
The application supports two main commands:
- 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.
- 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.
Inspiration and challenges provided by Advent of Code.