public long GetLiteral(Punchcard pc) { if (Mode == Mode.Position || Mode == Mode.Immediate) { return(Value); } else { return(RelativeBase + Value); } }
public long GetResult(Punchcard pc) { switch (Mode) { case Mode.Position: return(pc.GetAddress(Value)); case Mode.Immediate: return(Value); case Mode.Relative: int newAdd = RelativeBase + (int)Value; return(pc.GetAddress(newAdd)); default: return(-999); } }
public IntCodeComputer(List <long> instructions) { Pointer = 0; PC = new Punchcard(instructions); }