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