private void FillMatrixByWord(SimpleTerm term, int i)
        {
            List <int> indexesOfLetters = new List <int>();

            for (int ind = 0; ind < term.Word.Length; ind++)
            {
                if (char.ToLower(term.Word[ind]) == char.ToLower(_mainWord.Word[i - 1]))
                {
                    indexesOfLetters.Add(ind);
                }
            }

            int index = -1;

            if (indexesOfLetters.Count > 0)
            {
                index = indexesOfLetters[GetRandom(indexesOfLetters.Count)];
            }

            if (index >= 0)
            {
                int length = term.Word.Length;
                for (int k = 0; k < length; k++)
                {
                    _preparingMatrix[i - 1, k + MainWordHorizontalIndex - index] = new LetterFromWord(term.Word[k], term);
                }
            }
        }
        private void PrepareGame()
        {
            if (List.Count > 0)
            {
                ChooseRandomMainWord();
                if (_mainWord != null)
                {
                    _verticalSize           = _mainWord.Word.Length;
                    _horizontalSize         = _maxLength * 2 + 1;
                    CrossWordTerms          = new SimpleTerm[_verticalSize + 1];
                    CrossWordTerms[0]       = _mainWord;
                    MainWordHorizontalIndex = _maxLength + 1;
                    _preparingMatrix        = new LetterFromWord[_verticalSize, _horizontalSize];
                    for (int i = 0; i < _verticalSize; i++)
                    {
                        _preparingMatrix[i, MainWordHorizontalIndex] = new LetterFromWord(_mainWord.Word[i], _mainWord);
                    }

                    int count = 0;
                    while (count < _verticalSize)
                    {
                        int rand = GetRandom(_verticalSize) + 1;
                        if (CrossWordTerms[rand] == null)
                        {
                            if (_mainWord.Word[rand - 1] != ' ')
                            {
                                TryAddWordToCrossword(rand);
                            }
                            count++;
                        }
                    }

                    PerformMatrix();
                    IsReady = true;
                }
            }
        }