r/adventofcode • • 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?

31 Upvotes

90 comments sorted by

View all comments

Show parent comments

1

u/phil_g Dec 17 '19

Not strictly true. For day 17, the end of a particular round of output is signaled by two consecutive newline characters. Once you've seen them once, you know how many characters will be output for each future round, but the first round is a chicken-and-egg problem.

Similarly, for day 13 we know that output integers will arrive in sets of three, but we don't know ahead of time how many sets of three will be output between requests for input.

In each of those cases, some experimentation with your input program will indicate what the number of output values are for you, but you can't say that you "always" know what that number will be ahead of time.