The second problem introduce the Intcode
virtual machine, where a sequence of integers should be interpreted as op-codes and arguments. The first version of this machine only does add
and mul
but I have a feeling this machine will come back in later problems. The first half of the puzzle was trivial, the second half took ages to compute (not to implement). But after I had up:ed the gas limit and split the setup of the Intcode
machine memory into setup and initialization it can be run in about 20 seconds on a normal laptop. (Consuming a measly 1503823113 of gas…)
See my solution here - looking forward to seeing other variants would be nice to see if there are more efficient implementations!