part1Code = {
return [
0x01,
0x04,
0x7f,
0x20, 0x00,
0x41, 0x04,
0x6C,
0x28, 0x02, 0x00,
0x21, 0x01,
0x20, 0x00,
0x41, 0x04,
0x6C,
0x28, 0x02, 0x04,
0x41, 0x04,
0x6C,
0x28, 0x02, 0x00,
0x21, 0x02,
0x20, 0x00,
0x41, 0x04,
0x6C,
0x28, 0x02, 0x08,
0x41, 0x04,
0x6C,
0x28, 0x02, 0x00,
0x21, 0x03,
0x20, 0x00,
0x41, 0x04,
0x6C, // multiply to get memory address
0x28, 0x02, 0x0c, // load the integer at this location + 12 bytes
0x21, 0x04, // store result in local variable dest
0x02, 0x40, // start a block - this one for mult
0x02, 0x40, // start a block - this one for end
0x41, 0x01, // constant integer 1
0x20, 0x01, // get local variable operator
0x46, // are these two integers equal?
0x0D, 0x00, // break out of block if so (add)
0x41, 0x02, // constant integer 2
0x20, 0x01, // get local variable operator
0x46, // are these two integers equal?
0x0D, 0x01, // break out two levels if so (mult)
0x41, 0x7f, // constant integer -1
0x0f, // return -1 meaning intcode program is over
0x0B, // END opcode
0x20, 0x04, // get local variable dest
0x41, 0x04, // constant integer 4
0x6C, // multiply to get index into memory
0x20, 0x02, // get local variable operand1
0x20, 0x03, // get local variable operand2
0x6A, // add operands
0x36, 0x02, 0x00, // store at value at dest
0x20, 0x00, // load passed-in parameter "location"
0x41, 0x04, // constant integer 4
0x6A, // add to get new location
0x0f, // return 1 meaning intcode program is still running
0x0B, // END opcode
0x20, 0x04, // get local variable dest
0x41, 0x04, // constant integer 4
0x6C, // multiply to get index into memory
0x20, 0x02, // get local variable operand1
0x20, 0x03, // get local variable operand2
0x6C, // multiply operands
0x36, 0x02, 0x00, // store at value at dest
0x20, 0x00, // load passed-in parameter "location"
0x41, 0x04, // constant integer 4
0x6A, // add to get new location
0x0B // END opcode
]
}