/// <summary>
        /// Function checking whether two words are finishing computations in the same state
        /// </summary>
        /// <param name="automata"></param>
        /// <param name="word1"></param>
        /// <param name="word2"></param>
        /// <returns></returns>
        public static bool AreWordsRelated(Automat automata, List<int> word1, List<int> word2)
        {
            int numberOfStates = automata.getStatesNumber();
            List<int[]> transitionTableList = new List<int[]>();
            transitionTableList = automata.getTransitionTableList();
            int word1Length = word1.Count;
            int word2Length = word2.Count;

            int currentState1 = 0, currentState2 = 0;

            int[] transitionTable;
            for (int i = 0; i < word1Length; i++)
            {
                transitionTable = transitionTableList[word1[i]];
                for (int j = 0; j < numberOfStates; j++)
                {
                    if (transitionTable[currentState1] == j)
                    {
                        currentState1 = j;
                        break;
                    }
                }
            }
            for (int i = 0; i < word2Length; i++)
            {
                transitionTable = transitionTableList[word2[i]];
                for (int j = 0; j < numberOfStates; j++)
                {
                    if (transitionTable[currentState2] == j)
                    {
                        currentState2 = j;
                        break;
                    }
                }
            }

            return (currentState1 == currentState2);
        }
        /// <summary>
        /// Function returning the state at which the computations will end after reading all word
        /// </summary>
        /// <param name="automata"></param>
        /// <param name="word"></param>
        /// <returns></returns>
        public static int WordComputationFinishingState(Automat automata, List<int> word)
        {
            int numberOfStates = automata.getStatesNumber();
               List<int[]> transitionTableList = new List<int[]>();
               transitionTableList = automata.getTransitionTableList();
               int word1Length = word.Count;

               int currentState1 = 0;

               int[] transitionTable;
               for (int i = 0; i < word1Length; i++)
               {
               transitionTable = transitionTableList[word[i]];
               for (int j = 0; j < numberOfStates; j++)
               {
                   if (transitionTable[currentState1] == j)
                   {
                       currentState1 = j;
                       break;
                   }
               }
               }

               return currentState1;
        }
        public String prepareStringToWynik(Automat solucja)
        {
         
            String tmpString = "";
            tmpString = tmpString + solucja.getStatesNumber() + "," + solucja.getAlphabetLength();
            List<int[]> transitionList = solucja.getTransitionTableList();


            for (int x = 0; x < solucja.getStatesNumber(); x++)
            {
                for (int y = 0; y < solucja.getAlphabetLength(); y++)
                {
                    tmpString = tmpString + "," + (transitionList[y][x] + 1);
                }
            }
            return tmpString;
        }
        List<int>[][] doWydruku(Automat wynik)
        {
            int wymiar = wynik.getStatesNumber();

            List<int>[][] macierz = new List<int>[wymiar][];
            for (int i = 0; i < wymiar; i++)
            {
                List<int>[] tmp = new List<int>[wymiar];
                for (int j = 0; j < wymiar; j++)
                {
                    tmp[j] = new List<int>();
                }
                macierz[i] = tmp;
            }



            for (int i = 0; i < wynik.getAlphabetLength(); i++)
            {
                int[] transition = wynik.getTransitionTableList()[i];
                for (int y = 0; y < wynik.getStatesNumber(); y++)
                {
                    for (int x = 0; x < wynik.getStatesNumber(); x++)
                    {
                        if (transition[x] == y)
                        {
                            macierz[x][y].Add(i);
                        }
                    }
                }
            }

            return macierz;
        }