def main():
    computer = IntCodeComputer('day_17.input')
    computer.set_io_format(IntCodeComputer.UNICODE)
    memory, _, _ = computer.save()
    result = []
    # computer.run(output_data=result)
    # print("".join(result))
    # rows = "".join(result).split()
    # intersections = []
    # for y in range(len(rows) - 2):
    #     for x in range(len(rows[y]) - 2):
    #         if rows[y][x] == '#' and rows[y + 1][x] == '#' and rows[y - 1][x] == '#' and rows[y][x + 1] == '#' and rows[y][x - 1] == '#':
    #             intersections.append((x, y))
    # print(sum([x * y for x, y in intersections]))
    memory[0] = 2
    computer.load(memory, 0, 0)
    # 'R,10,R,8,L,10,L,10,R,8,L,6,L,6,R,8,L,6,L,6,R,10,R,8,L,10,L,10,L,10,R,10,L,6,R,8,L,6,L,6,L,10,R,10,L,6,L,10,R,10,L,6,R,8,L,6,L,6,R,10,R,8,L,10,L,10'
    input_data = [
        'B,A,A,B,C,A,C,C,A,B\n', 'R,8,L,6,L,6\n', 'R,10,R,8,L,10,L,10\n',
        'L,10,R,10,L,6\n', 'n\n'
    ]

    computer.run(input_data=[x for x in "".join(input_data)],
                 output_data=result)
    print(result)
 def test_unicode(self):
     computer = IntCodeComputer()
     computer.load([
         1006, 17, 16, 4, 17, 1001, 4, 1, 4, 1001, 1, 1, 1, 1105, 1, 0, 99,
         72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33, 0
     ])
     computer.set_io_format(IntCodeComputer.UNICODE)
     result = []
     computer.run(output_data=result)
     self.assertEqual("Hello, World!", "".join(result))