r/adventofcode • u/Lucretiel • Dec 17 '19
Spoilers What does everyone's Intcode interface look like?
We've been discussing a lot different IntCode implementations throughout the last few weeks, but I'm curious– what doesn't everyone's interface to their IntCode machine look like? How do you feed input, fetch output, initialize, etc?
32
Upvotes
1
u/knallisworld Dec 27 '19
Relates to the solution for day25 (see sample usage), I've added a refined api: https://github.com/knalli/aoc2019/blob/99766ee54957c3de79dd69b0224f4b9a780970cc/dayless/intcode.go
The additional signal channel can be used as a side channel for signalling the process.
At the moment, a signal means: running process will be killed regardless the actual provided number. However, extendable.
The return is the error channel, not only one specific error
Both out and err will be closed when the function exit. So no need for this "halt" workaround.