Exemplo n.º 1
0
            private void HandleSubInput(AutomateStruct automate)
            {
                var  dfa     = NdfatoDfa.MakeDfa(automate.automaat);
                bool running = true;

                while (running)
                {
                    Console.Clear();
                    Console.WriteLine($"gekozen: {automate.text} \n");
                    subsubtext.ToList().ForEach(s => Console.WriteLine(s));

                    int input = GetInput(subsubtext.Length);

                    switch (input)
                    {
                    case 0:
                        Graphviz.PrintGraph(automate.automaat, "test");
                        break;

                    case 1:
                        Graphviz.PrintGraph(dfa, "test");
                        break;

                    case 2:
                        Graphviz.PrintGraph(dfa.MinimizeHopCroft(false), "test");
                        break;

                    case 3:
                        Console.WriteLine($"typ woord: \ntoegestane symbolen: ");
                        automate.automaat._symbols.ToList().ForEach(c => Console.WriteLine(c));
                        var woord = Console.ReadLine();
                        if (NdfatoDfa.MakeDfa(automate.automaat).Accepteer(woord))
                        {
                            Console.WriteLine("Het ingevoerde woord wordt geaccepteerd door het automaat");
                        }
                        else
                        {
                            Console.WriteLine("Het ingevoerde woord wordt niet geaccepteerd door het automaat");
                        }
                        Console.ReadLine();
                        break;

                    case 4:
                        running = false;
                        automates.Clear();
                        break;
                    }
                }
            }
Exemplo n.º 2
0
            private void HandleSubMenu(AutomateStruct automaat)
            {
                bool running = true;

                while (running)
                {
                    Console.Clear();
                    Console.WriteLine($"{automaat.text} gekozen \nKies een actie");
                    actions.ToList().ForEach(s => Console.WriteLine(s));
                    int input = GetInput(actions.Length);

                    switch (input)
                    {
                    case 0:
                        automaat.automaat.ViewImage();
                        break;

                    case 1:
                        Console.Clear();
                        Console.WriteLine("laatste minimalisatie tabel: \t druk op enter om het bijbehorende automaat te zien");
                        var minimizedh = automaat.automaat.MinimizeHopCroft(true);
                        Console.ReadLine();
                        minimizedh.ViewImage();
                        break;

                    case 2:
                        var minimizedr = automaat.automaat.MinimizeReverse();
                        minimizedr.ViewImage();
                        break;

                    case 3:
                        running = false;
                        automates.Clear();
                        break;
                    }
                }
            }