static int Main(string[] args) { SetWindowPos(MyConsole, 0, 0, 0, 0, 0, SWP_NOSIZE); Console.Clear(); Console.Title = appTitle; Console.SetWindowSize(Console.LargestWindowWidth - 3, Console.LargestWindowHeight); try { if (args.Length >= 1) { if (args[0] == "-diagram") { //this will launch the default browser Process p = new Process() { StartInfo = new ProcessStartInfo(new FastTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, "").DiagramUrl) }; p.Start(); return(0); } } var inp = initInput(); initMode(); Console.Clear(); Console.CursorVisible = false; switch (_stepMode) { case StepModeEnum.Slow: tm = new SlowTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, inp); break; default: case StepModeEnum.Normal: tm = new NormalTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, inp, _timeOut); break; case StepModeEnum.Fast: tm = new FastTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, inp); break; } tm.Print(); Console.ReadLine(); try { Console.Title = appTitle + " - running"; Stopwatch sw = new Stopwatch(); sw.Start(); while (tm.MakeStep()) { } sw.Stop(); Console.Title = appTitle; tm.Print(); if (_stepMode == StepModeEnum.Fast) { Tools.WriteTime(sw.Elapsed, tm.TapeAmount); } Tools.WriteResult(tm.TapeAmount, tm.Output.Replace("B", " ").Trim()); } catch (Exception e) { Tools.WriteError(0, 0, e); } } catch (Exception e) { Tools.WriteError(0, 0, e); } Console.ReadLine(); Console.CursorVisible = true; return(0); }
static int Main(string[] args) { SetWindowPos(MyConsole, 0, 0, 0, 0, 0, SWP_NOSIZE); Console.Clear(); Console.Title = appTitle; Console.SetWindowSize(Console.LargestWindowWidth - 3, Console.LargestWindowHeight); try { if (args.Length >= 1) { if (args[0] == "-diagram") { //this will launch the default browser Process p = new Process() { StartInfo = new ProcessStartInfo(new FastTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, "").DiagramUrl) }; p.Start(); return 0; } } var inp = initInput(); initMode(); Console.Clear(); Console.CursorVisible = false; switch (_stepMode) { case StepModeEnum.Slow: tm = new SlowTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, inp); break; default: case StepModeEnum.Normal: tm = new NormalTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, inp, _timeOut); break; case StepModeEnum.Fast: tm = new FastTuringMachine(Conf.Q, Conf.E, Conf.T, Conf.Fn, Conf.S, Conf.F, inp); break; } tm.Print(); Console.ReadLine(); try { Console.Title = appTitle + " - running"; Stopwatch sw = new Stopwatch(); sw.Start(); while (tm.MakeStep()) { } sw.Stop(); Console.Title = appTitle; tm.Print(); if (_stepMode == StepModeEnum.Fast) Tools.WriteTime(sw.Elapsed, tm.TapeAmount); Tools.WriteResult(tm.TapeAmount, tm.Output.Replace("B", " ").Trim()); } catch (Exception e) { Tools.WriteError(0, 0, e); } } catch (Exception e) { Tools.WriteError(0, 0, e); } Console.ReadLine(); Console.CursorVisible = true; return 0; }