Ejemplo n.º 1
0
        private static int CalculateScoreAfterRemovingAWord(CrozzlePartial cp, Word removeWord)
        {
            int score = cp.GetScore();

            // reverse the process of adding a word
            score -= PublicInfo.GetPointsPerWord();
            for (int i = 0; i < cp.GetUsedWord().Count; i++)
            {
                if (!cp.GetUsedWord()[i].GetType().Equals(removeWord.GetType()) && CrozzleValidation.Crossing(cp.GetUsedWord()[i], removeWord))
                {
                    char crossingLetter = CrozzleValidation.GetCrossingLetter(cp.GetUsedWord()[i], removeWord);
                    score -= WordInfo.intersectingPointsPerLetter[crossingLetter];
                    score += WordInfo.nonIntersectingPointsPerLetter[crossingLetter];
                }
            }
            return(score);
        }
Ejemplo n.º 2
0
        private static bool CheckAllIntersections(List <Word> usedWord)
        {
            for (int i = 0; i < usedWord.Count; i++)
            {
                // calculate number of intersections
                int cross = 0;
                for (int j = 0; j < usedWord.Count; j++)
                {
                    if (!usedWord[i].GetType().Equals(usedWord[j].GetType()) && CrozzleValidation.Crossing(usedWord[i], usedWord[j]))
                    {
                        cross++;
                    }
                }

                // check intersection requirements
                if (cross == 0)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 3
0
        private void loadCrozzleczlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Title            = "Load Crozzle";
            dialog.Filter           = "czl file(*.czl)|*.czl";
            dialog.FilterIndex      = 2;
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string path = dialog.FileName;
                Error.InitializeErrorList();

                CrozzleGenerateFile boot = new CrozzleGenerateFile();
                boot.SetBoot(path);
                boot.SetColumns(path);
                boot.SetRows(path);
                if (!boot.GetPathHaveSet("CONFIGURATION_FILE"))
                {
                    MessageBox.Show("Can't find path of configuration file in the crozzle file", "ERROR");
                    return;
                }
                if (!boot.GetPathHaveSet("WORDLIST_FILE"))
                {
                    MessageBox.Show("Can't find path of word list file in the crozzle file", "ERROR");
                    return;
                }
                WebClient webClient = new WebClient();
                // Download Azure file. As the file referenced by the following URL has
                // an SAS (Shared Access Signature) end date of Oct 31, 23:59,
                // you cannot access this file after this end date.
                try
                {
                    string configurationTxt = boot.GetConfigurationFile();
                    webClient.DownloadFile(configurationTxt, "configuration.txt");
                    string wordListTxt = boot.GetWordListFile();
                    webClient.DownloadFile(wordListTxt, "wordList.txt");
                }
                catch (WebException)// wrong web connection
                {
                    MessageBox.Show("Internet connection fail");
                    return;
                }
                catch (ArgumentNullException)// url is null
                {
                    MessageBox.Show("url is null");
                    return;
                }
                catch (NotSupportedException)// write file error
                {
                    MessageBox.Show("fail to write file");
                    return;
                }

                Config configuration = new Config();
                configuration.SetConfig("configuration.txt");
                string intersectionsPerPoints    = configuration.GetIntersectingPointsPerLetter();
                string nonIntersectionsPerPoints = configuration.GetNonIntersectingPointsPerLetter();

                WordInfo wordlist = new WordInfo();
                wordlist.SetWordList("wordList.txt");
                wordlist.SetIntersectingPointsPerLetter(intersectionsPerPoints);
                wordlist.SetNonIntersectingPointsPerLetter(nonIntersectionsPerPoints);

                WordResult result = new WordResult();
                result.InitializeSetValue();
                result.SetRows(path);
                result.SetColumns(path);
                result.SetUsedWord(path);
                result.ValidateRowsColumns(configuration);

                CrozzleValidation crozzle = new CrozzleValidation();
                Log.AddLogInformation("crozzle validation : begin");
                crozzle.ValidateCrozzle(configuration, wordlist, result);
                crozzle.CheckGroup(configuration, result);
                Log.AddLogInformation("crozzle validation : end");
                List <string> crozzleError       = Error.GetCrozzleError();
                List <string> configurationError = Error.GetConfigurationError();
                List <string> crozzleFileError   = Error.GetCrozzleFileError();
                List <string> wordListError      = Error.GetWordListError();
                bool          error = false;
                // Set default value of uppercase: false
                bool uppercase = false;
                if (configuration.GetSetInformation("UPPERCASE"))
                {
                    uppercase = configuration.GetUppercase();
                }

                // Set default value for style
                string style = @"<style>table, td {border: 1px solid black;border - collapse: collapse;}td {width: 24px; text - align: center;}</ style > ";//default style value
                if (configuration.GetSetInformation("STYLE"))
                {
                    style = configuration.GetStyle();
                }

                // Display error information and stored in log file
                string errorHTML = @"<!DOCTYPE html>
                                <html>
                                <head></head><body><h3>file validation</h3>";
                if (configurationError.Count() != 0)
                {
                    error      = true;
                    errorHTML += "<p>configuration.txt</p>";
                    if (configurationError.Count() == 0)
                    {
                        errorHTML += "<p>configuration.txt: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>configuration.txt: invalid</p>";
                    }
                    for (int i = 0; i < configurationError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += configurationError[i];
                        errorHTML += @"</p>";
                    }
                }

                if (wordListError.Count() != 0)
                {
                    error      = true;
                    errorHTML += "<p>word list.txt</p>";
                    if (wordListError.Count() == 0)
                    {
                        errorHTML += "<p>wordlist.txt: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>wordlist.txt: invalid</p>";
                    }
                    for (int i = 0; i < wordListError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += wordListError[i];
                        errorHTML += @"</p>";
                    }
                }

                if (crozzleFileError.Count() != 0)
                {
                    error      = true;
                    errorHTML += "<p>crozzle.txt</p>";
                    if (crozzleFileError.Count() == 0)
                    {
                        errorHTML += "<p>crozzle.txt: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>crozzle.txt: invalid</p>";
                    }
                    for (int i = 0; i < crozzleFileError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += crozzleFileError[i];
                        errorHTML += @"</p>";
                    }
                }

                if (error == false)
                {
                    errorHTML += "<p>configuration.txt: valid</p><p>wordlist.txt: valid</p><p>crozzle.txt: valid</p>";
                }

                if (crozzleError.Count > 0)
                {
                    error      = true;
                    errorHTML += "<h3>crozzle validation</h3>";
                    if (crozzleError.Count() == 0)
                    {
                        errorHTML += "<p>crozzle: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>crozzle: invalid</p>";
                    }
                    for (int i = 0; i < crozzleError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += crozzleError[i];
                        errorHTML += @"</p>";
                    }
                }


                if (error == true)
                {
                    errorHTML += @"</body></html>";
                    ErrorBrowser.DocumentText = errorHTML;
                    FileStream   stream = new FileStream(configuration.GetLogfileName(), FileMode.Append);
                    StreamWriter writer = new StreamWriter(stream);
                    writer.WriteLine("\r\n\r\n==================begin test " + path + " " + DateTime.Now.ToString() + "==================");
                    List <string> logInfo = Log.GetLogInformation();
                    for (int i = 0; i < logInfo.Count; i++)
                    {
                        writer.WriteLine(logInfo[i]);
                    }
                    if (configurationError.Count() == 0)
                    {
                        writer.WriteLine("configuration.txt: valid");
                    }
                    else
                    {
                        writer.WriteLine("configuration.txt: invalid");
                    }
                    if (wordListError.Count() == 0)
                    {
                        writer.WriteLine("wordlist.txt: valid");
                    }
                    else
                    {
                        writer.WriteLine("wordlist.txt: invalid");
                    }
                    if (crozzleFileError.Count() == 0)
                    {
                        writer.WriteLine("crozzle.txt: valid");
                    }
                    else
                    {
                        writer.WriteLine("crozzle.txt: invalid");
                    }
                    if (crozzleError.Count() == 0)
                    {
                        writer.WriteLine("crozzle: valid");
                    }
                    else
                    {
                        writer.WriteLine("crozzle: invalid");
                    }
                    writer.WriteLine("errors:");
                    writer.WriteLine("files validation");
                    writer.WriteLine("configuration.txt");
                    for (int i = 0; i < configurationError.Count(); i++)
                    {
                        writer.WriteLine(configurationError[i]);
                    }
                    writer.WriteLine("wordlist.txt");
                    for (int i = 0; i < wordListError.Count(); i++)
                    {
                        writer.WriteLine(wordListError[i]);
                    }
                    writer.WriteLine("crozzle.txt");
                    for (int i = 0; i < crozzleFileError.Count(); i++)
                    {
                        writer.WriteLine(crozzleFileError[i]);
                    }
                    writer.WriteLine("crozzle validation");
                    for (int i = 0; i < crozzleError.Count(); i++)
                    {
                        writer.WriteLine(crozzleError[i]);
                    }

                    writer.WriteLine("==================end test " + path + "==================");
                    writer.Close();
                    stream.Close();
                }
                else
                {
                    ErrorBrowser.DocumentText = @"<p>All files valid</p><p>Crozzle valid</p><p>No error</p>";
                    FileStream   stream = new FileStream(configuration.GetLogfileName(), FileMode.Append);
                    StreamWriter writer = new StreamWriter(stream);
                    writer.WriteLine("\r\n\r\n==================begin test " + path + " " + DateTime.Now.ToString() + "==================");
                    List <string> logInfo = Log.GetLogInformation();
                    for (int i = 0; i < logInfo.Count; i++)
                    {
                        writer.WriteLine(logInfo[i]);
                    }
                    writer.WriteLine("configuration.txt: valid");
                    writer.WriteLine("wordlist.txt: valid");
                    writer.WriteLine("crozzle.txt: valid");
                    writer.WriteLine("crozzle: valid");
                    writer.WriteLine("NO ERROR");
                    writer.WriteLine("==================end test " + path + "==================");
                    writer.Close();
                    stream.Close();
                }

                // Display Crozzle
                int  rows        = result.GetRows();
                int  columns     = result.GetColumns();
                Grid crozzleGrid = new Grid(rows, columns, result.GetUsedWord());
                char[,] grid = crozzleGrid.GetGrid();
                String crozzleHTML = @"<!DOCTYPE html>
                                <html>
                                <head>" + style + @"</head><body><table>";

                for (int row = 0; row < rows; row++)
                {
                    String tr = "<tr>";
                    for (int column = 0; column < columns; column++)
                    {
                        if (grid[row, column].CompareTo('\0') != 0)
                        {
                            tr += @"<td style='background:" + configuration.GetBgcolourNonEmptyTD();
                            if (uppercase == true)
                            {
                                tr += "'>" + grid[row, column].ToString().ToUpper() + @"</td>";
                            }
                            if (uppercase == false)
                            {
                                tr += "'>" + grid[row, column].ToString().ToLower() + @"</td>";
                            }
                        }
                        else
                        {
                            tr += @"<td style='background:" + configuration.GetBgcolourEmptyTD();
                            if (uppercase == true)
                            {
                                tr += "'>" + grid[row, column].ToString().ToUpper() + @"</td>";
                            }
                            if (uppercase == false)
                            {
                                tr += "'>" + grid[row, column].ToString().ToLower() + @"</td>";
                            }
                        }
                    }
                    tr += "</tr>";

                    crozzleHTML += tr;
                }
                crozzleHTML += @"</table>";
                crozzleHTML += @"<br><p>score: ";

                if (error == true)
                {
                    crozzleHTML += configuration.GetInvalidCrozzleScore();
                }
                else
                {
                    result.CalculateScore(configuration.GetPointsPerWord());
                    crozzleHTML += result.GetScore();
                }
                crozzleHTML += "</p></body></html>";

                CrozzleBrowser.DocumentText = crozzleHTML;
            }
        }
Ejemplo n.º 4
0
        private void loadCrozzletxtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Log.RemoveLogInformation();
            Error.InitializeErrorList();
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Title            = "Load Crozzle";
            dialog.InitialDirectory = lastDirectory;
            dialog.Filter           = "text file(*.txt)|*.txt";
            dialog.FilterIndex      = 2;
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string path = dialog.FileName;
                lastDirectory = path;

                // Start loading files
                Boot boot = new Boot();
                boot.SetBoot(path);
                if (!boot.GetPathHaveSet("CONFIGURATION_FILE"))
                {
                    MessageBox.Show("Can't find path of configuration file in the crozzle file", "ERROR");
                    CrozzleBrowser.DocumentText = "Can't read file: please choose the correct crozzle file";
                    ErrorBrowser.DocumentText   = "Can't read file: please choose the correct crozzle file";
                    return;
                }
                if (!boot.GetPathHaveSet("WORDLIST_FILE"))
                {
                    MessageBox.Show("Can't find path of word list file in the crozzle file", "ERROR");
                    CrozzleBrowser.DocumentText = "Can't read file: please choose the correct crozzle file";
                    ErrorBrowser.DocumentText   = "Can't read file: please choose the correct crozzle file";
                    return;
                }
                string rootPath = boot.GetRootPath();
                Config config   = new Config();
                config.SetConfig(boot.GetConfigurationFile());
                config.ValidateConfig();
                config.SetLogfileName(config.ChangePath(config.GetLogfileName(), rootPath));
                bool error = false;

                WordInfo wordInfo = new WordInfo();
                wordInfo.SetWordList(boot.GetWordListFile());
                wordInfo.SetIntersectingPointsPerLetter(config.GetIntersectingPointsPerLetter());
                wordInfo.SetNonIntersectingPointsPerLetter(config.GetNonIntersectingPointsPerLetter());
                wordInfo.ValidateWordList(config);

                WordResult result = new WordResult();
                result.InitializeSetValue();
                result.SetRows(path);
                result.SetColumns(path);
                result.SetUsedWord(path);
                result.ValidateRowsColumns(config);
                List <Word> wordList = result.GetUsedWord();

                // Crozzle validation Start
                CrozzleValidation crozzle = new CrozzleValidation();
                Log.AddLogInformation("crozzle validation : begin");
                crozzle.ValidateCrozzle(config, wordInfo, result);
                crozzle.CheckGroup(config, result);
                Log.AddLogInformation("crozzle validation : end");
                List <string> crozzleError       = Error.GetCrozzleError();
                List <string> configurationError = Error.GetConfigurationError();
                List <string> crozzleFileError   = Error.GetCrozzleFileError();
                List <string> wordListError      = Error.GetWordListError();

                // Set default value of uppercase: false
                bool uppercase = false;
                if (config.GetSetInformation("UPPERCASE"))
                {
                    uppercase = config.GetUppercase();
                }

                // Set default value for style
                string style = @"<style>table, td {border: 1px solid black;border - collapse: collapse;}td {width: 24px; text - align: center;}</ style > ";//default style value
                if (config.GetSetInformation("STYLE"))
                {
                    style = config.GetStyle();
                }

                // Display error information and stored in log file
                string errorHTML = @"<!DOCTYPE html>
                                <html>
                                <head></head><body><h3>file validation</h3>";
                if (configurationError.Count() != 0)
                {
                    error      = true;
                    errorHTML += "<p>configuration.txt</p>";
                    if (configurationError.Count() == 0)
                    {
                        errorHTML += "<p>configuration.txt: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>configuration.txt: invalid</p>";
                    }
                    for (int i = 0; i < configurationError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += configurationError[i];
                        errorHTML += @"</p>";
                    }
                }

                if (wordListError.Count() != 0)
                {
                    error      = true;
                    errorHTML += "<p>word list.txt</p>";
                    if (wordListError.Count() == 0)
                    {
                        errorHTML += "<p>wordlist.txt: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>wordlist.txt: invalid</p>";
                    }
                    for (int i = 0; i < wordListError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += wordListError[i];
                        errorHTML += @"</p>";
                    }
                }

                if (crozzleFileError.Count() != 0)
                {
                    error      = true;
                    errorHTML += "<p>crozzle.txt</p>";
                    if (crozzleFileError.Count() == 0)
                    {
                        errorHTML += "<p>crozzle.txt: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>crozzle.txt: invalid</p>";
                    }
                    for (int i = 0; i < crozzleFileError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += crozzleFileError[i];
                        errorHTML += @"</p>";
                    }
                }

                if (error == false)
                {
                    errorHTML += "<p>configuration.txt: valid</p><p>wordlist.txt: valid</p><p>crozzle.txt: valid</p>";
                }

                if (crozzleError.Count > 0)
                {
                    error      = true;
                    errorHTML += "<h3>crozzle validation</h3>";
                    if (crozzleError.Count() == 0)
                    {
                        errorHTML += "<p>crozzle: valid</p>";
                    }
                    else
                    {
                        errorHTML += "<p>crozzle: invalid</p>";
                    }
                    for (int i = 0; i < crozzleError.Count(); i++)
                    {
                        errorHTML += @"<p>error";
                        errorHTML += (i + 1);
                        errorHTML += @": ";
                        errorHTML += crozzleError[i];
                        errorHTML += @"</p>";
                    }
                }


                if (error == true)
                {
                    errorHTML += @"</body></html>";
                    ErrorBrowser.DocumentText = errorHTML;
                    FileStream   stream = new FileStream(config.GetLogfileName(), FileMode.Append);
                    StreamWriter writer = new StreamWriter(stream);
                    writer.WriteLine("\r\n\r\n==================begin test " + path + " " + DateTime.Now.ToString() + "==================");
                    List <string> logInfo = Log.GetLogInformation();
                    for (int i = 0; i < logInfo.Count; i++)
                    {
                        writer.WriteLine(logInfo[i]);
                    }
                    if (configurationError.Count() == 0)
                    {
                        writer.WriteLine("configuration.txt: valid");
                    }
                    else
                    {
                        writer.WriteLine("configuration.txt: invalid");
                    }
                    if (wordListError.Count() == 0)
                    {
                        writer.WriteLine("wordlist.txt: valid");
                    }
                    else
                    {
                        writer.WriteLine("wordlist.txt: invalid");
                    }
                    if (crozzleFileError.Count() == 0)
                    {
                        writer.WriteLine("crozzle.txt: valid");
                    }
                    else
                    {
                        writer.WriteLine("crozzle.txt: invalid");
                    }
                    if (crozzleError.Count() == 0)
                    {
                        writer.WriteLine("crozzle: valid");
                    }
                    else
                    {
                        writer.WriteLine("crozzle: invalid");
                    }
                    writer.WriteLine("errors:");
                    writer.WriteLine("files validation");
                    writer.WriteLine("configuration.txt");
                    for (int i = 0; i < configurationError.Count(); i++)
                    {
                        writer.WriteLine(configurationError[i]);
                    }
                    writer.WriteLine("wordlist.txt");
                    for (int i = 0; i < wordListError.Count(); i++)
                    {
                        writer.WriteLine(wordListError[i]);
                    }
                    writer.WriteLine("crozzle.txt");
                    for (int i = 0; i < crozzleFileError.Count(); i++)
                    {
                        writer.WriteLine(crozzleFileError[i]);
                    }
                    writer.WriteLine("crozzle validation");
                    for (int i = 0; i < crozzleError.Count(); i++)
                    {
                        writer.WriteLine(crozzleError[i]);
                    }

                    writer.WriteLine("==================end test " + path + "==================");
                    writer.Close();
                    stream.Close();
                }
                else
                {
                    ErrorBrowser.DocumentText = @"<p>All files valid</p><p>Crozzle valid</p><p>No error</p>";
                    FileStream   stream = new FileStream(config.GetLogfileName(), FileMode.Append);
                    StreamWriter writer = new StreamWriter(stream);
                    writer.WriteLine("\r\n\r\n==================begin test " + path + " " + DateTime.Now.ToString() + "==================");
                    List <string> logInfo = Log.GetLogInformation();
                    for (int i = 0; i < logInfo.Count; i++)
                    {
                        writer.WriteLine(logInfo[i]);
                    }
                    writer.WriteLine("configuration.txt: valid");
                    writer.WriteLine("wordlist.txt: valid");
                    writer.WriteLine("crozzle.txt: valid");
                    writer.WriteLine("crozzle: valid");
                    writer.WriteLine("NO ERROR");
                    writer.WriteLine("==================end test " + path + "==================");
                    writer.Close();
                    stream.Close();
                }

                // Display Crozzle
                int  rows        = result.GetRows();
                int  columns     = result.GetColumns();
                Grid crozzleGrid = new Grid(rows, columns, wordList);
                char[,] grid = crozzleGrid.GetGrid();
                String crozzleHTML = @"<!DOCTYPE html>
                                <html>
                                <head>" + style + @"</head><body><table>";

                for (int row = 0; row < rows; row++)
                {
                    String tr = "<tr>";
                    for (int column = 0; column < columns; column++)
                    {
                        if (grid[row, column].CompareTo('\0') != 0)
                        {
                            tr += @"<td style='background:" + config.GetBgcolourNonEmptyTD();
                            if (uppercase == true)
                            {
                                tr += "'>" + grid[row, column].ToString().ToUpper() + @"</td>";
                            }
                            if (uppercase == false)
                            {
                                tr += "'>" + grid[row, column].ToString().ToLower() + @"</td>";
                            }
                        }
                        else
                        {
                            tr += @"<td style='background:" + config.GetBgcolourEmptyTD();
                            if (uppercase == true)
                            {
                                tr += "'>" + grid[row, column].ToString().ToUpper() + @"</td>";
                            }
                            if (uppercase == false)
                            {
                                tr += "'>" + grid[row, column].ToString().ToLower() + @"</td>";
                            }
                        }
                    }
                    tr += "</tr>";

                    crozzleHTML += tr;
                }
                crozzleHTML += @"</table>";
                crozzleHTML += @"<br><p>score: ";

                if (error == true)
                {
                    crozzleHTML += config.GetInvalidCrozzleScore();
                }
                else
                {
                    result.CalculateScore(config.GetPointsPerWord());
                    crozzleHTML += result.GetScore();
                }
                crozzleHTML += "</p></body></html>";

                CrozzleBrowser.DocumentText = crozzleHTML;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Local method of calculating groups
        /// </summary>
        /// <param name="usedWordList">List of words</param>
        /// <returns>number of groups</returns>
        private static int CalculateGroup(List <Word> usedWordList)
        {
            int         groupNumber = 0;
            List <Word> usedWord    = new List <Word>();

            for (int index = 0; index < usedWordList.Count(); index++)
            {
                usedWord.Add(usedWordList[index]);
            }

            // Calculate group numbers
            while (usedWord.Count() != 0)
            {
                List <Word>  group = new List <Word>();
                Queue <Word> next  = new Queue <Word>();
                next.Enqueue(usedWord[0]);
                group.Add(usedWord[0]);
                usedWord.Remove(usedWord[0]);
                while (next.Count() > 0)
                {
                    Queue <Word> vertical   = new Queue <Word>();
                    Queue <Word> horizontal = new Queue <Word>();
                    Word[]       temp_array = next.ToArray();
                    for (int index = 0; index < next.Count(); index++)
                    {
                        if (temp_array[index].GetType().Equals("ROW"))
                        {
                            horizontal.Enqueue(temp_array[index]);
                        }
                        else
                        {
                            vertical.Enqueue(temp_array[index]);
                        }
                    }
                    int queueLength = next.Count();
                    for (int index = 0; index < usedWord.Count(); index++)
                    {
                        if (usedWord[index].GetType().Equals("ROW"))
                        {
                            if (CrozzleValidation.Crossing(usedWord[index], vertical))
                            {
                                next.Enqueue(usedWord[index]);
                                group.Add(usedWord[index]);
                                usedWord.Remove(usedWord[index--]);
                            }
                        }
                        else
                        {
                            if (CrozzleValidation.Crossing(usedWord[index], horizontal))
                            {
                                next.Enqueue(usedWord[index]);
                                group.Add(usedWord[index]);
                                usedWord.Remove(usedWord[index--]);
                            }
                        }
                    }
                    for (int index = 0; index < queueLength; index++)
                    {
                        next.Dequeue();
                    }
                }
                groupNumber++;
            }
            return(groupNumber);
        }