106 lines
3.5 KiB
Org Mode
106 lines
3.5 KiB
Org Mode
#+title: Notes
|
|
* part 1
|
|
so we aren't looking for minimal distance.
|
|
but all plots which are end to any path of length 'steps left'
|
|
|
|
so, i have to follow all possible paths to the end?
|
|
or. length of 6 and all even - because i could be doing <- ->
|
|
but i could be doing loop around that would increase path len by odd number
|
|
|
|
let's just make direct recursive thing.
|
|
create set of all reachable by n,
|
|
* oh, the part 2.
|
|
i suppose this 'infinite' garden could be managed with my 'neighbors' work with 'out of field'
|
|
fairly easy
|
|
but what about sizes of the maps? are we releasing maps of previous iterations?
|
|
|
|
maybe if i directly pass references to prev and current,
|
|
and manually set 'prev' to target new it will be collected?
|
|
|
|
and then elements after these steps <em>26501365</em> would fit into memory?
|
|
** i guess maybe it would help if i had 'fully saturated' field
|
|
as my minimal 'skipping' thing
|
|
** so. store FieldCoord(fieldRow, fieldCol) for fields which were fully saturated at current step.
|
|
|
|
filter out neighbors, no need to enter fully saturated fields
|
|
|
|
when counting
|
|
on odd - around the S, on even - with S
|
|
|
|
but the neighboring fields would potentially (likely?) be in different phases
|
|
|
|
but i guess they are necessarily in different phases?
|
|
or. if width odd - necessarily
|
|
if width even - then what?
|
|
|
|
then S is not in the center
|
|
|
|
my input is 131 chars of width.
|
|
so neighboring are necessarily of different phase.
|
|
could compute phase of (0,0)
|
|
and adjust from that
|
|
** TODO remake 'ReachableBySteps' into 'CountReachableBySteps' returning int
|
|
** TODO make it take 'isInitialCountOdd' - to know phase of {0,0} field
|
|
current phase can be determined by initial phase and current N
|
|
|
|
if initial count is odd, and now it's odd number, we made even iterations, so (0,0) is in even state
|
|
if initial count is even, and now it's even number, we made even iterations, so (0,0) is in even state
|
|
|
|
** DONE make neighbors take set of saturated fields
|
|
and not produce points on those fields
|
|
** DONE for field calculate what would be amount of points in each phase
|
|
...........
|
|
.....###.#.
|
|
.###.##..#.
|
|
..#.#...#..
|
|
....#.#....
|
|
.##..S####.
|
|
.##..#...#.
|
|
.......##..
|
|
.##.#.####.
|
|
.##..##.##.
|
|
...........
|
|
*** getting 39 and 42
|
|
let's check
|
|
42 is even?
|
|
*** hmmm
|
|
EOEOEOEOEOE
|
|
OEOEO###O#O
|
|
E###E##OE#E
|
|
OE#E#EOE#EO
|
|
EOEO#O#OEOE
|
|
O##EOE####O
|
|
E##OE#EOE#E
|
|
OEOEOEO##EO
|
|
E##O#O####E
|
|
O##EO##E##O
|
|
EOEOEOEOEOE
|
|
*** yes, sounds good
|
|
|
|
|
|
** CANCELLED after getting all new points. get coords of all fields we're working on.
|
|
( there already should be no points in saturated fields )
|
|
for each such field, check if it is saturated.
|
|
|
|
- can be done by comparing the phase with amount of points on saturated
|
|
|
|
if field saturated - add the coord into set
|
|
and remove all the points
|
|
** CANCELLED on the last step, when n is 0
|
|
return len(startingAt) + (all saturated fields) * (amount of elems in their phase)
|
|
** calculating points in even 7356 and odd 7321 phases
|
|
* so need to scrap things and do a more analytics approach.
|
|
no blocks on horizontal & vertical from (S)
|
|
meaning diamond expands to left & right well
|
|
* 26501365 = 202300 * 131 + 65 where 131 is the dimension of the grid
|
|
* if there is a formula A*i^2 + B*i + C = D
|
|
where i is full iteration
|
|
* for initial steps :
|
|
2023/12/21 13:25:23 after steps 65. full iter 0. got count 3701
|
|
2023/12/21 13:25:24 after steps 196. full iter 1. got count 33108
|
|
2023/12/21 13:25:27 after steps 327. full iter 2. got count 91853
|
|
2023/12/21 13:25:42 after steps 458. full iter 3. got count 179936
|
|
|
|
* https://www.dcode.fr/newton-interpolating-polynomial
|
|
14669x^2 + 14738*x+3701
|