public override void Do(RamMachineCommand command, IRamMachine ram) { var splited = RamMachineHelper.SplitToPreArgument(command.Argument); int val = int.Parse(splited.argument); switch (splited.pre) { case null: ram.Set(val, ram.Get(0)); break; case '*': ram.Set((int)ram.Get((int)val), ram.Get(0)); break; } }
public static void DoWithDeepLv(string argument, Action <IRamMachine, long> action, IRamMachine ram) { var splited = SplitToPreArgument(argument); int value = int.Parse(splited.argument); switch (splited.pre) { case '=': action(ram, value); break; case null: action(ram, ram.Get(value)); break; case '^': case '*': action(ram, ram.Get((int)ram.Get((int)value))); break; } }
public override void Do(RamMachineCommand command, IRamMachine ram) { if (func(ram.Get(0))) { ram.Jump(command.Argument); } }