day10, doesn't work again.

pipes go into filling all 3x3 and all is lost
This commit is contained in:
efim
2023-12-10 15:54:01 +00:00
parent e4afe55a1f
commit 742786af47
2 changed files with 132 additions and 59 deletions

View File

@@ -45,3 +45,67 @@ 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.