From 0fb593e206ff3a1df59f1d6c44da1baf8599d878 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Sat, 16 Dec 2023 21:00:36 -0600
Subject: [PATCH 1/2] chore: scaffold for day 12 puzzle
---
12/HotSprings.Tests/GlobalUsings.cs | 2 ++
12/HotSprings.Tests/HotSprings.Tests.csproj | 30 +++++++++++++++++++++
12/HotSprings.Tests/UnitTest1.cs | 10 +++++++
12/HotSprings/HotSprings.csproj | 10 +++++++
12/HotSprings/Program.cs | 2 ++
AdventOfCode2023.sln | 16 +++++++++++
6 files changed, 70 insertions(+)
create mode 100644 12/HotSprings.Tests/GlobalUsings.cs
create mode 100644 12/HotSprings.Tests/HotSprings.Tests.csproj
create mode 100644 12/HotSprings.Tests/UnitTest1.cs
create mode 100644 12/HotSprings/HotSprings.csproj
create mode 100644 12/HotSprings/Program.cs
diff --git a/12/HotSprings.Tests/GlobalUsings.cs b/12/HotSprings.Tests/GlobalUsings.cs
new file mode 100644
index 0000000..7fef4b0
--- /dev/null
+++ b/12/HotSprings.Tests/GlobalUsings.cs
@@ -0,0 +1,2 @@
+global using Xunit;
+global using FluentAssertions;
\ No newline at end of file
diff --git a/12/HotSprings.Tests/HotSprings.Tests.csproj b/12/HotSprings.Tests/HotSprings.Tests.csproj
new file mode 100644
index 0000000..05c2d07
--- /dev/null
+++ b/12/HotSprings.Tests/HotSprings.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/12/HotSprings.Tests/UnitTest1.cs b/12/HotSprings.Tests/UnitTest1.cs
new file mode 100644
index 0000000..60c68a0
--- /dev/null
+++ b/12/HotSprings.Tests/UnitTest1.cs
@@ -0,0 +1,10 @@
+namespace HotSprings.Tests;
+
+public class UnitTest1
+{
+ [Fact]
+ public void Test1()
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/12/HotSprings/HotSprings.csproj b/12/HotSprings/HotSprings.csproj
new file mode 100644
index 0000000..2150e37
--- /dev/null
+++ b/12/HotSprings/HotSprings.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/12/HotSprings/Program.cs b/12/HotSprings/Program.cs
new file mode 100644
index 0000000..3751555
--- /dev/null
+++ b/12/HotSprings/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 34aded4..741151e 100644
--- a/AdventOfCode2023.sln
+++ b/AdventOfCode2023.sln
@@ -69,6 +69,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CosmicExpansion", "11\Cosmi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CosmicExpansion.Tests", "11\CosmicExpansion.Tests\CosmicExpansion.Tests.csproj", "{0D6CD658-65BB-47DC-A865-E3428EBE3075}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "12", "12", "{ABF03698-B81C-45DE-B76A-C7FBC0C72DB6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotSprings", "12\HotSprings\HotSprings.csproj", "{DB4A8A1F-54A8-4534-AE0A-027B365AA73B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotSprings.Tests", "12\HotSprings.Tests\HotSprings.Tests.csproj", "{2731DE56-AF4B-4009-8259-2EA5A9A102FE}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -166,6 +172,14 @@ Global
{0D6CD658-65BB-47DC-A865-E3428EBE3075}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D6CD658-65BB-47DC-A865-E3428EBE3075}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D6CD658-65BB-47DC-A865-E3428EBE3075}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DB4A8A1F-54A8-4534-AE0A-027B365AA73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DB4A8A1F-54A8-4534-AE0A-027B365AA73B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DB4A8A1F-54A8-4534-AE0A-027B365AA73B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DB4A8A1F-54A8-4534-AE0A-027B365AA73B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2731DE56-AF4B-4009-8259-2EA5A9A102FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2731DE56-AF4B-4009-8259-2EA5A9A102FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2731DE56-AF4B-4009-8259-2EA5A9A102FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2731DE56-AF4B-4009-8259-2EA5A9A102FE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3F8EAC09-4BC7-43AA-B72B-48DDD2710F6D} = {8C29858C-623A-461A-BF0B-254E151CD9C2}
@@ -190,5 +204,7 @@ Global
{B1DA407F-DA29-4BDA-B10E-8B9A976B0C5E} = {9703A36A-A019-4ADC-93A7-9DF4EFBCBFBC}
{580A3C98-7A39-4323-839A-5C2E0B6E8E74} = {01A6D73F-996E-48B3-B111-2725016A49C2}
{0D6CD658-65BB-47DC-A865-E3428EBE3075} = {01A6D73F-996E-48B3-B111-2725016A49C2}
+ {DB4A8A1F-54A8-4534-AE0A-027B365AA73B} = {ABF03698-B81C-45DE-B76A-C7FBC0C72DB6}
+ {2731DE56-AF4B-4009-8259-2EA5A9A102FE} = {ABF03698-B81C-45DE-B76A-C7FBC0C72DB6}
EndGlobalSection
EndGlobal
From 7a50700d50e25dcc25309884449851df1537ac7f Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Mon, 18 Dec 2023 10:47:24 -0600
Subject: [PATCH 2/2] feat: solve part 1 and part 2
---
12/HotSprings.Tests/ConditionTests.cs | 253 ++++++++++++++++++++
12/HotSprings.Tests/HotSprings.Tests.csproj | 6 +
12/HotSprings.Tests/UnitTest1.cs | 10 -
12/HotSprings/Program.cs | 239 +++++++++++++++++-
README.md | 2 +-
5 files changed, 497 insertions(+), 13 deletions(-)
create mode 100644 12/HotSprings.Tests/ConditionTests.cs
delete mode 100644 12/HotSprings.Tests/UnitTest1.cs
diff --git a/12/HotSprings.Tests/ConditionTests.cs b/12/HotSprings.Tests/ConditionTests.cs
new file mode 100644
index 0000000..afbbdf8
--- /dev/null
+++ b/12/HotSprings.Tests/ConditionTests.cs
@@ -0,0 +1,253 @@
+namespace HotSprings.Tests;
+
+public class ConditionTests
+{
+ [Theory]
+ [MemberData(nameof(TestData.ParseTestData), MemberType = typeof(TestData))]
+ public void Parse_WhenGivenConditionRecordInput_ItShouldReturnExpectedConditionInstance(string input, Condition expected)
+ {
+ var result = Condition.Parse(input);
+ result.Should().BeEquivalentTo(expected);
+ }
+
+ [Theory]
+ [MemberData(nameof(TestData.GetNumberOfPossibleConfigurationsTestData), MemberType = typeof(TestData))]
+ public void GetNumberOfPossibleConfigurations_WhenGivenCondition_ItShouldReturnExpectedNumberOfPossibleConfigurations(Condition condition, long expected)
+ {
+ var result = condition.GetNumberOfPossibleConfigurations();
+ result.Should().Be(expected);
+ }
+
+ [Theory]
+ [MemberData(nameof(TestData.ParseAndUnFoldTestData), MemberType = typeof(TestData))]
+ public void ParseAndUnFold_WhenGivenConditionRecordInput_ItShouldReturnExpectedConditionInstance(string input, Condition expected)
+ {
+ var result = Condition.Parse(input, true);
+ result.Should().BeEquivalentTo(expected);
+ }
+
+ [Fact]
+ public void Condition_WhenGivenInput_ItShouldReturnExpectedCount()
+ {
+ var input = File.ReadAllLines("INPUT.txt");
+ var result = input
+ .Select(c => Condition.Parse(c))
+ .Select(c => c.GetNumberOfPossibleConfigurations())
+ .Sum();
+
+ result.Should().Be(6958);
+ }
+
+ [Fact]
+ public void Condition_WhenGivenInputAndPartTwo_ItShouldReturnExpectedCount()
+ {
+ var input = File.ReadAllLines("INPUT.txt");
+ var result = input
+ .Select(c => Condition.Parse(c, true))
+ .Select(c => c.GetNumberOfPossibleConfigurations())
+ .Sum();
+
+ result.Should().Be(6555315065024);
+ }
+
+ public static class TestData
+ {
+ public static IEnumerable