<gh_stars>0
file = open('day2.in').read()
intcode = [int(n) for n in file.split(',')]

#intcode = [1,9,10,3,2,3,11,0,99,30,40,50]

# Part 1
value = 0
idx = 0
while value != 99:
    value = intcode[idx]
    if value == 1:
        intcode[intcode[idx+3]] = intcode[intcode[idx+1]] + intcode[intcode[idx+2]]
    if value == 2:
        intcode[intcode[idx+3]] = intcode[intcode[idx+1]] * intcode[intcode[idx+2]]
    idx += 4
    
print(intcode)

file = open('day2.in').read()
intcode = [int(n) for n in file.split(',')]

#intcode = [1,9,10,3,2,3,11,0,99,30,40,50]

# Part 1
value = 0
idx = 0
while value != 99:
    value = intcode[idx]
    if value == 1:
        intcode[intcode[idx+3]] = intcode[intcode[idx+1]] + intcode[intcode[idx+2]]
    if value == 2:
        intcode[intcode[idx+3]] = intcode[intcode[idx+1]] * intcode[intcode[idx+2]]
    idx += 4
    
print(intcode)
#intcode = [1,9,10,3,2,3,11,0,99,30,40,50] # Part 1