|
@@ -49,6 +49,25 @@ const tests = [
|
|
|
".664.598..",
|
|
|
];
|
|
|
|
|
|
+/**
|
|
|
+ * Test case from /u/i_have_no_biscuits
|
|
|
+ * @see https://www.reddit.com/r/adventofcode/comments/189q9wv/2023_day_3_another_sample_grid_to_use/
|
|
|
+ */
|
|
|
+const tests_reddit = [
|
|
|
+ "12.......*..",
|
|
|
+ "+.........34",
|
|
|
+ ".......-12..",
|
|
|
+ "..78........",
|
|
|
+ "..*....60...",
|
|
|
+ "78..........",
|
|
|
+ ".......23...",
|
|
|
+ "....90*12...",
|
|
|
+ "............",
|
|
|
+ "2.2......12.",
|
|
|
+ ".*.........*",
|
|
|
+ "1.1.......56",
|
|
|
+];
|
|
|
+
|
|
|
const input = await LoadInput(3);
|
|
|
|
|
|
// Build the find
|
|
@@ -59,7 +78,6 @@ let engineParts = ParseSchematics(schematics);
|
|
|
engineParts = ValidateEngineParts(engineParts, schematics);
|
|
|
|
|
|
// Get our output
|
|
|
-// 551521: too low
|
|
|
const sumOfPartNumbers = engineParts.reduce((accumulator, part) => accumulator += part.PartNumber, 0);
|
|
|
console.log(`The sum of part numbers is: ${sumOfPartNumbers}`);
|
|
|
|
|
@@ -119,6 +137,10 @@ function ParseSchematics(schematicsMap: string[][]): EnginePart[] {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(part !== null) {
|
|
|
+ engineParts.push(part);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return engineParts;
|