Day 10: Cathode-Ray Tube [AOC2022 Python]

preview_player
Показать описание
I'm given a lines of instructions for a very simple computer driving a screen. It can call nop and add, where the add adds a value to a single register. This computer also has to keep a clock. I'll use the combination of the clock and the value to first find the value at a handful of given times, but then to create a display that will show 8 letters. I'll write a computer class with functions to handle the instructions and stepping.

#adventofcode #python

[00:00] Introduction
[00:11] Part 1 description
[02:08] Reviewing puzzle input
[02:56] Writing a Computer class skeleton
[04:40] Writing step function
[05:57] Writing noop and add functions
[06:22] Writing run function
[08:01] Creating a Computer in main and trying to solve
[08:25] Troubleshooting that I forgot to run the computer
[09:58] Running with the example output to find why answer is wrong
[11:26] Finding the error, solving part 1
[12:07] Part 2 description
[13:32] Adding dictionary to track pixels, updating in step
[16:50] Adding print function
[18:08] Troubleshooting that I switched r and c in print
[19:18] Troubleshooting that only first row is written
[21:05] Found issue, fixing and solving
[21:56] Summary
Рекомендации по теме