示例#1
0
        private void DebugStep(BrainfuckDebugger intptr)
        {
            Console.Write("Choose Action: ");
            foreach (var action in this.debugActions)
            {
                Console.Write($"[{action.Key}] = {action.Name} | ");
            }

            var key         = ConsumeConsoleKey().Key;
            var debugAction = this.debugActions.FirstOrDefault(action => action.Key == key) ?? this.debugActions[0];

            debugAction.Action(intptr);
        }
示例#2
0
        public void Run(string source)
        {
            var intptr = new BrainfuckDebugger(source.Trim(), new byte[64]);

            intptr.Output = new StringWriter();

            while (!intptr.Terminated)
            {
                this.DebugDump(intptr);
                this.DebugStep(intptr);
            }

            this.DebugDump(intptr);
            Console.WriteLine("Press any key to exit");
            ConsumeConsoleKey();
        }
示例#3
0
 private void DebugDump(BrainfuckDebugger intptr)
 {
     intptr.DebugDump();
     Console.WriteLine(intptr.Output);
 }