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

2.1 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

DONE Broadcast

DONE Flip-Flop

DONE Conjunction

DONE 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.

well. for part 2 brute force doesn't work.

how could i examine inputs to the 'rx' to see when it will receive 'low'?

i suppose inputs could be on prime cycles, which would align to all required values only on a very big step?

let's do some kind of visualiztion?

how would i do graphql or mermaidjs?

flowchard in mermaid should be it

go run . > day20/my-mermaid.mmd

so, looking at the thingy.

rx is produced by &th which has inputs of 11:&xn -> th 14:&qn -> th 16:&xf -> th 32:&zl -> th

for rx to receive a low pulse. &th should receive High Pulse, while all other inputs alse remembered as high.

this is not too easy. but first let's check if loops over

  • xn
  • qn
  • xh
  • zl

are manageable.