11# Dotnet Advent of Code
22
3- [ Advent of Code] ( https://adventofcode.com ) template for .NET contenders, focus on the puzzle, let it handle the rest
3+ [ Advent of Code] ( https://adventofcode.com ) template for .NET contenders, focus on the puzzle, let it handle the rest
44
55> After gaining yours, consider leaving a small ⭐ to this project too!
66
77---
88
9+ ## Advantages
10+
11+ In order to solve your puzzle, you might need the debugger from time to time,
12+ especially as the puzzles become harder.
13+
14+ This template is built around test projects, in order to take advatage of the
15+ debugging possibilities and TDD if you want to.
16+
917## Usage
1018
1119This template exposes two classes: a ` Solver ` and a ` TestEngine ` .
@@ -27,20 +35,20 @@ You will then have to implement three different logics:
27352 . ** The logic for the first part of the puzzle**
28363 . ** The logic for the second part of the puzzle**
2937
30- > For example, if the first part of the puzzle is "Given a list of integers, find the greatest one" and the second one
38+ > For example, if the first part of the puzzle is "Given a list of integers, find the greatest one" and the second one
3139> "Now find the sum of them", we can do the following:
32- >
40+ >
3341> ``` csharp
3442> public class Solver : Solver <int [], int >
3543> {
3644> protected override string InputPath => " input.txt" ;
37- >
45+ >
3846> public override int PartOne (int [] input )
3947> => input .Max ();
40- >
48+ >
4149> public override int PartTwo (int [] input )
4250> => input .Sum ();
43- >
51+ >
4452> public override int [] ReadInput (string inputPath )
4553> => File
4654> .ReadAllLines (inputPath )
@@ -63,7 +71,7 @@ For each part you will have to specify what the example is (its input and soluti
6371Specifying the example allows the engine to test your solution against a predictible result in order to help you to debug it .
6472
6573> Keeping our example in mind , the associated `TestEngine ` might be :
66- >
74+ >
6775> ```csharp
6876> public class SolverTest : TestEngine < Solver , int [], int >
6977> {
@@ -74,18 +82,18 @@ Specifying the example allows the engine to test your solution against a predict
7482> Input = new [] { 1 , 2 , 3 },
7583> Result = 3 ,
7684> },
77- >
85+ >
7886> Solution = 5 ,
7987> };
80- >
88+ >
8189> public override Puzzle PartTwo => new ()
8290> {
8391> Example = new ()
8492> {
8593> Input = new [] { 1 , 2 , 3 },
8694> Result = 6 ,
8795> },
88- >
96+ >
8997> Solution = 15 ,
9098> };
9199> }
0 commit comments