eduherminio / AoCHelper

Helper .NET library for solving Advent of Code puzzles

Home Page:https://adventofcode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to do multiple years

h2oboi89 opened this issue · comments

I've taken the idea of your framework and expanded on it by allowing for multiple years.

My updated project structure is as follows:

+---AdventOfCode
|   AdventOfCode.csproj
|   GlobalUsings.cs
|   Program.cs
|
+---2015
|   |   Day_01.cs
|   |   Day_02.cs
|   |   Day_03.cs
|   |
|   \---Inputs
|           01.txt
|           02.txt
|           03.txt
|
+---2021
    |   Day_01.cs
    |   Day_02.cs
    |   Day_03.cs
    |
    \---Inputs
            01.txt
            02.txt
            03.txt

Thanks for the suggestion @h2oboi89.
Out of curiosity, do you find that more useful than having N projects, one per year?

Apart for simplicity in terms of AoCHelper implementation, the main advantage I find to maintaining one project per year is being able to use different versions of .NET/Libraries: if next year .NET 7 is released with breaking changes and AoCHelper 2.x is released with breaking changes, I wouldn't like having to update all my previous years just to use a new version of .NET/AoCHelper in 2022.

An example of a AoCHelper breaking change between v0.x and v1.x was the signature of the solver methods: ValueTask<string> instead of string, which in case of keeping all the previous years in the same project, would have required changes in all the Day files in the repo to accommodate the new version.

I only discovered AoC this year, so I am doing a lot of catch up. I'm rather impatient so I have started doing 2015 while I wait for the next days problem to be released.

I liked your idea with the framework but was annoyed at having to copy paste stuff between the solutions and not being able to run all days at once so I made the improvement on my end.

> dotnet run -c Release --project .\AdventOfCode\ -- --help
AdventOfCode 1.0.0
Copyright (C) 2021 AdventOfCode

  -y, --year      Year selection (default is highest year)

  --all           Enables running all days for year or all years if no year is specified

  --help          Display this help screen.

  --version       Display version information.

  value pos. 0    Specify days to run (ie: 1 2 3)

I'm using CommandLineParser for args and added -y #### as to let me focus on year.

Fair enough, I'll leave this issue open to track the feature suggestion so that people can 👍🏼 if they agree, but not planning to implement it straight away for the reasons mentioned above.

https://github.com/h2oboi89/AdventOfCode

Here is link to my code for your reference should you choose to implement this.

#181 allows to execute problems from assemblies different from the one where Solver is used.
This facilitates doing multiple years in the same repository, with the restriction of using a different library/project per year.

That's showcased in AdventOfCode.MultiYearTemplate.

Despite the potential pros of keeping each year separated from each other and the effort to simplify the solution structure there (i.e. using Directory.Build.Props heavily), I still acknowledge the desire to keep all the years in the same project and share the goal of eventually getting there, so will keep this issue open for the purpose of tracking that.