예제 #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);
 }