Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
 private void DebugDump(BrainfuckDebugger intptr)
 {
     intptr.DebugDump();
     Console.WriteLine(intptr.Output);
 }