From 3d3b667f23c6e691e27e17222beb5aa1e9696e56 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Wed, 20 Dec 2023 13:35:37 -0600
Subject: [PATCH 1/4] chore: scaffold for day 14 puzzle
---
.../GlobalUsings.cs | 2 ++
.../ParabolicReflectorDish.Tests.csproj | 30 +++++++++++++++++++
14/ParabolicReflectorDish.Tests/UnitTest1.cs | 10 +++++++
.../ParabolicReflectorDish.csproj | 10 +++++++
14/ParabolicReflectorDish/Program.cs | 2 ++
AdventOfCode2023.sln | 16 ++++++++++
6 files changed, 70 insertions(+)
create mode 100644 14/ParabolicReflectorDish.Tests/GlobalUsings.cs
create mode 100644 14/ParabolicReflectorDish.Tests/ParabolicReflectorDish.Tests.csproj
create mode 100644 14/ParabolicReflectorDish.Tests/UnitTest1.cs
create mode 100644 14/ParabolicReflectorDish/ParabolicReflectorDish.csproj
create mode 100644 14/ParabolicReflectorDish/Program.cs
diff --git a/14/ParabolicReflectorDish.Tests/GlobalUsings.cs b/14/ParabolicReflectorDish.Tests/GlobalUsings.cs
new file mode 100644
index 0000000..7fef4b0
--- /dev/null
+++ b/14/ParabolicReflectorDish.Tests/GlobalUsings.cs
@@ -0,0 +1,2 @@
+global using Xunit;
+global using FluentAssertions;
\ No newline at end of file
diff --git a/14/ParabolicReflectorDish.Tests/ParabolicReflectorDish.Tests.csproj b/14/ParabolicReflectorDish.Tests/ParabolicReflectorDish.Tests.csproj
new file mode 100644
index 0000000..44829c1
--- /dev/null
+++ b/14/ParabolicReflectorDish.Tests/ParabolicReflectorDish.Tests.csproj
@@ -0,0 +1,30 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+ false
+ true
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
diff --git a/14/ParabolicReflectorDish.Tests/UnitTest1.cs b/14/ParabolicReflectorDish.Tests/UnitTest1.cs
new file mode 100644
index 0000000..0c4d24c
--- /dev/null
+++ b/14/ParabolicReflectorDish.Tests/UnitTest1.cs
@@ -0,0 +1,10 @@
+namespace ParabolicReflectorDish.Tests;
+
+public class UnitTest1
+{
+ [Fact]
+ public void Test1()
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/14/ParabolicReflectorDish/ParabolicReflectorDish.csproj b/14/ParabolicReflectorDish/ParabolicReflectorDish.csproj
new file mode 100644
index 0000000..2150e37
--- /dev/null
+++ b/14/ParabolicReflectorDish/ParabolicReflectorDish.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/14/ParabolicReflectorDish/Program.cs b/14/ParabolicReflectorDish/Program.cs
new file mode 100644
index 0000000..3751555
--- /dev/null
+++ b/14/ParabolicReflectorDish/Program.cs
@@ -0,0 +1,2 @@
+// See https://aka.ms/new-console-template for more information
+Console.WriteLine("Hello, World!");
diff --git a/AdventOfCode2023.sln b/AdventOfCode2023.sln
index 90f8bdb..efe8d0b 100644
--- a/AdventOfCode2023.sln
+++ b/AdventOfCode2023.sln
@@ -81,6 +81,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PointOfIncidence", "13\Poin
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PointOfIncidence.Tests", "13\PointOfIncidence.Tests\PointOfIncidence.Tests.csproj", "{0E74E842-A876-4E8C-9D10-BA09F40039EC}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "14", "14", "{D00D5BF8-754D-4D1B-9AF0-D701DFFEC9B1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParabolicReflectorDish", "14\ParabolicReflectorDish\ParabolicReflectorDish.csproj", "{671E1E43-48A1-441F-A681-111F64445504}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParabolicReflectorDish.Tests", "14\ParabolicReflectorDish.Tests\ParabolicReflectorDish.Tests.csproj", "{631931F8-01C5-428A-9ECE-DB54FA9032FE}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -194,6 +200,14 @@ Global
{0E74E842-A876-4E8C-9D10-BA09F40039EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E74E842-A876-4E8C-9D10-BA09F40039EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E74E842-A876-4E8C-9D10-BA09F40039EC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {671E1E43-48A1-441F-A681-111F64445504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {671E1E43-48A1-441F-A681-111F64445504}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {671E1E43-48A1-441F-A681-111F64445504}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {671E1E43-48A1-441F-A681-111F64445504}.Release|Any CPU.Build.0 = Release|Any CPU
+ {631931F8-01C5-428A-9ECE-DB54FA9032FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {631931F8-01C5-428A-9ECE-DB54FA9032FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {631931F8-01C5-428A-9ECE-DB54FA9032FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {631931F8-01C5-428A-9ECE-DB54FA9032FE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3F8EAC09-4BC7-43AA-B72B-48DDD2710F6D} = {8C29858C-623A-461A-BF0B-254E151CD9C2}
@@ -222,5 +236,7 @@ Global
{2731DE56-AF4B-4009-8259-2EA5A9A102FE} = {ABF03698-B81C-45DE-B76A-C7FBC0C72DB6}
{334D6DFF-6131-49C1-B54C-B9E8E00F1E3E} = {DC4E691A-0061-4937-8732-E8D8073C868D}
{0E74E842-A876-4E8C-9D10-BA09F40039EC} = {DC4E691A-0061-4937-8732-E8D8073C868D}
+ {671E1E43-48A1-441F-A681-111F64445504} = {D00D5BF8-754D-4D1B-9AF0-D701DFFEC9B1}
+ {631931F8-01C5-428A-9ECE-DB54FA9032FE} = {D00D5BF8-754D-4D1B-9AF0-D701DFFEC9B1}
EndGlobalSection
EndGlobal
From 24c171c790728e5726e2d0a9f120361840b2e903 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Wed, 20 Dec 2023 20:39:14 -0600
Subject: [PATCH 2/4] feat: solve part 1
---
14/ParabolicReflectorDish.Tests/DishTests.cs | 96 ++++++++++++++++
14/ParabolicReflectorDish.Tests/UnitTest1.cs | 10 --
14/ParabolicReflectorDish/Program.cs | 109 ++++++++++++++++++-
3 files changed, 203 insertions(+), 12 deletions(-)
create mode 100644 14/ParabolicReflectorDish.Tests/DishTests.cs
delete mode 100644 14/ParabolicReflectorDish.Tests/UnitTest1.cs
diff --git a/14/ParabolicReflectorDish.Tests/DishTests.cs b/14/ParabolicReflectorDish.Tests/DishTests.cs
new file mode 100644
index 0000000..db823bc
--- /dev/null
+++ b/14/ParabolicReflectorDish.Tests/DishTests.cs
@@ -0,0 +1,96 @@
+namespace ParabolicReflectorDish.Tests;
+
+public class DishTests
+{
+ [Theory]
+ [MemberData(nameof(TestData.ParseTestData), MemberType = typeof(TestData))]
+ public void Parse_GivenInput_ItShouldReturnDishInstance(string[] input, Dish expected)
+ {
+ var result = Dish.Parse(input);
+ result.Should().BeEquivalentTo(expected);
+ }
+
+ [Theory]
+ [MemberData(nameof(TestData.CalculateTotalLoadTestData), MemberType = typeof(TestData))]
+ public void CalculateTotalLoad_WhenCalled_ItShouldReturnExpectedLoad(Dish dish, long expected)
+ {
+ var result = dish.CalculateTotalLoad();
+ result.Should().Be(expected);
+ }
+
+ public static class TestData
+ {
+ private static readonly Dish TestDish = new(
+ [
+ ['O', 'O', 'O', 'O', '.', '#', '.', 'O', '.', '.'],
+ ['O', 'O', '.', '.', '#', '.', '.', '.', '.', '#'],
+ ['O', 'O', '.', '.', 'O', '#', '#', '.', '.', 'O'],
+ ['O', '.', '.', '#', '.', 'O', 'O', '.', '.', '.'],
+ ['.', '.', '.', '.', '.', '.', '.', '.', '#', '.'],
+ ['.', '.', '#', '.', '.', '.', '.', '#', '.', '#'],
+ ['.', '.', 'O', '.', '.', '#', '.', 'O', '.', 'O'],
+ ['.', '.', 'O', '.', '.', '.', '.', '.', '.', '.'],
+ ['#', '.', '.', '.', '.', '#', '#', '#', '.', '.'],
+ ['#', '.', '.', '.', '.', '#', '.', '.', '.', '.'],
+ ]
+ );
+
+ public static IEnumerable