ins = [2, 3, 0, 3, 99] expectd = [2, 3, 0, 6, 99] result = solve(ins) aoc.assert_msg(f"input={ins} expects output={expectd}, got {result}", expectd == result) ins = [2, 4, 4, 5, 99, 0] expectd = [2, 4, 4, 5, 99, 9801] result = solve(ins) aoc.assert_msg(f"input={ins} expects output={expectd}, got {result}", expectd == result) ins = [1, 1, 1, 4, 99, 5, 6, 0, 99] expectd = [30, 1, 1, 4, 2, 5, 6, 0, 99] result = solve(ins) aoc.assert_msg(f"input={ins} expects output={expectd}, got {result}", expectd == result) ### personal input data = aoc.read_file_firstline_to_str('day02.in') data = list(map(int, data.split(','))) data[1] = 12 data[2] = 2 print(f"data-type={type(data)} data={data}") ### personal solution outputs = solve(data) print(f"output={outputs}") print(f"result={outputs[0]}")
### tests # In[ ]: ins = '123456789012' print(f"ins={ins}") expectd = 1 test_img = build_image(ins, 3, 2) res = analyse_img(test_img) aoc.assert_msg(f"input={ins} expects output={expectd}, got {res}", expectd == res) # In[ ]: ### personal input solution # In[ ]: ins = aoc.read_file_firstline_to_str("day08.in") #print(f"{ins}") res = solve(ins) print(f"result={res}")