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

1.5 KiB

Notes

testing things

testSorter := day19.ReadSorterLine("qqz{s>2770:qs,m<1801:hdj,R}") log.Printf("my test sorter is %+v", testSorter)

testOperation := day19.ReadOperationLine("s>2770:qs") log.Println(testOperation)

testing simplification

lnx{m>1548:A,A} qqz{s>2770:qs,m<1801:hdj,R} kt{m>2215:R,x>3386:A,x<3107:R,R}

testSorter := day19.ReadSorterLine("kt{m>2215:R,x>3386:A,x<3107:R,R}") log.Printf("my test sorter is %+v", testSorter)

simplified := day19.SimplifyOperation(testSorter) log.Printf("> simplivied %+v", simplified)

i probably don't need 'actual actors'

just a generic function that takes 'detail' and 'sorterData' then applies sorterData to the detail, and calls itself with new sorter

with special cases for "R" and "A"

so. have funciton from OpeartionData & Detail -> true/false if true take the destination, if false, check next

well. only way to do this is with intervals

so, sorter check takes in interval.

then for each of the rule, call first rule with full interval, deduct first rule (for those that don't match) and pass to second. deduct second and pass to next

A will return full R will return empty

and results from each rule application should be joined

so. i need interval deduction and i need interval join

found a bug in always using initial intervals to calculate 'failing' after each step

2023/12/19 11:45:14 got and checked 167409079868000

In the above example, there are 167409079868000 distinct combinations of ratings that will be accepted.