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

1.4 KiB

Notes

ok. only thought i had was to simulate the thing

have single executor, that takes head of the queue, signals would be (to, from, type)

take 'to' out of the map, call it's 'process(from, type)'

and different types of executors would implement this differently. and return a slice of new signals in order, to be appended.

if queue is empty - the single button press is propagated and all is well.

we will take snapshot of state, String() repr of all executors should be enough, and save amount of signals sent so far

also, i suppose i'd want to have entry points for fiddling with single executors to be test cases.

modules to implement

TODO Broadcast

TODO Flip-Flop

TODO Conjunction

TODO Button

i guess each module could test if string is it's a representation of this type

and would be able to parse it? into it's own struct? well, those are just functions, since only methods are associated, so ok

how do i run single tests?

running tests from the module

go test sunshine.industries/aoc2023/day20 -v

have file with `_test.go` and `func Test…(t *testing.T) {}` name

running single test

go test sunshine.industries/aoc2023/day20 -v -run TestParseFlipFlop

yikes. if i don't know the 'inputs' to the conjunction, don't know how to check for 'all high'

let's add registering after the map is read.