Example #1
0
        public static Automaton <String> begintMetABBEnBevatBAAB()
        {
            char[]             alphabet = { 'a', 'b' };
            Automaton <String> m        = new Automaton <String>(alphabet);

            m.AddTransition(new Transition <String>("q1", 'a', "q6"));
            m.AddTransition(new Transition <String>("q1", 'b', "q22"));

            m.AddTransition(new Transition <String>("q2", 'a', "q8"));
            m.AddTransition(new Transition <String>("q2", 'b', "q22"));

            m.AddTransition(new Transition <String>("q3", 'a', "q9"));
            m.AddTransition(new Transition <String>("q3", 'b', "q22"));

            m.AddTransition(new Transition <String>("q4", 'a', "q6"));
            m.AddTransition(new Transition <String>("q4", 'b', "q25"));

            m.AddTransition(new Transition <String>("q5", 'a', "q10"));
            m.AddTransition(new Transition <String>("q5", 'b', "q25"));

            m.AddTransition(new Transition <String>("q6", 'a', "q21"));
            m.AddTransition(new Transition <String>("q6", 'b', "q12"));

            m.AddTransition(new Transition <String>("q7", 'a', "q23"));
            m.AddTransition(new Transition <String>("q7", 'b', "q12"));

            m.AddTransition(new Transition <String>("q8", 'a', "q24"));
            m.AddTransition(new Transition <String>("q8", 'b', "q12"));

            m.AddTransition(new Transition <String>("q9", 'a', "q21"));
            m.AddTransition(new Transition <String>("q9", 'b', "q15"));

            m.AddTransition(new Transition <String>("q10", 'a', "q25"));
            m.AddTransition(new Transition <String>("q10", 'b', "q15"));

            m.AddTransition(new Transition <String>("q11", 'a', "q21"));
            m.AddTransition(new Transition <String>("q11", 'b', "q17"));

            m.AddTransition(new Transition <String>("q12", 'a', "q23"));
            m.AddTransition(new Transition <String>("q12", 'b', "q17"));

            m.AddTransition(new Transition <String>("q13", 'a', "q24"));
            m.AddTransition(new Transition <String>("q13", 'b', "q17"));

            m.AddTransition(new Transition <String>("q14", 'a', "q21"));
            m.AddTransition(new Transition <String>("q14", 'b', "q20"));

            m.AddTransition(new Transition <String>("q15", 'a', "q25"));
            m.AddTransition(new Transition <String>("q15", 'b', "q20"));

            m.AddTransition(new Transition <String>("q16", 'a', "q16"));
            m.AddTransition(new Transition <String>("q16", 'b', "q17"));

            m.AddTransition(new Transition <String>("q17", 'a', "q18"));
            m.AddTransition(new Transition <String>("q17", 'b', "q17"));

            m.AddTransition(new Transition <String>("q18", 'a', "q19"));
            m.AddTransition(new Transition <String>("q18", 'b', "q17"));

            m.AddTransition(new Transition <String>("q19", 'a', "q16"));
            m.AddTransition(new Transition <String>("q19", 'b', "q20"));

            m.AddTransition(new Transition <String>("q20", 'a', "q20"));
            m.AddTransition(new Transition <String>("q20", 'b', "q20"));

            m.AddTransition(new Transition <String>("q21", 'a', "q21"));
            m.AddTransition(new Transition <String>("q21", 'b', "q22"));

            m.AddTransition(new Transition <String>("q22", 'a', "q23"));
            m.AddTransition(new Transition <String>("q22", 'b', "q22"));

            m.AddTransition(new Transition <String>("q23", 'a', "q24"));
            m.AddTransition(new Transition <String>("q23", 'b', "q22"));

            m.AddTransition(new Transition <String>("q24", 'a', "q21"));
            m.AddTransition(new Transition <String>("q24", 'b', "q25"));

            m.AddTransition(new Transition <String>("q25", 'a', "q25"));
            m.AddTransition(new Transition <String>("q25", 'b', "q25"));

            m.DefineAsStartState("q1");

            m.DefineAsFinalState("q20");

            return(m);
        }