-
Just reading your code - in your part 2 you have 'if line[0] = jmp, then change to nop', have you missed the vice versa as well or have i misunderstood?
if you've missed the vice versa then i guess you got lucky ;)
also i see you didn't use deepcopy in the end and instead re-created q_variation each time, any idea what would be quicker?
-
I implented the jmp to nop first, if that didn't give any solutions I would have tried the vice versa, but I got lucky. And according to a StackOverflow question on array copying behaviour the recreation I used is a functional equivalent of deepcopy which is supposed to be faster. But I mainly picked it over deepcopy because I could then see what was going on instead of using a black box function for it.
But I would not at all use my code as an example, I'm far from an expert. Just barely getting by.
Today I learned about deep copying and why in the fuck things were changing when I didn't them to change.
https://github.com/TijmenK/AoC2020/blob/main/day8.py