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

1.7 KiB

Notes

ok. let's try this.

i'd want to have block type with function to get it's XY coords

i'd want to settle blocks first. but if i store enough data, for example block.supports slice i'll be able to anser first task.

(settledOnZ) i would want [][]*Block per level from 0 to up. with references to blocks that settled on that level

(maxSettledXY) and for going from 0 up i'll want XY of the top block settled with it's level. i guess i could store settled level in the block as well

then for settling blocks, i will need (sorted map if data is sparse?) go from 0 up, order of processing for blocks on same z level is not important. for each block get it's XY, check maxSettledXY if there's a block check it's Z, for all block XY coords, find maximal settled Z, and refs to all blocks that are directly under with that same Z.

for the block set settledZ to Z+1, and for all those blocks add the block to 'supports' add block to settledOnZ[Z+1]

for the second part, i can scan all the blocks, don't even need the settledOnZ, just check if it's 'supports' is empty

DONE block type

store z, and have 'settledZ', maybe with default -1?

DONE coords type, func to get XY coords of the block

DONE now i guess what? do i want a sorted map? or just map from height to blocks on that hight?

let's read file, and calc max height present? i suppose funciton to read file could also be initially entered via test, right?

TODO now go through the z levels, block by block, doing setting.

i suppose i could organize setting methods around Space? it will store (settledOnZ) and (maxSettledOnXY)

i can already imagine secon part? what is the most volume that can be disintegrated? or what? most volume is just all