mirror of
https://github.com/seigler/aoc2024
synced 2025-07-26 00:36:10 +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 presentNextDirection = orthogonalProbes[nextDirection]
|
||||
if (
|
||||
presentThisDirection &&
|
||||
presentNextDirection &&
|
||||
!diagonalProbes[thisDirection]
|
||||
// example: plot is X, direction is right
|
||||
// ###
|
||||
// #XA
|
||||
// #B.
|
||||
presentThisDirection && // A
|
||||
presentNextDirection && // B
|
||||
!diagonalProbes[thisDirection] // .
|
||||
) {
|
||||
corners += 1
|
||||
}
|
||||
if (!presentThisDirection && !presentNextDirection) {
|
||||
if (
|
||||
// example: plot is X, direction is right
|
||||
// ##.
|
||||
// #X!
|
||||
// .!.
|
||||
!presentThisDirection && // !
|
||||
!presentNextDirection // !
|
||||
) {
|
||||
corners += 1
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue