diff --git a/src/AdventOfCode.Resources/Input/Y2024/Day12/input.txt b/src/AdventOfCode.Resources/Input/Y2024/Day12/input.txt new file mode 100644 index 000000000..33cef8ad7 --- /dev/null +++ b/src/AdventOfCode.Resources/Input/Y2024/Day12/input.txt @@ -0,0 +1,140 @@ +MMMMMMMMQMMZZRRXRRRRUUUUUUUUUUUUUUUUEEDEEEEEEEEEEEEEEEEEUUDDDDLLLLLLLLLLLLLJJJJJSSJJCCCCCCCCEEEEEEEEESSSSSSSSSSSSSSWWWWWWWWMMRRRRRRRRRIIIIII +MMMMMMMMMMMMZRRXRRRRUUUUUUUUUUUUUUUUEEEEEEEEEEKKKKKKEEEEUUUUDDDDLLLLLLLLLLLJJJJJJJJJJJCCCCCCEEEEEEEEESBSSSSSSSSSSSSWWWWWWWWMMMRRRRRRRRRIIIII +MMMMMMMMMMMZZRRRRRRRUUUUUUXUXUUUUUUUEEEEEEEEEEEKKKKKKKKGUUUUDDLLLLLLLULLULLJJJJJJJJJJJCCCCEEEEEEEEEESSBBBBSSSSSSSSSWWWWWWPWMMMRRRRRRRRRIIIII +MMMMMMMMMMNRRRERRRRRUUUUXUXUXUUUUUUUUEEEEEEEEEEKKKKKKKKGUUUUUUGLAULLUUUUULLJJJJJJJJJJCCCVCCEEEEEEEEEEEBBBBBSSSSSSSSWWWWPPPPMMMRRRRRRRRRIIIII +MMMMMMMMMMMRRRRRRRRRRRUUXXXXXXXXUUUGEEEEEEEEELLKOLKKKKKGGUUUUGGUUULUUUULLLLJJJJJJJJJCCCVVCCEEEEEEEBBECBBBBBSSSSSSSSSWWPPPPPPMMRRRRRRRRIIIIII +MMMMMMMMMMMRJRRRRRRRRRUUXXXXXXXUUGGGEEEEEEELLLLLLLKTTQKGGGUUGGGGUUMUUUULLJJJJJJJJJGJJJJVVVVEEEIEEBBBBBBBBBBBSSSSSSSWWPPPPPPPMRRRRRRRIIIIIIII +MMMMMMMMMMMRRRRRRRRRRRRRXXXXXXXUGGGGGEEEEEEELLLLLL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RRRRRLLLLLLAAAGGQQQQQQQQQQQQTTTTTTTTTTTTTTTTTHHHHHHHAAAAAAAARAARAARRROFRRFFFFHHHHHHHCWCVVVVVRRRRRRRRRRRRRRVVVVVVVVVVVVVVFVVVVAAA +TTTTBBBBBBBRZRRLLLLLLLLAGGGGGGQQQQQQQQQQTTTTTTTTTTTTTTTTTHHHHPHHAAAAAAAAAAAAAAAARFFFFFFFFFHLHHHHWWCVVVVVRRRRRRRRRRERRRVVVVVVVVVVVVVVVVVVVAAA diff --git a/src/AdventOfCode.Site/scripts/ts/puzzles/2024/Day12.ts b/src/AdventOfCode.Site/scripts/ts/puzzles/2024/Day12.ts index 36f606eb1..2751ea85e 100644 --- a/src/AdventOfCode.Site/scripts/ts/puzzles/2024/Day12.ts +++ b/src/AdventOfCode.Site/scripts/ts/puzzles/2024/Day12.ts @@ -12,7 +12,7 @@ export class Day12 extends Puzzle2024 { } override get name() { - return ''; + return 'Garden Groups'; } override get day() { diff --git a/src/AdventOfCode/PathFinding.cs b/src/AdventOfCode/PathFinding.cs index c7d630532..4b6d570aa 100644 --- a/src/AdventOfCode/PathFinding.cs +++ b/src/AdventOfCode/PathFinding.cs @@ -143,9 +143,9 @@ public static long AStar( /// The starting node. /// The to use. /// - /// An of the visited nodes. + /// An of the visited nodes. /// - public static IReadOnlySet BreadthFirst(IGraph graph, T start, CancellationToken cancellationToken) + public static HashSet BreadthFirst(IGraph graph, T start, CancellationToken cancellationToken) where T : notnull => BreadthFirst(graph.Neighbors, start, cancellationToken); @@ -157,9 +157,9 @@ public static IReadOnlySet BreadthFirst(IGraph graph, T start, Cancella /// The starting node. /// The to use. /// - /// An of the visited nodes. + /// A of the visited nodes. /// - public static IReadOnlySet BreadthFirst( + public static HashSet BreadthFirst( Func> neighbors, T start, CancellationToken cancellationToken) @@ -175,9 +175,9 @@ public static IReadOnlySet BreadthFirst( /// The equality comparer to use between nodes. /// The to use. /// - /// An of the visited nodes. + /// A of the visited nodes. /// - public static IReadOnlySet BreadthFirst( + public static HashSet BreadthFirst( Func> neighbors, T start, IEqualityComparer comparer, @@ -216,9 +216,9 @@ public static IReadOnlySet BreadthFirst( /// The starting node. /// The to use. /// - /// An of the visited nodes. + /// An of the visited nodes. /// - public static IReadOnlySet DepthFirst(IGraph graph, T start, CancellationToken cancellationToken) + public static HashSet DepthFirst(IGraph graph, T start, CancellationToken cancellationToken) where T : notnull => DepthFirst(graph.Neighbors, start, EqualityComparer.Default, cancellationToken); @@ -230,9 +230,9 @@ public static IReadOnlySet DepthFirst(IGraph graph, T start, Cancellati /// The starting node. /// The to use. /// - /// An of the visited nodes. + /// An of the visited nodes. /// - public static IReadOnlySet DepthFirst( + public static HashSet DepthFirst( Func> neighbors, T start, CancellationToken cancellationToken) @@ -248,9 +248,9 @@ public static IReadOnlySet DepthFirst( /// The equality comparer to use between nodes. /// The to use. /// - /// An of the visited nodes. + /// An of the visited nodes. /// - public static IReadOnlySet DepthFirst( + public static HashSet DepthFirst( Func> neighbors, T start, IEqualityComparer comparer, diff --git a/src/AdventOfCode/Puzzles/Y2024/Day12.cs b/src/AdventOfCode/Puzzles/Y2024/Day12.cs index 2dd0b8c43..1a300d81f 100644 --- a/src/AdventOfCode/Puzzles/Y2024/Day12.cs +++ b/src/AdventOfCode/Puzzles/Y2024/Day12.cs @@ -6,18 +6,93 @@ namespace MartinCostello.AdventOfCode.Puzzles.Y2024; /// /// A class representing the puzzle for https://adventofcode.com/2024/day/12. This class cannot be inherited. /// -[Puzzle(2024, 12, "", RequiresData = true, IsHidden = true)] +[Puzzle(2024, 12, "Garden Groups", RequiresData = true)] public sealed class Day12 : Puzzle { -#pragma warning disable IDE0022 -#pragma warning disable IDE0060 -#pragma warning disable SA1600 + /// + /// Gets the total price for the fencing without a bulk discount. + /// + public int TotalPriceWithoutDiscount { get; private set; } - public int Solution { get; private set; } + /// + /// Gets the total price for the fencing with a bulk discount. + /// + public int TotalPriceWithDiscount { get; private set; } - public static int Solve(IList values) + /// + /// Computes the price of adding fencing to separate the regions of the specified map. + /// + /// The map to compute the fencing price for. + /// Whether to compute the price for a bulk discount. + /// The to use. + /// + /// The total price for the fencing. + /// + public static int Compute(IList map, bool bulkDiscount, CancellationToken cancellationToken) { - return -1; + var bounds = new Rectangle(0, 0, map[0].Length, map.Count); + var regions = new List>(); + var unexplored = new HashSet(); + + for (int y = 0; y < map.Count; y++) + { + for (int x = 0; x < map[y].Length; x++) + { + unexplored.Add(new(x, y)); + } + } + + while (unexplored.Count > 0 && !cancellationToken.IsCancellationRequested) + { + var origin = unexplored.First(); + char plant = map[origin.Y][origin.X]; + + var garden = new Garden(plant, map, bounds); + + var region = PathFinding.BreadthFirst(garden, origin, cancellationToken); + regions.Add(region); + + unexplored.ExceptWith(region); + } + + cancellationToken.ThrowIfCancellationRequested(); + + int price = 0; + + foreach (var region in regions) + { + int factor = bulkDiscount ? Sides(region) : Perimeter(region); + price += region.Count * factor; + } + + return price; + + static int Perimeter(HashSet region) + { + int perimeter = 0; + + foreach (var point in region) + { + var direction = new Size(0, 1); + + for (int i = 0; i < 4; i++) + { + if (!region.Contains(point + direction)) + { + perimeter++; + } + + direction = Right(direction); + } + } + + return perimeter; + } + + static int Sides(HashSet region) + => Perimeter(region); // TODO Walk all the borders of the region and count the number of turns + + static Size Right(Size direction) => new(-direction.Height, direction.Width); } /// @@ -27,13 +102,20 @@ protected override async Task SolveCoreAsync(string[] args, Cancel var values = await ReadResourceAsLinesAsync(cancellationToken); - Solution = Solve(values); + TotalPriceWithoutDiscount = Compute(values, bulkDiscount: false, cancellationToken); + TotalPriceWithDiscount = Compute(values, bulkDiscount: true, cancellationToken); if (Verbose) { - Logger.WriteLine("{0}", Solution); + Logger.WriteLine("The total price of fencing all regions of the map is {0} with no discount.", TotalPriceWithoutDiscount); + Logger.WriteLine("The total price of fencing all regions of the map is {0} with a bulk discount.", TotalPriceWithDiscount); } - return PuzzleResult.Create(Solution); + return PuzzleResult.Create(TotalPriceWithoutDiscount, TotalPriceWithDiscount); + } + + private sealed class Garden(char plant, IList plants, Rectangle bounds) : SquareGrid(bounds) + { + public override bool IsPassable(Point id) => plants[id.Y][id.X] == plant; } } diff --git a/tests/AdventOfCode.Tests/Api/ApiTests.cs b/tests/AdventOfCode.Tests/Api/ApiTests.cs index 083cf188c..7f5b3b12c 100644 --- a/tests/AdventOfCode.Tests/Api/ApiTests.cs +++ b/tests/AdventOfCode.Tests/Api/ApiTests.cs @@ -216,7 +216,7 @@ public class ApiTests(HttpServerFixture fixture, ITestOutputHelper outputHelper) [PuzzleData(2024, 09, -1, Skip = "Not implemented.")] [PuzzleData(2024, 10, 778, 1925)] [PuzzleData(2024, 11, 220722, 261952051690787)] - [PuzzleData(2024, 12, -1, Skip = "Not implemented.")] + [PuzzleData(2024, 12, 1465112)] [PuzzleData(2024, 13, -1, Skip = "Not implemented.")] [PuzzleData(2024, 14, -1, Skip = "Not implemented.")] [PuzzleData(2024, 15, -1, Skip = "Not implemented.")] diff --git a/tests/AdventOfCode.Tests/Puzzles/Y2024/Day12Tests.cs b/tests/AdventOfCode.Tests/Puzzles/Y2024/Day12Tests.cs index a381018fb..bfa663892 100644 --- a/tests/AdventOfCode.Tests/Puzzles/Y2024/Day12Tests.cs +++ b/tests/AdventOfCode.Tests/Puzzles/Y2024/Day12Tests.cs @@ -5,23 +5,93 @@ namespace MartinCostello.AdventOfCode.Puzzles.Y2024; public sealed class Day12Tests(ITestOutputHelper outputHelper) : PuzzleTest(outputHelper) { - [Fact(Skip = "Not implemented.")] - public void Y2024_Day12_Solve_Returns_Correct_Value() + public static TheoryData Examples() + { + return new() + { + { + new[] + { + "OOOOO", + "OXOXO", + "OOOOO", + "OXOXO", + "OOOOO", + }, + false, + 772 + }, + { + new[] + { + "RRRRIICCFF", + "RRRRIICCCF", + "VVRRRCCFFF", + "VVRCCCJFFF", + "VVVVCJJCFE", + "VVIVCCJJEE", + "VVIIICJJEE", + "MIIIIIJJEE", + "MIIISIJEEE", + "MMMISSJEEE", + }, + false, + 1930 + }, + { + new[] + { + "AAAA", + "BBCD", + "BBCC", + "EEEC", + }, + true, + 80 + }, + { + new[] + { + "EEEEE", + "EXXXX", + "EEEEE", + "EXXXX", + "EEEEE", + }, + true, + 236 + }, + { + new[] + { + "AAAAAA", + "AAABBA", + "AAABBA", + "ABBAAA", + "ABBAAA", + "AAAAAA", + }, + true, + 368 + }, + }; + } + + [Theory] + [MemberData(nameof(Examples))] + public void Y2024_Day12_Compute_Returns_Correct_Value(string[] values, bool bulkDiscount, int expected) { // Arrange - string[] values = - [ - "_", - ]; + using var cts = Timeout(); // Act - int actual = Day12.Solve(values); + int actual = Day12.Compute(values, bulkDiscount, cts.Token); // Assert - actual.ShouldBe(-1); + actual.ShouldBe(expected); } - [Fact(Skip = "Not implemented.")] + [Fact] public async Task Y2024_Day12_Solve_Returns_Correct_Solution() { // Act @@ -29,6 +99,7 @@ public async Task Y2024_Day12_Solve_Returns_Correct_Solution() // Assert puzzle.ShouldNotBeNull(); - puzzle.Solution.ShouldBe(-1); + puzzle.TotalPriceWithoutDiscount.ShouldBe(1465112); + puzzle.TotalPriceWithDiscount.ShouldBe(-1); } }