mirror of
https://github.com/jcreek/advent-of-code.git
synced 2026-07-12 18:53:47 +00:00
feat(2025-04): Add day 4
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,131 @@
|
||||
using System.Text;
|
||||
|
||||
namespace AOC.Helpers;
|
||||
|
||||
public static class TwoDimensionalArrays
|
||||
{
|
||||
public static char[,] Make2DArrayFromStringArray(string[] stringArray)
|
||||
{
|
||||
int rows = stringArray.Length;
|
||||
int cols = stringArray[0].Length;
|
||||
|
||||
char[,] array = new char[rows, cols];
|
||||
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
for (int c = 0; c < cols; c++)
|
||||
{
|
||||
array[r, c] = stringArray[r][c];
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
public static string TwoDimensionalArrayToString(char[,] array)
|
||||
{
|
||||
int rows = array.GetLength(0);
|
||||
int cols = array.GetLength(1);
|
||||
|
||||
StringBuilder sb = new(rows * (cols + 1)); // performance optimisation
|
||||
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
for (int c = 0; c < cols; c++)
|
||||
{
|
||||
sb.Append(array[r, c]);
|
||||
}
|
||||
|
||||
sb.AppendLine(); // end of row
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates all cells in a 2D array, returning each cell's row index,
|
||||
/// column index, and value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The element type of the 2D array.</typeparam>
|
||||
/// <param name="grid">The 2D array to enumerate.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="IEnumerable{T}" /> of tuples containing the row index,
|
||||
/// column index, and value of each cell in the array, iterated in row-major order.
|
||||
/// </returns>
|
||||
/// <example>
|
||||
/// The following example prints every cell in a character grid:
|
||||
/// <code>
|
||||
/// char[,] grid = {
|
||||
/// { 'A', 'B', 'C' },
|
||||
/// { 'D', 'E', 'F' }
|
||||
/// };
|
||||
///
|
||||
/// foreach (var (row, column, value) in Cells(grid))
|
||||
/// {
|
||||
/// Console.WriteLine($"[{row}, {column}] = {value}");
|
||||
/// }
|
||||
/// </code>
|
||||
/// This produces:
|
||||
/// <code>
|
||||
/// [0, 0] = A
|
||||
/// [0, 1] = B
|
||||
/// [0, 2] = C
|
||||
/// [1, 0] = D
|
||||
/// [1, 1] = E
|
||||
/// [1, 2] = F
|
||||
/// </code>
|
||||
/// </example>
|
||||
public static IEnumerable<(int row, int column, T value)> Cells<T>(T[,] grid)
|
||||
{
|
||||
int rows = grid.GetLength(0);
|
||||
int cols = grid.GetLength(1);
|
||||
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
for (int c = 0; c < cols; c++)
|
||||
{
|
||||
yield return (r, c, grid[r, c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<(int row, int column)> CheckAllSurroundingCellsForCharacter(
|
||||
char[,] array,
|
||||
int startRow,
|
||||
int startColumn,
|
||||
char characterToCheckFor)
|
||||
{
|
||||
int totalRows = array.GetLength(0);
|
||||
int totalColumns = array.GetLength(1);
|
||||
|
||||
List<(int row, int column)> results = new();
|
||||
|
||||
for (int rowOffset = -1; rowOffset <= 1; rowOffset++)
|
||||
{
|
||||
for (int colOffset = -1; colOffset <= 1; colOffset++)
|
||||
{
|
||||
// Skip the centre cell
|
||||
if (rowOffset == 0 && colOffset == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int row = startRow + rowOffset;
|
||||
int column = startColumn + colOffset;
|
||||
|
||||
// Bounds check
|
||||
if (row < 0 || row >= totalRows || column < 0 || column >= totalColumns)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (array[row, column] == characterToCheckFor)
|
||||
{
|
||||
results.Add((row, column));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AOC.Utilities\AOC.Utilities.csproj"/>
|
||||
<ProjectReference Include="..\AOC.Helpers\AOC.Helpers.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
..@..@..@..@..@@..@@@@@@.@.@@@@.@.@@@..@.@@@.@@@.@@@.@@@.@.@.@@..@@@@@@@@@@.@@@..@@.@@@@..@@.@.@@..@@@@@@@@...@.@@.@@.@@@@.@@.@@......@@.@@
|
||||
@@@@@@@@@@@..@.@@@@.@...@@.@@@.@@@@@@@@.@.@@...@@..@@..@@..@.@..@.@.@@..@.@@@@@@@@@@@.@@@@@@.@@.....@@@@..@@.@..@@@@@@@@.@.@.@@@...@@@.@@@@
|
||||
.@@@.@@..@@@@.@.@..@@.....@....@@@@.@@@.@...@.@@.@.@@@@@@@@@@@@@@..@@@@@.@@@.@.@@...@@.@@.@@@@@..@..@@@@@@..@@@@...@@@.@.@@..@.@@@@.@.@@.@@
|
||||
@...@@@.@@.@@@.@@@@.@@@.@@.@@@@@@@@@@@@@@.@@@..@@@@.@@@..@@@.@.@@.@.@.@@@..@@@@@@.@.@.@.@.@@@@@@@@@@@.@@@@.@...@@@@@@@@@@@.@@...@@@@@@@@...
|
||||
@@@@.@.@@@.@..@.@@@@@@@@@@@@@@.@..@@@..@@@.@.@.@@@...@@@@@..@.@.@.@@@..@.@@...@..@.@....@@@@@.@..@@@.@@@@@@@@.@@.@@@.@..@.@@@@@@@@.@@.@@@..
|
||||
@.@@.@@@@@@@@@@.@..@...@@@.@@@@@@.@.@@@@@.@@@.@@@...@..@.@.@.@@@@.@@.@.@@@@@@@..@@...@@@@@@@.@.@@@@.@@.@@..@@.@..@@.@@@.@@@@@.@@@..@@.@..@@
|
||||
@.@@@...@.@@@@@..@@@@@@..@.....@@.@.@@@@...@@@.@@@.@@@@.@@@@@@@@@..@@@@@@..@@@@@..@@@@.@@@@@..@@.@...@..@@@..@@@.@@@.@@@.@.@..@@@.@@@@@@@.@
|
||||
@@@@...@@.@@.@@@@@@....@@@@.@@.@@@@.@@.@@..@@@@@@.@.@@@.@..@@@@@@.@@@..@@@@@.@@@@..@..@.@@@.@@@..@@@.@@@@.@@@.@.....@@..@@@@.@..@.@@@@@@.@@
|
||||
.......@@@@@@.@@@.@@@@@..@@.@@.@@.@@.@@@@.@@@@@..@@.@@@.@@.@.@@@.@@@@@.@@@.@@@..@.@.@@@@@@@.@@@.@@@@@@@.@@@@@@@.@@..@@@.@@.@@@.@@@@.@@@.@@@
|
||||
..@..@.@@.@.@@@.@..@...@@@.@@@@@@.@@@.@@..@.@@.@@.@@@@@.@@@...@@@@@@@@@..@@@@.@.@.@...@@@@@@@..@@@.@@@@@@@.@@@@.@@@@.@@@@..@..@@.@.@.@@.@..
|
||||
.@@@.@@@@@@@@@@@...@.@..@@@@@.@@@@@@@@@@@@.@.@@@..@@@@.@@@@.@.@@.@....@@@.@@..@@.@@..@@@...@@@.@@..@@.@@.@@.@@@@.@.@@.@@@.@@.@@..@.@..@...@
|
||||
@@.@@@@@@@@@.@..@@.@..@@@@.@@.@@.@@...@.@......@@@@@@.@.@.@@@@@@@@..@...@.@@@.@@.@...@@..@.@@..@@.@.@.@@@.@..@@.@@.@@...@@...@.@@.@@@.@@@@@
|
||||
@@@.@.@@@@@@.@@@@@@.@@@@.@..@..@@.@.@@@@.@@..@...@@@@@.@@@@@.@.....@...@@@@@.@@@.@@@.....@...@@@@.@.@@.@@.@@..@@.@@..@.@.@.@@@@@@@@...@@@.@
|
||||
@..@@@@@@.@@@@@@@.@@@@@.@...@@@.@@.@.@@.@.@@@.@@.@.@@.@.@@..@@@@.@.....@@@.@.@@.@@..@@@@.@@@@@@@@@@@@.@.@.@..@@.@@@@.@@.@..@@.@@@@.@@@@.@.@
|
||||
.@@@.@....@@.@@...@@..@@.@@@@@@.@@.@..@.@.......@.@@@@@.@.@@@@.@@...@@..@@@..@.@@@.@..@.@@@@@@..@@.@@@@@@@@@.@@..@@@.@@@@@..@@.@@..@.@@@@..
|
||||
@@@@@....@.@.@.@@@@..@@@..@.@@@@.@.@@@@@@@@@...@@..@...@@@@@@@@.@.@@.@@.@@@@@@@.@.@@@@@@@@@@@.@..@@@@@.@.@@@.@@@@..@@..@..@@@@@.@@@@@...@@.
|
||||
@..@@@.@@.@...@.@.@@@@@.@@....@@.@@@@..@...@.@@.@@@..@@.@@.@@@.@@@.@.@.@@@@@.@@@@@@@@.@@@@@@.@@.@..@@@@@@...@@@.@@@.@@@@.@.@.@@..@@@@@@..@.
|
||||
@@@@@@@@@@@..@@.@...@.@@@@@@@.@.@.@@....@@@@.@.@@..@@..@@.@@@..@.@@@.@@.@.@@@@@.@@.@@@.@.@@.@.@@@@@.@@@...@@...@@.@@@.@.@@@.@.@@.@@.@.@@@.@
|
||||
@.@@@@@..@@@@@@@@.@..@.@.@@@.@..@@.@@.@@@.@....@...@@@..@.@.@.@.@@@..@@@@.@.@@@@@@.@@.@..@@.@@@..@@.@.@@.@.@@@@.@@@@@@.@@....@.@@.@@@@.@@.@
|
||||
@..@.@.@@@@@@@.@@@@@@@..@@@@.@@....@..@...@...@@.@@..@@@.@@@@..@@@@@@.@@@..@@@@@@@@@.@@@..@@@@@@@@@@@@@@@.@@@.@@.@@@@@@@..@@.@@...@@.@@.@.@
|
||||
.@@.@..@@@@...@@..@@@@@..@@@@@@@.@...@@@...@@@....@..@@.@@@@@@....@@@@..@@.@.@@..@@@.@@@.@@@.@..@@..@.@@.@.@@@@.@.@.@@@@.@@.@....@..@@@.@@.
|
||||
.@@@@@@.@@..@...@.@@.@@@@@@@@@@..@@@.@..@.@..@@.@.@@.@@@@..@@@@@@@....@@.@@.@@.@@@@.@.@.@@@@@@@@..@@.@@@.@@.@@@@..@@.@@.......@@@@@@..@@.@.
|
||||
.@.@@@.@.@@@@@@@.@@@@@@@@@@@@..@@@@@..@.@@@@@@..@@.@.@.@@.@.@.@.@@@...@@.@@@@.@@.@.@@..@.@@@..@@@.@..@.@.@.@@@.@.@@@..@@..@@..@@@..@@@..@..
|
||||
@@@@@..@@@.@@@@@@@@.@....@.@@.@@@@..@..@.@.@@@..@.@@@@@.@..@.@@@..@.@@@.@@.@.@@@.@..@@...@@@@@...@@@@@@.@@@@@@@.@@@@@@.@@.@@@@.@...@@..@@.@
|
||||
@@.@.@@...@@@@@@@....@.@.@@.@@.@.@@@..@.@@@.@@.@...@@@.@..@@@@@@@@@@...@.@.@.@@@@..@@.@@.@@@@@@@@@.....@.@@@..@@@@.@@..@@..@.@...@.@@@.@.@@
|
||||
@@@@@.@@@@@@.@@...@@@@@.@@@@@.@@...@.@@@@@@@.@..@@@.@.@.@@@@@...@..@..@.@.@.@@@..@.@@@@@..@@.@@.@..@@.@.@..@.@@@@@@@@@.@.@@@@..@@@@@@@@@..@
|
||||
.@@.@@@@@@@@@@@@@@@@...@.@@@@.@@@@@@@@...@@@@@.@.@.@@@@.@@.@.@@@@....@@@@@...@@@.@@@.@@.@@@.@@.@@@@@@.@@@@@.@@..@@@..@@@@@@@..@@@@.@..@...@
|
||||
@@.@@@@@@@.@.@@@@@@@.@@.@...@.@.@@@..@.@@..@@@@@@@@....@.@...@.@@@@@@.@@@..@.@@.@@@.@@@.@@@.@@@@@@@@.@@.@@@@@@@@@..@...@@@.@@@@@@@@@@@@@@@@
|
||||
@@.@@@.@@@.@@.@@.@..@.@.@@@.@..@.@@@@@@.@@@@@@..@@.@@@.@@@@@@@.@@@.@.@..@..@.@@....@@.@.@@@...@@..@@..@..@@@@@@@@.@.@@@@@....@...@.@@.@@@@@
|
||||
.@..@.@@@@@@@@.@.@@@@..@@@@.@@.@@@.@@@@@..@@@.@@..@@@@...@..@@@@.@@.@..@..@@@.@.@...@.@@.@@@@@..@@@@@@.@@.@@.@.@@.@@@.....@...@...@@.@@@@.@
|
||||
@...@@.@@.@@@@@@@@@@@@.@.@@@....@@@@..@...@@@@..@@.@@@@.@.@@@@@@.@.@.@..@.@.@.@@@...@.@@.@@@@@..@@@..@@.@.@@.@@@.@...@.@@.@@@@@@...@@..@@@@
|
||||
@.@@.@..@...@..@@@@.@@@@@@@@@.@....@.@.@@.@@@@.@@@@@@.@@.....@@@@@@@@@...@@......@@@.@@@.@.@@.@@@@@..@@@@@.@@@@..@@.@.@.@...@@..@...@..@@@@
|
||||
@@.@.@@.@@@@@.@@@.@@@@@.@@.@.@@..@..@.@@@@.@.@....@..@@..@@@@.@@@@.@@@@@.@.@@@@...@@@..@@@..@@@@@@..@@@.@@@.@.@@@.@.@@@@@@...@.@.@@@@@@..@.
|
||||
.@.@@@.@.@.@@...@@@@@@@@@..@.@@.@@@..@@@@@.@.@@@.@...@..@...@..@@@.@..@@@@@@..@@.@@@.@@@@@@@@@.@@@@@@@@@..@@@@@...@@.@.@@.@@.@.@@@..@..@.@@
|
||||
@@@@..@@.@.....@@@@@@.@@@@...@.@@@@@@...@@@.@@..@.@@...@@@@@@@@@@.@..@@.@@@@.@@.@@@.@@@@@@.@.@.@@..@@@.@.@@.@@@@@@@@.@@@..@@@@@@@.@@.@@.@@@
|
||||
@@..@@@@..@@.@@@..@@.@@.@@@@@...@@.@..@@@@..@@.@@@.@..@@.@@.@..@@@.@@@@@.@@.@.@@@@@.@@.@@..@@@@..@@..@@@@@.@@@@@@@@@@.......@.@@@@@@..@@@@.
|
||||
@.@@@@.@@@@@.@@@@.@@.@@@@..@.@..@@@@@@@@.@@.@@.@@@.@@@@@.@@@.@@@@..@.@.@@@@..@.@...@.@.@@@@@@@.@...@@.@@@..@@.@@..@.@@@@@@.@..@@@@@@.@@@@.@
|
||||
.@@@..@@@@.@@.@...@...@.@@@....@...@.@@@@@@@@@.@@.....@@..@@@@@@..@@.@...@@.@@....@@@@.@@@.@.@.@@.@@@@@@@@.@.@@@@@.@@@.@@@.@@.@@@@..@@@@@.@
|
||||
@.......@.@@@@@@..@@@@@@.@@@@.@.@@@@..@.@@@@@@@.@@@.@@@@@.@.@@@@@..@@@@.@.@@.@@.@@@@@.@@@.@.@.@.@.@@@.@.@.@@..@.@@@..@@@@..@@@@.@.@@@..@...
|
||||
@.@@@@@@@..@@..@@@@@@.@.@@..@.@...@@...@.@...@@@..@..@@@.@..@@@@@.@@@@@@@..@@@@@@@..@@.@@@..@..@.@@@@@..@@@.@@@@@..@@@@@@@@.@@.@@....@@..@@
|
||||
...@@@@@@@.@.@..@@@@@@..@@@@@.@.@@@.@@.@@@@@@@@@..@@@.@@@.@@...@@@@@@@@.@@@..@@.@.@.@@@..@@@.@.@.@@.@...@.@@@@@@@@..@@@..@@@@@@.@@@@@@...@@
|
||||
@..@.@@@.@....@@@@..@@..@.@@.@@.@...@@..@@@@..@@@.@@..@..@.@@@@@@@.@.@@....@@...@@@.@.@@@.@@@@@@@@.@@@..@.@@@.@@@@.@@@@@.@@@@@..@@..@@@@@@@
|
||||
.@@.@@@@@@@@@@.@@@.@@..@@@@@@@@@..@@@..@@@@...@@@.@@@@@@@..@@@@@@.@@@.@@@....@@@@.@@@@...@..@@.@@.@@@@@@@@..@.@@@@@@@@@@@@.....@.@@.@@@..@.
|
||||
@@@@@@..@.@@.@.@.@.@...@..@@@@.@.@.@@@..@@@@@@@@@@@.@@@@@@@@@..@.@.@@@.@@.@@.....@@..@@@..@.@.@@..@@@@@.@@@..@@@@@@.@@....@@.@@.@@.@@.@...@
|
||||
@.@@..@.@@@@@@@@@..@@@@.@@@@@.@@.@@@..@.@@...@...@@@@@@.@@@@@@@@@.@..@@@@.@@@@...@@@@@@@@.@.@@..@@@@.@@@@@@.@.@@@..@@..@.@@@@@.@@@@.@@@@@@@
|
||||
@.@@.@..@.@..@@@.@..@@@..@.@@@@@.@@.@.@.@@@.@...@@@@.@@@@@@@...@@@.@...@.@@@@@@@@@.@.@@@@@@@.@..@@.@@@@.@.@@..@@@@@@@.@.@@@@@......@@@@@@@.
|
||||
@@@@@..@.@@@.@@.@..@.@..@@.@@@.....@.@@..@@.@@@@@@@@@@@@.@......@@@@..@.@@@@.@..@.@..@@@@@@.@@.@@@@.@@.@.@@..@@@@..@@@@@@@.@@..@.@@@.@@@...
|
||||
..@.@..@@@@.@..@.@@@@@..@@@@@@@@@@@@.@.@.@@.@@@...@@@..@@...@@@@@..@.@@@@@@@@..@.@..@@@@@@@.@@@.@@..@.@@@.@....@@@@@@@.@@@@@..@@..@@@@@.@@.
|
||||
..@..@..@.@@@@.@..@@@@.@.@@.@.@@@@....@@.@@.@.@@.@@@.@@....@@@..@.@@.@@.@..@@@@.@@@@@@.@..@....@..@@@@@@@.@..@..@@@.@.@@..@@@@@..@..@.@...@
|
||||
@@@.@@@@@@@@@@..@....@.@@..@@@.@..@@@.@@@@@.@.@@.@@@.@.@@@..@@.@@@@..@@@@..@@@.@@..@@@@@@@.@@.@@@@@.@@@@@@@@....@.@@.@.@.@@@....@@@@@@@.@@.
|
||||
@@@.@@@@@@@@.@@@@@.@.@.@@.@@@@@@@@@@@@@...@@@.@@...@@..@..@@..@@.@@..@.@@@@@.@@@@@@.....@.@@.@........@@@@@.@.@@@@@@@@@@.@@@...@..@@...@..@
|
||||
@@...@@@.@...@@..@.@.@@.@.@...@@.@@...@@@@.@@@@.@..@..@.@.@..@@.@@@@@.@@.@.@.@@..@.@@@@.@.@..@@@@@..@..@.@@.@@@@@@...@@@@@@...@@..@@@.@.@@.
|
||||
@@@@@@@@@....@..@@@..@@..@@.@@.@@@.@.@.@@@@@@@@@.@..@@@@..@.@@....@.@@@.@@@.@..@@@@@..@@@.@@@@....@@.@@.@.@@@.@@.@@@@.@..@.@@..@@@@@@..@@@@
|
||||
.@.@.@.@..@.@@...@@@.@@@.@@@@@@@@@@@..@@@@@.@@@@.@@@@.@.@..@@.@@@@.@.@.@....@..@@@.@..@@.@@.@@.@@.@@.@@@.@.@@.@@.@@..@@@....@@.@.@@@@.@.@@.
|
||||
@..@..@..@@@@@..@@.@..@@...@.@@.@.@@.@@@@@.@@@@@.@.@.@@@..@@.@..@@@..@@@@.@@@.@@.@@@@.@...@@@@@@..@@@..@..@@@.@@..@@..@@@@@@@@@.@@.@@@@@@..
|
||||
@@@@.@@.@@@@@@@...@@@@@@@.@.@@.@@@.@@@.@@.@@@@...@@@@@@@.@.@@.@.@.@@@@@@.@@@@.@..@@@@@@.@@.@@@@@...@.@@@.@@.@@@@@@.@.@@.@@.@@@@@@@.@@@@@.@@
|
||||
@@@@@@@....@@.@@@@@.@@@.@@..@..@.@.@@..@.@@@@..@@@@...@.@@@.@.@.@.@@@..@..@.@@.@@@@@@..@@@@@@@@@@.@@.@@@..@@@.@@.@@@@@@@@@@@@@@.@@@.@@.@@@@
|
||||
@@@@@@.@..@..@@@.@.@.@@@..@@@.@@@@@..@@@@.@..@.@@.@.@@@@@..@@@.........@..@..@@@..@@@.@@@.@@@.@.@@..@.@.@@@@@@.@..@@@.@.@....@@@..@...@..@@
|
||||
@@@@..@.@@@@@@.@.@@@@@@.@@@@@@@.@@..@@.@.@@.@@....@@@@@..@@@@@@@.@.@@@@@.@@.@@@.@@@@.@@@.@@.@.@@@.@.@@.@@...@@@@.@..@.@@@.@.@...@@@@@..@@@@
|
||||
@@.@@@@@@@..@@@@.@@@@@@.@@@.@@@@.@.@.@.@@..@@@@@.@@@@@@@.@@.@.@@@..@..@.@@@@@@@@@@.@..@.@.@@@@@@.@@@@.@@@.@..@@@@@..@@@.@@@@...@@.@..@.@.@@
|
||||
@@.@@..@@.@.@@@@@@..@@.@.@@@.@@@@@@..@@@@..@@@@.@@@@@@.@@@@.@@......@@@@@.@@.@.@@.@.@@.@.@....@.@@@@@@@@@@@@@@@@@@@.@.@@.@@..@@@...@.@...@@
|
||||
@.@@.@.@.@.@.@@....@@@@@@@@...@.@.@@@@..@.@@.@@@@@.@@@..@@@@@@@....@@.@@@@@@@.@@@.@@.@@.@@.@@@@@@@.@@@@.@@@.@@@@...@@@@@.@.@.@.@@.@@@.@@@..
|
||||
..@@@...@@.@@@...@@.@@.@@.@@..@@.@@@@@@.@@@@@@@@.@@@@@@@.@@@@@@@@@@@@@@@@@@@.@@@.@..@..@@@.@@.@@@@@@.@..@@@@.@@@@@..@@@...@.@@@.@@.@.@.@..@
|
||||
@.@@@....@@@@@@@.@@.@@.@.@@..@.@@@@.@@@@@@@@@@@@@@@.@@..@@.@@@@@.@....@@@@.@@@@@@@@@.@@@@@@@@@..@.@@..@.@.@.@..@@..@@@@@..@.@.@@@@@@.@@@@@.
|
||||
@..@@.@@@@@@@..@@@.@@.@@@.@.@@@.@@@@@@@@@@@@...@...@@@@@@.@....@..@.@@@@@@.@..@@@@@@@@...@..@@.@@@..@@@.@.@.@@@@...@@@.@@@...@@..@...@.@@@@
|
||||
.@@..@..@@.@@@.@.@.@.@@.@@@.@@.@@@..@..@@.@@@.@.@@@@@.@@.@@@@@@.@@.@.@@..@.@.@.@@...@@@.@@.@.@.@.@@@@.@@@@@@@..@@@@@@@.@@@@@@..@.@@..@@.@@@
|
||||
...@..@@@@@@.@@@..@@@@.@@.@@@...@@@@@.@@@@...@@@@@@@@@@@.@..@@@@@.@@@@@@@@@@@@.@@.@@@..@@.@@@@@.@..@@.@.@@@@@@.@.@@@@@@@@.@@@@.@..@..@..@..
|
||||
.@.@.@..@.@.@@@@@@@@@@@@.@@.@@@@...@@@.@.@@@..@@@.@@@@...@@@@@.@....@@@@..@@@.@.@@..@@...@@@@@.@@.@@.@@@@.@.@@@@.@@.@@...@@@.@@@@.@.@@@@.@@
|
||||
@.@..@.@.@..@..@@@..@.@@@@.@@@.@@@.@@.@@.@@@.@.@@@@@..@@@@.@@@@.@@@@@@@.@@@@@@.@@@..@@.@..@.@@@.@@...@.@@@.@.@..@....@@@.@@@@.@@@@.@@@@.@@@
|
||||
@@@@@.@.@@@@.@@@@@@@@@@@@@@@@@@..@.@@....@@....@@@@.@@.@@@@@.@.@@@@...@@@@@@.@@..@@.@.@.@@@...@@@@@@..@@.@@.@@.@@.@@@@@@@@@.@@@.@.@@.@@@@@@
|
||||
@@@.@....@@@@....@@.@..@.@.@.@@@....@@@.@@@.@@@@@@@@.@@@.@@.@.@@@.@@@@.@@@.@.@.@.@.@@.@.@..@.@.@@@@@@...@.@.@..@.@.@@@@@@@.@.@.@@@@@....@.@
|
||||
@@@@...@.@..@..@..@.@@..@.@.@@@.@.@.@@@@.@.@..@...@@..@@@@.@@@.@...@@@@.@@@@.@.@.@.@@@@.@@@@@.@@.@@@@@@.@...@@.@@.@@@@.@.@@@@@@.@.@@@@..@.@
|
||||
@.@.@...@..@@.@@..@@.@@@@@.@@@@@@@@@@@.@...@.@@@@.@@@.@...@@@@.@@@@@..@@.@.@@@@@...@.@.@@@@@@@@@@@@@@@@.@@@@..@.@....@.@..@@@@@.@@@.@@.@.@@
|
||||
.@@..@.@.@@@..@@@@@@.@..@@@@@.@.@..@.@@@..@@@@@@@@.@.@@@@@.@@@.@@@@@@@@@@.@@.@@@.@@@@@@@@.@...@@@@@.@.@...@@@@@@.@@@.@.@..@.@@@@@@.@@.@@.@.
|
||||
@@..@@.@@@@@@@.@@@@.@@@@..@@@..@@.@..@@@.@...@@...@@.@@@@.@@@@.@@@@.@@.@@@.@.@.@@..@@@..@..@@@.@@.@.@@@.@..@@.@@.@@@@@@..@..@@@.@@.@@@....@
|
||||
@.@.@....@.@...@@@@@@.@@.@@@@.@.@.@@@@...@@@@@@.@@.@@.@@@@.@@.@@@@@@@@@.@@..@.@.@.@@@.@@@@.....@@..@@@@@.@@@..@.@@@@@@@.@.@@@.@.@@@....@@@.
|
||||
@@..@..@@.@@.@@@@@....@@.@@.@@@.@@@.@...@@.@.@@.@.@.@.@..@.@@@@@..@.@.@..@@@@@@@@.@.@@@@@.@@@@@@..@.@..@....@.@@@@.@@@.@.@@@@.@@.@@.@@@@@@.
|
||||
.@@@@@@.@@.@.@@@@@..@@.@@@..@@@@@@..@.@...@.@.@@@@.@@@@.@@.@@@@@@@@@..@..@@@@@@@@.@@.@@@..@.@.@@@@@.@.@.@@@.@@..@@.@@@@@.@@@.@@@.@@@.@..@@@
|
||||
@@.@.@@@.@.@...@@@@@@@@...@@@@@@@@@.@@@@@.@@@.@@@@@..@@@..@@@.@@..@@@.@.@@@.@.@.@.@@@@@@.@@@@@.@@@@..@.@@@@@.@..@.@.@@@.@.@@@@@@@.@@.@@@@.@
|
||||
.@@.@.@@@.@@@@@@@@.@.@...@.@@@@@@@@@@@@@.@.@.@@@@@@@.@@@@.@@.@@@.@@@@@@@@@@@@@@.@.@@@@...@.@.@..@@.@..@...@.@@.@@@@@@@..@@@@.@@@@@.@@..@@@@
|
||||
..@@@@@@..@@.@.@.@@@@@..@@@@@.@@@@@.@@@@.@.@@@.@@.@@.@@@.@.@.@..@.@@...........@@@@@@@@..@@@..@@@.@.@@.@.@.@.@@@@@@@@@.@@@.@.@@.@@@..@@@.@@
|
||||
@@@...@@..@.@@@@@@@..@..@@.@.@@@@.@@@@.@@@...@..@@@@@@@.@@..@@@@@@..@...@@@@@@@.@@@@@@@@..@@.@@@@.@@..@.@.@@@@.@.@...@@.@@@..@@@@@@@..@.@@@
|
||||
@@.@@@@@@@.....@....@.@.@..@@@@.@.@@@@@.@.@@@..@.@.@@.@@.@@@@@.@@.@@.@@.@.@@@.@@@@@.@@@@@.@@@@@@..@@.@@.@@@@@.@..@@@@@@@@.@@@..@.@@@.@..@@@
|
||||
@.@...@.@.@..@@@.@@@@@.@@....@..@@@@@..@.@@.@.@@@@...@.@..@@@@@@@.@@@@.@@@.@@@@.@@@@@@@@.@..@.@@.@@.@@@@@..@@@@.@@@@@@..@.@.@@@@@.@.@.@@.@.
|
||||
@@.@@..@@@@@.@@..@.@..@@..@@@@@@@.@@@@@@.....@@..@@.@@.@.@@.@@@.@@@@.@@@@@@..@@@@.@@.@@@@@..@@.@.@@@@@@@@.@@..@@@@..@@..@@@@@@.@@@.@@.@@@@@
|
||||
@@..@@@@..@.@@@@..@...@@.@@@@@@@@..@.@.@@@@@..@@@@.@.@@@..@@@@@@@@@@@@@@..@.@.@@@@@.@.@@...@@@@@@.@@@@@.@@@@@.@@@.@@..@.@@@..@..@@.@@@@@@@@
|
||||
..@@@.@@@.@@@.@@.@@@.@@@@.@@@@...@.@.@.@.@.@@@@.@.@@@@@@@@@..@@.@@@@@@@@.@@@@.@.@.@@@.@@.@@@..@@..@@@@@@@@@@@@.@@...@..@.@@...@.@@.@.@.@@@.
|
||||
..@@..@@@.@@.@@@@.@@.@@@...@.@@@@@@@.@@.@@@@@@@..@..@@@@.@@.@@.@@..@@@..@@@@...@@@.@@.@@@@@@@@.@@..@..@@@@.@@@@@@.@@.@@@@@@@@@.@..@..@.@.@.
|
||||
.@..@@@@@@@.@.@@.@...@@@@@@@.@.@@@@@..@@..@@@@..@@@@@@@@@@@@@@.@..@@.@@@@@@.@.@@@@@.@@@@@.@@@@..@..@.@.@@..@@.@.@@..@.@@.@.@@@.@@@@@.@@..@@
|
||||
@.@@@@@.@.@@@.@..@..@@.@@@@@@@...@.@@@@@..@.@..@.@.@..@@@...@@.@...@@@@.@@@@.@@@...@..@@.@@@@@@@@@@@.@@..@@.@@@@@@.@@.@@@...@.@..@@@@.@.@@@
|
||||
@@@@@@@.@@@...@@.@@.@@@@.@.@@@@@@@@@@@.@@.@@..@@.@@@@@@...@@.@@@@..@@@@@@.@..@@...@@.@@@@@.@@@.@..@@@...@@..@@@.@@...@@....@@@@@@.@@@@.@@@.
|
||||
...@@...@@....@.@.@@..@.@@@@@@..@@@@@@@.@....@.@@..@@@@..@@..@@@@@.@@@.@@@.@@..@@@@.@@@....@..@@@.@.@..@@@.@@.@@@.....@.@@@..@@.@@@.@@...@@
|
||||
@@@.@@@@@.@@@.@@@.@@@@@@@....@@@@.@@...@@.@@..@@@.@@@@@..@@@@.@.@@@@..@..@...@@@@@@@@.@@@.@@....@@..@@..@@@...@@.@...@@@..@.@.@@@@.@.@@@@.@
|
||||
@.@..@@.@@.@@.@@@@.@@@@..@.@.@.@..@@@@.@.@@@@.@.@@..@.@....@@...@@@@@@.@@@@@@@@@.@@.@@@@.@@@..@.@@@@.@.@@@.@...@..@..@@@@@@.@@.@@@@.@@@@.@@
|
||||
@..@@@@.@.@@.@..@.@..@@@@..@@.@.@@@@@@@@@@@@@.@@@.@@@@@...@@@@@@@@@@.@@..@@.@@...@.@.@@@@@@@@.@.@..@@..@@..@..@@@@@@@@....@@@@.@@.@@.@@@@@@
|
||||
@@.@@@....@..@@@.@.@@@@@@@.@.@..@@@@.@@@@@@@.@@@...@@.....@.@@@@@@@@@..@.@@@..@@...@@@@.@@@..@..@@.@@@@.@@.....@..@@@@@.@@....@@@..@@@.@@.@
|
||||
@@@@.@@@@@@.@@.@@.@@@.@@@.@@@.@@@@...@.@.@@@@@@.@.@@@@@@@@@@.@.@.@...@@@@.@.@@@...@@..@@@.@@@@@@@....@@@@.@.@@@@@@@@@@@.@@@..@@@@@.@.@@@...
|
||||
@@@@@@@@@.@......@@@..@@@.@.@@@@..@@@.@@@.@@@.@@@@@@.@@@.@@@@.@.@@@@@..@@@....@.@@.@@@...@.@@.@@.@@@.@@@@@..@@@@@.@@@@.@@@@@@@@.@..@@...@.@
|
||||
.@.@..@@@@.@@.@@.@@@..@@@@@@@@@@@.@@@.@@.@..@.@@@@@.@@@@...@@@.@@@@@@......@.@@@..@@@...@@..@.@@@.@@@.@@@@...@.@.@.@..@..@@@..@@@.@.@@.@@@@
|
||||
@@@@.@@@.@@.@@.@@@.@.@.@@@.@...@@@.@.@@@@@..@@@@..@.@@....@@@@@@@@@..@@....@@@@.@@@@.@.@@@@@@@@.@@..@.@@...@.@@@.@..@@@@@@..@.@@@.@@@@@..@.
|
||||
@@@..@@@@@@.@@.@@@.@..@@@@..@@@@.@.@@@@@.@@@@@@@@.@@@.@..@.@@@@.@@@@@@@@@@@@@.@@@@@.@.....@@@..@..@@..@@..@.@@@..@.@.@@@@@.@@@.@..@@....@@.
|
||||
@@@@@...@....@@@@@.@@@@..@@@.@@@.@@.@@...@@.@@@@@@@@@@..@@@.@.@.@@@@@@@@@.@@.@@@@@.@@.@@.@.@@..@@@@@@@@..@@@@@..@@@@..@@@.@.@@.@@.@.@@.@@.@
|
||||
@@@@.@@@@@@@@.@@..@.@@@@.@@@.@@@@.@.@.@.@@@@@..@.@@@@@@...@@@@@@@@.@.@.@@.@@@..@@..@..@@@@@@@@..@@@@@@@..@@@@@@@.@@@@@.@@@@@@.@.@.@.@@@..@@
|
||||
@@.@@@@.@@@@.@..@@@@@@@@@@@@..@@@@@@@.@.@@..@..@.@@@@@@@@@@.@@@@..@.@@@@@@.@.@@.@@@@.@@@.@@..@@@...@.@@@.@@@@@.@@@@@@@@@@..@@.@@..@@..@@@@@
|
||||
@@@..@.@@.@@@.@..@.@......@@@..@@@@@.@@@@@@.@@@.@@..@@.@.@@..@...@.@@@@@@@@@@@@@.@@@@@.@...@@@@@@@@.@@..@@@@.@.@@@@@..@.@..@@@.@@@@@@@..@.@
|
||||
@@@.@@..@@@@@.@..@@@.@.@@@.@@@@@..@..@........@@@.@.@@@@@@@@@...@@@.@@@@.@.....@@@.@..@@.....@.@..@@@@@.@@@@@.@.@.@@@..@@@@.@@@@.@.@@@.@..@
|
||||
.....@@.@.@..@@@@@@@.@@.@@@.@@.@@@.@.@@@@.......@.@@@.@..@@@.@.@@@@@@@@..@@@.@..@@@@@@@...@@.@@@@@@.@@@@@@@@.@@@@...@@@@@.@@@@@...@@@@.@.@@
|
||||
.@@@@....@@.@.@@@.@.@@@.@@@.@@@.@@@.@@@@.@@@@@@@@@@@@@.@@@@@.@@@@@.@@@.@@@@@@@@.@..@..@.@...@@.@@@@@@@.@.@..@@@@..@..@@.@@@@@@@.@@@.@@@@.@.
|
||||
@@@@.@@@@...@@..@@@@@@@@..@.@@@@..@@.@@..@@@.@.@.@..@@@@.@.@@@.@.@@@@@@.@.@@@@@@@@@.@.@.@@.@@@@@.@@@@@@.@@@@@@.@@..@@@@@@..@@@@@@@@@.@@@.@@
|
||||
@.@@@@.@@@.@@@.@@..@@@@@.@.@@@@@.@@.@@...@@....@@@@.@@@@@@@...@.@@@@.@.@.@.@.@.@...@@.@@@@.@@..@.@...@@.@@@@@@@@@.@@@.@.@....@.@..@@@..@@..
|
||||
.@@@@@@..@..@@@.@@@.@@...@@.@.@@@@.@@@@@..@.@.@@.@@@..@@@@@@@@@@@@..@@..@@.@@@@@.@@@..@@@@@@@@@.@@@.@...@.@@.@.@...@.@..@@@@.@.@@@.@@@.@.@.
|
||||
@@@@..@@@.@.@.@.@@@.@@@..@@@....@@.@@..@..@@.@.@.@@.@@@@@.@@@@@@@@@@@@..@.@.@..@.@.@..@@.@@...@@.@@.@@...@..@@.@@.@@@.@@@@@@@@@@.@@@.@@@@@@
|
||||
@@@@@..@@@..@@..@.@@..@..@.@.@@...@@.@..@@@@.@@@@....@@@@.@.@@..@@@@..@@.@@..@.@.@...@@@.@@@..@@@.@.@.@.@..@@@@.@@.@..@...@@@@@@@@@.@.@@.@.
|
||||
@@@@@..@...@@@.@@@@.@.@.@@@.@@@...@@@.@.@@@@@.@@..@@.@@.@.@@@@@.@@.@@@@@@@@@@@@.@@@.@...@..@...@.@@@.@.@.@@@@@@@.@@@...@@@.@.@@@@@.@@..@.@.
|
||||
.....@@@@@@@.@@@@.@@@@@..@@@.@.@.@@...@..@..@.@..@....@@@@@@@..@@..@..@.@@.@@@@.@.@@.@..@.....@@@@@@@..@.@@@@@@@@.@.@@@@...@@.@@.@@.@.@@..@
|
||||
@..@@@.@@@@@.@@.@@@.@@@@.@@@@.....@@@...@.@@@@.@@@@@@.@@@@.@@.@@@@@@.@@.@.@..@@@@@.@@@.@@@@@...@.@@@@.....@@..@@@.@.@.@@@@@@@@@.@@..@.@..@@
|
||||
.@@@..@..@..@@..@..@@@@@@@...@@@.@@.@@.@..@@@..@@@.@.@.@@@@@@@@@@...@@@.@.@@@@@.@..@@@@..@@.@@@@@@.@.@.@.@@@@@@@@@@@.@@@@@@@@@@@..@@.@@@...
|
||||
@.@..@@.@@.@@.@@@@@@@@@@..@.@@@@@.@@..@..@.@@@@..@@@.@@@.@@@@@@.@.@...@@@@.@.@..@@@@@@@@.@@@@@.@@@@.@.@@@@@@@.@@.@@...@@@@@@@@....@@@@@@@@.
|
||||
@@@@@..@.@@@.@@.@@@@@@@@.@.@...@@@@@.@@.@.@@@.@.@.@.@@@@@.@@.@.@@.@.@.@..@@.@@@@@@@@.@.@@@@@@@@....@...@@.@@@@@@..@@@@@.@@.@.@.@.@@.@.@@@..
|
||||
..@.@@@.@...@@@.@@.@@@@@@@@.@...@@@.@@@.@@.@.@.@.@.@.@@.@@.@..@.@@@...@@@@@@@.@@@@@@@@..@.@.@@@.@.@@.@..@....@@@......@@.@@..@.@@.@@..@..@.
|
||||
.@@@.@@@.@..@@@@@@.@..@.@.@.@@.@@@.@..@.@@.@@@.@.@@..@@@@@..@.@@@@.@.@@.@..@@.@@@..@@.....@..@@@..@.@.@.@..@.@.@.@..@.@@.@@.@@@..@..@@@@@.@
|
||||
@@.@@.@@..@@@@@@.@@@@@@.@.@.@@.@.@@@...@...@@...@.@@@@@@.@.@@.@@@..@@.@.@@@@@.@..@@@@@@.@.@.@@@..@.@@.@.@.@@.@@@@.@@@@@.@..@@@@@@@@@.@..@.@
|
||||
@@@@@@@@@..@.@..@@..@@@@@...@@@@@.@@.@@@@@@@...@...@..@.@@@.@....@@@@@.@@@@@@@@.@@.@@@@@@.@@.@...@.@@..@@...@@@@.@@@@@@@.@@@@@@..@.@@@...@@
|
||||
@.@@..@@@...@.@@.@@@@@..@.@@@@@@@.@@@@@..@@.@@@.@..@@@@@@@.@@@@@@@..@.@.@.@..@@.@@@@.@@@@.@@@@@@@@@@.@@.@@@@@@@@.@@@@@@@@@.@@@@..@@@@@..@@@
|
||||
@@@@@.@...@.@@@@.@@@.@@.@@@.@@.@.@...@@@@@@...@@@@...@..@@..@.@.@@@.@@@@@@@@...@@@@@@@..@@@@@@@@.@@@@@@@.@@@..@@@@@@@...@.@@@.@@@@@@@@.@@@@
|
||||
.@@.@@..@.@@@@@.@..@@.@@@@...@@@@@.@@@.@.@.@.@@@@@.@@.@...@.@@@@.@.@@@@.@@@@@.@..@.@.@@@@@@@.@@.@.@@@...@.@@@@.@..@..@.@@@@.@..@@@@@@.@@@.@
|
||||
@@@.@..@@.@@@@.@@@...@.@.@@@.@@@@@@@.@@.@@...@@@@@@@@.@@@@@..@@@..@@@..@@@.@..@@@@..@@.@@.@@@@@@@.@@@@.@@.@.@.@@@@@.@@@@.@@..@@@.@@@@@@@.@@
|
||||
.@@.@@@...@.@@@.@@@..@..@..@@.@@@@...@..@@..@@..@.@@.@@@@.@.@@.@.@@@.@..@@@@@.@@@@@..@.@..@.@@..@.@..@..@.@@@@@@@@.@@.@@@@@@@.@@.@@...@@.@@
|
||||
@@.@@@..@@@..@..@@.@.@..@@@.@@.@@@@.@@.@@@.@.@@@.@@.@.@@@@.@.@..@@@...@@@@@....@.@@.@@.@@@@@@@@@.@@@@.@@.@.@.@.@@@@@@@@@.@.@@@@@.@.@@@@@..@
|
||||
.@@@@.@...@.@@@...@@.@.....@@.@@...@@@@@..@@@..@@.@..@@@@@@@.@.@@.@.@@@@.@.@@@@@.@@..@....@...@@..@@@...@@@@@@..@..@@@@@...@@@@@.....@@.@@@
|
||||
@..@.@@.@@@....@@@@.@@@@@@@@@..@.@@@..@@@@.@@@@@@@@@@@.@..@@@.@.@.@..@@..@@....@@@..@..@.@@.@@@.@...@@..@@.@@@@@....@@.@@@@.@@.@@@@@@...@@.
|
||||
.@@..@@..@@@@@@....@@.@..@@.@@@.@@@@@.@@@@...@....@@.@@@.@..@@.@.@.....@@@@@@.@@.@@@@@..@..@@@@.@@@.@..@@..@@@@..@.@@@..@@@@@.@.@@.@@.@@@@@
|
||||
@@@@@@@@@..@.@..@@@.@@@.@.@@@@@..@@@..@@@@@@..@@@@....@@.@.@.@...@.@@.@@@@.@.@@.@@@.@.@@..@@@@.@@....@@@...@@..@@@@@@...@.@@@@.@@.@@@@....@
|
||||
.@@.@.@@@.@.@@.@@..@..@@@@.@@.@.@.@..@@.@..@@@@@@@..@@@@@.@.@@.......@@@@@@..@.@@@.@.@@..@...@...@@@@@.@.@@@@@@@@.@@@@@.@.@@@@@@@@@@@@@@@@.
|
||||
.@@@.@@@@.@@..@@@@@.@@.@@.@@@..@.@.@@.@@..@@@@@@.@@@@@@@@@..@@@@@.@@@.@@@@@..@@@@@@@@@@.@.@@.@@.@@@.@@@@@@@@...@......@...@@@@.@@.@@@@@..@@
|
||||
.......@@@@@..@.@.@@@@@.@@..@@@@@@...@@@..@@.....@@@.@@.@@@@.@@.@@@@@@@@.@.@.@@@@.@@@.@@@@@@@@@.@@..@.@.@....@@@@@@@@@@@..@@.@@@.@@..@@..@@
|
||||
.@@@@@@.@@@...@.@@@@.@..@@@@@@@.@.@@......@@@@@@@@.@...@@..@.....@@@@.@@..@@@@@......@.@.@.@.@@.@..@.@@@@@.@.@@@@@@@@@...@.@@..@@@..@..@...
|
||||
@@.@@.@@@@@@@@.@@.@.@@.@@@@@@@@@@..@.@@@@.@@@@@@@@@@@..@.@.@@@@@@@@@@@@@@@@..@.@@.@.@@.@.@@@@.@@@@..@.@@.@@.@..@@@@.@@@@@..@@...@@@@@@.@@..
|
||||
@@@...@@.@@@@@@@@.@@@.@@@..@@@@..@@..@@.@..@@@@@..@@.@.@@@.@@@..@@..@@.@@@...@@@@.@@@.@@@@@@.@@.@@.@..@@@@.@@...@@@..@@.@@..@.@@@@.@@@@.@@@
|
||||
@@ -0,0 +1,134 @@
|
||||
using AOC.Helpers;
|
||||
|
||||
namespace AOC.Tests.Y2025;
|
||||
|
||||
[TestFixture]
|
||||
[Parallelizable(ParallelScope.All)]
|
||||
public class Day04
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
|
||||
$"{GetThisClassName()}.dat"));
|
||||
}
|
||||
|
||||
protected string GetThisClassName() { return GetType().Name; }
|
||||
private string[] realData;
|
||||
|
||||
[TestCase(@"..@@.@@@@.
|
||||
@@@.@.@.@@
|
||||
@@@@@.@.@@
|
||||
@.@@@@..@.
|
||||
@@.@@@@.@@
|
||||
.@@@@@@@.@
|
||||
.@.@.@.@@@
|
||||
@.@@@.@@@@
|
||||
.@@@@@@@@.
|
||||
@.@.@@@.@.", 13)]
|
||||
[TestCase(null, 1451)] // The actual answer
|
||||
public void Part1(string? input, int? expected)
|
||||
{
|
||||
// string[] lines = input != null ? new[] { input } : realData;
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
char[,] array = TwoDimensionalArrays.Make2DArrayFromStringArray(lines);
|
||||
|
||||
int rollsOfPaperThatCanBeAccessed = 0;
|
||||
|
||||
foreach ((int row, int column, char value) in TwoDimensionalArrays.Cells(array))
|
||||
{
|
||||
if (value != '@')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
List<(int, int)> positionsWherePaperExists =
|
||||
TwoDimensionalArrays.CheckAllSurroundingCellsForCharacter(array, row, column, '@');
|
||||
|
||||
if (positionsWherePaperExists.Count < 4)
|
||||
{
|
||||
rollsOfPaperThatCanBeAccessed++;
|
||||
}
|
||||
}
|
||||
|
||||
int result = rollsOfPaperThatCanBeAccessed;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 1: {result}");
|
||||
}
|
||||
|
||||
[TestCase(@"..@@.@@@@.
|
||||
@@@.@.@.@@
|
||||
@@@@@.@.@@
|
||||
@.@@@@..@.
|
||||
@@.@@@@.@@
|
||||
.@@@@@@@.@
|
||||
.@.@.@.@@@
|
||||
@.@@@.@@@@
|
||||
.@@@@@@@@.
|
||||
@.@.@@@.@.", 43)]
|
||||
[TestCase(null, 8701)] // The actual answer
|
||||
public void Part2(string? input, int? expected)
|
||||
{
|
||||
//string[] lines = input != null ? new[] { input } : realData;
|
||||
string[] lines = input != null ? input.Split("\n") : realData;
|
||||
|
||||
char[,] array = TwoDimensionalArrays.Make2DArrayFromStringArray(lines);
|
||||
|
||||
int totalRollsOfPaperRemoved = 0;
|
||||
int rollsOfPaperAccessed = 0;
|
||||
|
||||
bool continueLoop = true;
|
||||
|
||||
while (continueLoop)
|
||||
{
|
||||
List<(int, int)> positionsToRemovePaper = new();
|
||||
foreach ((int row, int column, char value) in TwoDimensionalArrays.Cells(array))
|
||||
{
|
||||
if (value != '@')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
List<(int, int)> positionsWherePaperExists =
|
||||
TwoDimensionalArrays.CheckAllSurroundingCellsForCharacter(array, row, column, '@');
|
||||
|
||||
if (positionsWherePaperExists.Count < 4)
|
||||
{
|
||||
totalRollsOfPaperRemoved++;
|
||||
rollsOfPaperAccessed++;
|
||||
positionsToRemovePaper.Add((row, column));
|
||||
}
|
||||
}
|
||||
|
||||
if (rollsOfPaperAccessed == 0)
|
||||
{
|
||||
continueLoop = false;
|
||||
}
|
||||
|
||||
rollsOfPaperAccessed = 0;
|
||||
|
||||
// Remove each roll
|
||||
foreach ((int, int) position in positionsToRemovePaper)
|
||||
{
|
||||
array[position.Item1, position.Item2] = 'x';
|
||||
}
|
||||
|
||||
positionsToRemovePaper.Clear();
|
||||
}
|
||||
|
||||
int result = totalRollsOfPaperRemoved;
|
||||
|
||||
if (expected != null)
|
||||
{
|
||||
Assert.That(result, Is.EqualTo(expected.Value));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Part 2: {result}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
--- Day 4: Printing Department ---
|
||||
You ride the escalator down to the printing department. They're clearly getting ready for Christmas; they have lots of large rolls of paper everywhere, and there's even a massive printer in the corner (to handle the really big print jobs).
|
||||
|
||||
Decorating here will be easy: they can make their own decorations. What you really need is a way to get further into the North Pole base while the elevators are offline.
|
||||
|
||||
"Actually, maybe we can help with that," one of the Elves replies when you ask for help. "We're pretty sure there's a cafeteria on the other side of the back wall. If we could break through the wall, you'd be able to keep moving. It's too bad all of our forklifts are so busy moving those big rolls of paper around."
|
||||
|
||||
If you can optimize the work the forklifts are doing, maybe they would have time to spare to break through the wall.
|
||||
|
||||
The rolls of paper (@) are arranged on a large grid; the Elves even have a helpful diagram (your puzzle input) indicating where everything is located.
|
||||
|
||||
For example:
|
||||
|
||||
..@@.@@@@.
|
||||
@@@.@.@.@@
|
||||
@@@@@.@.@@
|
||||
@.@@@@..@.
|
||||
@@.@@@@.@@
|
||||
.@@@@@@@.@
|
||||
.@.@.@.@@@
|
||||
@.@@@.@@@@
|
||||
.@@@@@@@@.
|
||||
@.@.@@@.@.
|
||||
The forklifts can only access a roll of paper if there are fewer than four rolls of paper in the eight adjacent positions. If you can figure out which rolls of paper the forklifts can access, they'll spend less time looking and more time breaking down the wall to the cafeteria.
|
||||
|
||||
In this example, there are 13 rolls of paper that can be accessed by a forklift (marked with x):
|
||||
|
||||
..xx.xx@x.
|
||||
x@@.@.@.@@
|
||||
@@@@@.x.@@
|
||||
@.@@@@..@.
|
||||
x@.@@@@.@x
|
||||
.@@@@@@@.@
|
||||
.@.@.@.@@@
|
||||
x.@@@.@@@@
|
||||
.@@@@@@@@.
|
||||
x.x.@@@.x.
|
||||
Consider your complete diagram of the paper roll locations. How many rolls of paper can be accessed by a forklift?
|
||||
|
||||
--- Part Two ---
|
||||
Now, the Elves just need help accessing as much of the paper as they can.
|
||||
|
||||
Once a roll of paper can be accessed by a forklift, it can be removed. Once a roll of paper is removed, the forklifts might be able to access more rolls of paper, which they might also be able to remove. How many total rolls of paper could the Elves remove if they keep repeating this process?
|
||||
|
||||
Starting with the same example as above, here is one way you could remove as many rolls of paper as possible, using highlighted @ to indicate that a roll of paper is about to be removed, and using x to indicate that a roll of paper was just removed:
|
||||
|
||||
Initial state:
|
||||
..@@.@@@@.
|
||||
@@@.@.@.@@
|
||||
@@@@@.@.@@
|
||||
@.@@@@..@.
|
||||
@@.@@@@.@@
|
||||
.@@@@@@@.@
|
||||
.@.@.@.@@@
|
||||
@.@@@.@@@@
|
||||
.@@@@@@@@.
|
||||
@.@.@@@.@.
|
||||
|
||||
Remove 13 rolls of paper:
|
||||
..xx.xx@x.
|
||||
x@@.@.@.@@
|
||||
@@@@@.x.@@
|
||||
@.@@@@..@.
|
||||
x@.@@@@.@x
|
||||
.@@@@@@@.@
|
||||
.@.@.@.@@@
|
||||
x.@@@.@@@@
|
||||
.@@@@@@@@.
|
||||
x.x.@@@.x.
|
||||
|
||||
Remove 12 rolls of paper:
|
||||
.......x..
|
||||
.@@.x.x.@x
|
||||
x@@@@...@@
|
||||
x.@@@@..x.
|
||||
.@.@@@@.x.
|
||||
.x@@@@@@.x
|
||||
.x.@.@.@@@
|
||||
..@@@.@@@@
|
||||
.x@@@@@@@.
|
||||
....@@@...
|
||||
|
||||
Remove 7 rolls of paper:
|
||||
..........
|
||||
.x@.....x.
|
||||
.@@@@...xx
|
||||
..@@@@....
|
||||
.x.@@@@...
|
||||
..@@@@@@..
|
||||
...@.@.@@x
|
||||
..@@@.@@@@
|
||||
..x@@@@@@.
|
||||
....@@@...
|
||||
|
||||
Remove 5 rolls of paper:
|
||||
..........
|
||||
..x.......
|
||||
.x@@@.....
|
||||
..@@@@....
|
||||
...@@@@...
|
||||
..x@@@@@..
|
||||
...@.@.@@.
|
||||
..x@@.@@@x
|
||||
...@@@@@@.
|
||||
....@@@...
|
||||
|
||||
Remove 2 rolls of paper:
|
||||
..........
|
||||
..........
|
||||
..x@@.....
|
||||
..@@@@....
|
||||
...@@@@...
|
||||
...@@@@@..
|
||||
...@.@.@@.
|
||||
...@@.@@@.
|
||||
...@@@@@x.
|
||||
....@@@...
|
||||
|
||||
Remove 1 roll of paper:
|
||||
..........
|
||||
..........
|
||||
...@@.....
|
||||
..x@@@....
|
||||
...@@@@...
|
||||
...@@@@@..
|
||||
...@.@.@@.
|
||||
...@@.@@@.
|
||||
...@@@@@..
|
||||
....@@@...
|
||||
|
||||
Remove 1 roll of paper:
|
||||
..........
|
||||
..........
|
||||
...x@.....
|
||||
...@@@....
|
||||
...@@@@...
|
||||
...@@@@@..
|
||||
...@.@.@@.
|
||||
...@@.@@@.
|
||||
...@@@@@..
|
||||
....@@@...
|
||||
|
||||
Remove 1 roll of paper:
|
||||
..........
|
||||
..........
|
||||
....x.....
|
||||
...@@@....
|
||||
...@@@@...
|
||||
...@@@@@..
|
||||
...@.@.@@.
|
||||
...@@.@@@.
|
||||
...@@@@@..
|
||||
....@@@...
|
||||
|
||||
Remove 1 roll of paper:
|
||||
..........
|
||||
..........
|
||||
..........
|
||||
...x@@....
|
||||
...@@@@...
|
||||
...@@@@@..
|
||||
...@.@.@@.
|
||||
...@@.@@@.
|
||||
...@@@@@..
|
||||
....@@@...
|
||||
Stop once no more rolls of paper are accessible by a forklift. In this example, a total of 43 rolls of paper can be removed.
|
||||
|
||||
Start with your original diagram. How many rolls of paper in total can be removed by the Elves and their forklifts?
|
||||
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AOC.Tests", "AOC.Tests\AOC.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayCreator", "DayCreator\DayCreator.csproj", "{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AOC.Helpers", "AOC.Helpers\AOC.Helpers.csproj", "{63782BBE-C14A-407A-9980-CD31088D4CD3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -21,6 +23,10 @@ Global
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F98514e314f1feddb3082dbe8507ecec1a81b6491c0db7dc53c2e8c13949e4360_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
|
||||
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8ddce0d5_002Db323_002D41bb_002Da920_002D6cc320742199/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Y2024" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||
<ProjectFolder>2E0193E1-5DD3-40A6-A07B-C6E58341ACA0/d:Y2024</ProjectFolder>
|
||||
</SessionState></s:String></wpf:ResourceDictionary>
|
||||
</SessionState></s:String>
|
||||
|
||||
|
||||
</wpf:ResourceDictionary>
|
||||
Reference in New Issue
Block a user