Skip to content

flerka/adventofcode-2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent Of Code 2021 with C#

This repository contains my solutions for Advent of code 2021 🎄. All tasks are solved with C# and have unit tests to validate them.

I tried solving all tasks using only .Net 6 without external libraries. You can run any solution from the corresponding test.

I made a point not to share any code between parts one and two. I tried to use new language features and a more functional approach, but with later tasks I wasn't always successful in it.

Navigation

In project adventofcode-2021 you can find solution algorithms and in adventofcode-2021.Tests you can find tests that run said solutions. I store the first and the second parts in different folders. The same structure applies to both projects.

You can find input data files and input parsers code in adventofcode-2021.Tests project. To use your input data instead of mine, you should update the data file you can find in the same folder as a test runner. For example - data file for the day one part one.

part 1 part 2
day 1 solution, test runner solution, test runner
day 2 solution, test runner solution, test runner
day 3 solution, test runner solution, test runner
day 4 solution, test runner solution, test runner
day 5 solution, test runner solution, test runner
day 6 solution, test runner solution, test runner
day 7 solution, test runner solution, test runner
day 8 solution, test runner solution, test runner
day 9 solution, test runner solution, test runner
day 10 solution, test runner solution, test runner
day 11 solution, test runner solution, test runner
day 12 solution, test runner solution, test runner
day 13 solution, test runner solution, test runner
day 14 solution, test runner solution, test runner
day 15 solution, test runner solution, test runner
day 16 solution, test runner solution, test runner
day 17 solution, test runner solution, test runner
day 18 solution, test runner solution, test runner
day 19 solution, test runner solution, test runner
day 20 solution, test runner solution, test runner
day 21 solution, test runner solution, test runner
day 22 solution, test runner solution, test runner
day 23 solution, test runner solution, test runner
day 24 solution, test runner solution, test runner
day 25 solution, test runner solution, test runner

How to run

  1. Install .Net Core 6.

  2. Clone my repository.

  3. Inside code folder run in console

    dotnet test --filter "DisplayName~Task1_"

    Task1_ should be replaced with task number you want to run (to get the task number click on the solution link in the table above).

My stats

main

Disclaimer

I implemented each solution the same day it was published and haven't done any refactoring afterward (except minor cleanup and warning fixes), so sometimes the code may be a bit straightforward.