Advent-of-Code-2023/day10/notes.org

2.9 KiB

Notes

part 2.

how would i even try to check of 'in' or 'out' of the loop? i guess i could mark things while i go through the loop?

or, i could count manually?

i could change neighbors of the beast point. then do one more pass around, setting bool 'onMainPath' to true and then change all else to .

i guess i could then do one more pass, and mark as 'I' and 'O' closest line of .

another idea i don't really want to pursue - 'color fill from some corner' this is also painful due to pipes touching still need to let the 'O' filling in.

but yeah, if i make initial filling in of the I, then i could just fill in all . with I until nothing changes. and count I

sounds like a plan

allright, i found main path, display all not on main path as ' '

and the thing is a mess

i don't know how to select a point to mark as 'I'

but! if i select a point to mark as 'O' and then go around the main path, marking things on the side as 'O' then i would be able to fill in all which are neighbors of 'O' as 'O' and that would leave only 'I' to be counted

so.

how would i monitor consistent 'side' of the pipe during the walkhrough? if we go down - we color as 'O' one down. if we go angle - color two - one down and one to the right. and only color if it's not already on main path.

i suppose so

so a new method for initial pass of 'O'

well, i'll need access to the direction, in which the neighbor is taken? nooo. not direction, but the symbol. ok, this is easier

but i'll need to mutate the field

no, i do need direction.

ok, let's go lunch maybe, and maybe it will be a place with a power outlet as well

all is bad.

i guess my model is unfit.

what if. i had only 'forward' movement, and then Next would sometimes return 'forward', and sometimes 'right', 'forward'

then. i'll need to store current directoin, have function to rotate it.

and do 'forward' on coords based on the current direction

and that would be NextPathCell()

but from same how would i distinguish between being on top or bottom for -J i'll need to remember whether outer is to the 'left' or 'right' of the path and then if path turns into outer - just turn, don't do 'forward' and if path torns out of outer - do "big turn"

maybe there's an easy check here? if path

and one more idea.

i could do without 'walking' the outer pointer. i could mark all outer around the path element. based on where the outer is located and there are two possibilities. i could even maybe mark them as 3x3

i stay on the path element. i check what are the 'O' in it's 3x3 and fill in other of same area as 'O' and move on to next

yeah, i think i like that.

i will have a function that takes the path element. select the template then go through 3x3 around the path element, if sees element with .isOuter == true saves the name of the area, then for each found out area mark them all as 'O'

AAA .-. BBB

A.B A|B A.B

A.B A⌞. AAA

B.A .⌟A AAA

AAA .⌝A B.A

AAA A⌜. A.B

i guess i could just code that.