day21: saturation logic, but removing points to early
This commit is contained in:
@@ -39,3 +39,52 @@ 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
|
||||
|
||||
|
||||
** TODO 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
|
||||
** TODO on the last step, when n is 0
|
||||
return len(startingAt) + (all saturated fields) * (amount of elems in their phase)
|
||||
|
||||
Reference in New Issue
Block a user