-
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.
-
Ah fair enough.
I also saw you used enumerate, i need to get better at doing that rather than writing what i think is probably lazy code (and slow)
Biggest improvement for my solution would be putting it all into a function i think, other than that most of the operational stuff was similar between ours.
Also a pretty basic programmer myself so tend to try and learn from others code as much as i can, even if it's not the best either!
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?