diff --git a/2019/day9/Intcode.hs b/2019/day9/Intcode.hs index fcbd2c5..94bb100 100644 --- a/2019/day9/Intcode.hs +++ b/2019/day9/Intcode.hs @@ -46,12 +46,6 @@ data TuringMachine = } deriving (Show) -data IntcodeExcept = - UnknownOpCodeException - deriving (Show) - -instance Exception IntcodeExcept - tapePreprocess :: Vector Integer -> Vector Integer tapePreprocess t = (V.++) t $ V.replicate 105 0 @@ -124,7 +118,7 @@ step tm = else 0) "9" -> tmn {pointerOffset = pointerOffset tm + (params ! 0)} "99" -> tm {state = Halt} - _ -> throw UnknownOpCodeException + _ -> error "Illegal Opcode." where pNew = pointer tm + opLength (tape tm ! fromInteger (pointer tm)) tmn = tm {pointer = pNew}