public static void NombreImpairEnBinaire() { uint[,] S = { { 0, 1 }, { 0, 1 } }; bool[] F = { false, true }; /* L'automate A dit si le nombre écrit en binaire est impair. */ AchaAutomateDeterministe A = new AchaAutomateDeterministe(2, 2, 0, F, S); uint[] Word; Word = new uint[4]; Word[0] = 1; Word[1] = 0; Word[2] = 0; Word[3] = 1; Console.WriteLine("9 : 1001 : {0}", A.RunOnWordAndGetIfFinal(Word)); Word = new uint[4]; Word[0] = 1; Word[1] = 0; Word[2] = 0; Word[3] = 0; Console.WriteLine("8 : 1000 : {0}", A.RunOnWordAndGetIfFinal(Word)); Word = new uint[2]; Word[0] = 1; Word[1] = 1; Console.WriteLine("3 : 11 : {0}", A.RunOnWordAndGetIfFinal(Word)); Word = new uint[0]; Console.WriteLine("0 : [empty word] : {0}", A.RunOnWordAndGetIfFinal(Word)); }
public AchaAutomateDeterministeWithState(AchaAutomateDeterministe Definition) { /* Builds an automata with state from an automaton definition. */ this.Definition = Definition; InitState(); }