예제 #1
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;
            }
        }
예제 #2
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;
            }
        }
예제 #3
0
        private void CreateCrozzle()
        {
            Config configuration = new Config();

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

            InitializePublicInfo(configuration);

            WordInfo wordlist = new WordInfo();

            wordlist.SetWordList("wordList.txt");
            wordlist.SetIntersectingPointsPerLetter(intersectionsPerPoints);
            wordlist.SetNonIntersectingPointsPerLetter(nonIntersectionsPerPoints);
            List <string> wlist = wordlist.GetWordList();


            // preprocess wordlist
            SIT323Crozzle.CreateCrozzle.SetPotentialValue(wlist, wordlist.GetIntersectingPointsPerLetter(), wordlist.GetNonIntersectingPointsPerLetter());
            string initialWordContent = PreProcess(wlist);

            // get initial crozzle
            CrozzlePartial initialCrozzle = GenerateInitialCrozzle(initialWordContent, wlist);

            aTimer.Start();
            SIT323Crozzle.CreateCrozzle.GenerateCrozzle(initialCrozzle);
            CrozzlePartial goodCrozzle = SIT323Crozzle.CreateCrozzle.GetBestCrozzle();

            aTimer.Stop();

            // get grid and show crozzle
            string style       = configuration.GetStyle();
            bool   uppercase   = configuration.GetUppercase();
            Grid   crozzleGrid = goodCrozzle.GetGrid();

            char[,] largeGrid = crozzleGrid.GetGrid();
            char[,] grid      = new char[PublicInfo.GetRows(), PublicInfo.GetColumns()];
            for (int i = 0; i < PublicInfo.GetRows(); i++)
            {
                for (int j = 0; j < PublicInfo.GetColumns(); j++)
                {
                    if (i + goodCrozzle.GetMinHeight() <= goodCrozzle.GetMaxHeight() && j + goodCrozzle.GetMinWidth() <= goodCrozzle.GetMaxWidth())
                    {
                        grid[i, j] = largeGrid[i + goodCrozzle.GetMinHeight(), j + goodCrozzle.GetMinWidth()];
                    }
                }
            }
            String crozzleHTML = @"<!DOCTYPE html>
                                <html>
                                <head>" + style + @"</head><body><table>";

            for (int row = 0; row < PublicInfo.GetRows(); row++)
            {
                String tr = "<tr>";
                for (int column = 0; column < PublicInfo.GetColumns(); 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 += "<p>score: ";
            crozzleHTML += goodCrozzle.GetScore();
            crozzleHTML += "</p>";
            crozzleHTML += "</body></html>";
            CrozzleBrowser.DocumentText = crozzleHTML;
            ErrorBrowser.DocumentText   = " ";
        }