예제 #1
0
        public static void Run(string program, Func <int> read, Action <char> write, int memorySize = 30000)
        {
            var vm = new VirtualMachine(program, memorySize);

            BrainfuckBasicCommands.RegisterTo(vm, read, write);
            BrainfuckLoopCommands.RegisterTo(vm);
            vm.Run();
        }
        private IVirtualMachine Vm(string program, int memorySize = 10)
        {
            var vm = new VirtualMachine(program, memorySize);

            BrainfuckBasicCommands.RegisterTo(vm, () => - 1, c => { });
            BrainfuckLoopCommands.RegisterTo(vm);
            vm.Run();
            return(vm);
        }
예제 #3
0
 public VmBuilder AddBasicCommands(Func <int> read, Action <char> write)
 {
     modifications.Add(delegate { BrainfuckBasicCommands.RegisterTo(vm, read, write); });
     return(this);
 }