mirror of
https://github.com/seigler/aoc2024
synced 2025-07-27 09:06:09 +00:00
comments
This commit is contained in:
parent
6490326b05
commit
5e26df54c8
1 changed files with 15 additions and 4 deletions
|
@ -104,13 +104,24 @@ const part2 = (rawInput: string) => {
|
||||||
const nextDirection = (thisDirection + 1) % 4
|
const nextDirection = (thisDirection + 1) % 4
|
||||||
const presentNextDirection = orthogonalProbes[nextDirection]
|
const presentNextDirection = orthogonalProbes[nextDirection]
|
||||||
if (
|
if (
|
||||||
presentThisDirection &&
|
// example: plot is X, direction is right
|
||||||
presentNextDirection &&
|
// ###
|
||||||
!diagonalProbes[thisDirection]
|
// #XA
|
||||||
|
// #B.
|
||||||
|
presentThisDirection && // A
|
||||||
|
presentNextDirection && // B
|
||||||
|
!diagonalProbes[thisDirection] // .
|
||||||
) {
|
) {
|
||||||
corners += 1
|
corners += 1
|
||||||
}
|
}
|
||||||
if (!presentThisDirection && !presentNextDirection) {
|
if (
|
||||||
|
// example: plot is X, direction is right
|
||||||
|
// ##.
|
||||||
|
// #X!
|
||||||
|
// .!.
|
||||||
|
!presentThisDirection && // !
|
||||||
|
!presentNextDirection // !
|
||||||
|
) {
|
||||||
corners += 1
|
corners += 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue