diff --git a/Day10/Part1.js b/Day10/Part1.js index 5c2c35d..6b261a2 100644 --- a/Day10/Part1.js +++ b/Day10/Part1.js @@ -74,7 +74,7 @@ while (open.length > 0) { }; if (closed.some((e) => compare(e, next))) continue; - if (!relPos(bends[symbol], -i, -j)) continue; + if (!bends[symbol] || !relPos(bends[symbol], -i, -j)) continue; open.push(next); } diff --git a/Day10/Part2.js b/Day10/Part2.js index efbbabd..c8c2457 100644 --- a/Day10/Part2.js +++ b/Day10/Part2.js @@ -75,7 +75,7 @@ while (open.length > 0) { }; if (closed.some((e) => compare(e, next))) continue; - if (!relPos(bends[symbol], -i, -j)) continue; + if (!bends[symbol] || !relPos(bends[symbol], -i, -j)) continue; open.push(next); }