169 lines
4.9 KiB
Org Mode
169 lines
4.9 KiB
Org Mode
#+title: 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.
|
|
** it also doesn't work. pipes to into place where whole 3x3 is path pipes and info on 'outer' is lost
|
|
** will it work to cound intersections between a point and Top \ Left direction?
|
|
** hypothesis - from the point, count up, down, left & right - intersections with the golden path.
|
|
if into U&D or L&R both are odd - then inside.
|
|
short circuit - if into 1 direction number is 0 - definitely outside
|
|
|
|
and that's square? could kube? well, there shouldn't be too many points without the pipe already
|
|
|
|
maybe i can somehow count for the whole map?
|
|
|
|
if element on path - increase by 1 value from top
|
|
*** also, what if i could consturct couter example before i start coding, you know
|
|
with the point that is outside, but has odd in two sides?
|
|
|
|
yes, i think there's a counter example with a point which has 3 on all sides because of path going directly to that side
|
|
but maybe we don't count that as 'crossing'? only if we what? cross non-parallel line?
|
|
|
|
that could be it
|
|
** ok, last idea, yes, count intersections
|
|
one additonal [][]int
|
|
from top to bottom. take value from top, if it's pipe (and doesn't have down movemnt) increase by 1
|
|
if it's not on path and has Even number, already count as Outer
|
|
** oh, come on .
|
|
|
|
7
|
|
|
|
|
L is 1
|
|
|
|
but
|
|
7
|
|
|
|
|
J is 0
|
|
|
|
how to account for that?
|
|
monitor the left and right somehow.
|
|
have another map, store left or right in previous cell if we are in top thingy?
|
|
|
|
if we're on path, and previous is empty - store left or right?
|
|
so, copy previous
|
|
|
|
and if we're counting up - store nothing.
|
|
|
|
or just monitor angles?
|
|
maybe have stack? of seen path elements?
|
|
and some elements take off?
|
|
** ok, one more attempt?
|
|
not counting, but maintaining a stack?
|
|
and opposite angles take the element off the stack?
|
|
|
|
so - takes off -
|
|
and any left braket takes off any right bracket
|
|
|
|
and two bottom angles shouldn't be allowed to counteract one another, but top & bottom should be balanced anyway
|
|
** uh. so many more updates.
|
|
and i'll need to owerwrite S to it's value somehow
|
|
|
|
i will change the S myself. by hardcode
|