예제 #1
0
            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;
                }
            }
예제 #2
0
        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;
            }
        }
예제 #3
0
 public override void Do(RamMachineCommand command, IRamMachine ram)
 {
     if (func(ram.Get(0)))
     {
         ram.Jump(command.Argument);
     }
 }