public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false)
        {
            StringBuilder builder   = new StringBuilder();
            HtmlGenerator generator = new HtmlGenerator();

            if (!isFragment)
            {
                generator.AppendHtmlHeader(builder);
            }

            builder.AppendLine(INSTRUCTIONS);
            builder.AppendLine(
                $"<br />1. Cut out each tent. <br/>{CreateImageTagForJpg(@"C:\Users\Chip\Documents\WordPuzzle3\WordPuzzlesTest\html\WordTents\images\instructions-a.jpg", 266, 183)}");
            builder.AppendLine(
                $"<br />2. Cut out squares marked with scissors. <br/>{CreateImageTagForJpg(@"C:\Users\Chip\Documents\WordPuzzle3\WordPuzzlesTest\html\WordTents\images\instructions-b.jpg", 291, 213)}");
            builder.AppendLine(
                $"<br />3. Fold each tent at the center line. <br/>{CreateImageTagForJpg(@"C:\Users\Chip\Documents\WordPuzzle3\WordPuzzlesTest\html\WordTents\images\instructions-c.jpg", 244, 101)}");

            AppendTentTable(builder);

            if (includeSolution)
            {
                AppendSolution(builder);
            }
            if (!isFragment)
            {
                generator.AppendHtmlFooter(builder);
            }

            return(builder.ToString());
        }
Example #2
0
        public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false)
        {
            HtmlGenerator generator = new HtmlGenerator();
            var           builder   = new StringBuilder();

            if (!isFragment)
            {
                generator.AppendHtmlHeader(builder);
            }

            builder.AppendLine("<p><h2>Instructions</h2>");
            builder.AppendLine(INSTRUCTIONS);
            //List words
            builder.AppendLine("<p><h2>List of clues</h2>");
            builder.AppendLine("<table>");
            DisplayListOfClues(includeSolution, builder);
            builder.AppendLine("</table>");
            //Show puzzle.
            builder.AppendLine("<p><h2>List of words</h2>");
            builder.AppendLine("<table>");
            DisplayListOfWords(includeSolution, builder);
            builder.AppendLine("</table>");

            if (!isFragment)
            {
                generator.AppendHtmlFooter(builder);
            }
            return(builder.ToString());
        }
Example #3
0
        public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false)
        {
            PreparePuzzle();
            StringBuilder builder = new StringBuilder();

            if (!isFragment)
            {
                HtmlGenerator.AppendHtmlHeader(builder);
            }

            builder.AppendLine("<!--StartFragment-->");

            builder.AppendLine("Fill in the blanks below based on the clues. ");

            AppendCluesTable(builder, includeSolution);


            builder.AppendLine("<p/>Then copy the letters to the grid below, using the numbers as a guide. ");
            AppendEncodedMessageTable(builder, includeSolution);


            builder.AppendLine("<!--EndFragment-->");
            if (!isFragment)
            {
                HtmlGenerator.AppendHtmlFooter(builder);
            }

            return(builder.ToString());
        }
Example #4
0
        public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false)
        {
            StringBuilder builder = new StringBuilder();

            if (!isFragment)
            {
                _htmlGenerator.AppendHtmlHeader(builder);
            }

            builder.AppendLine(GetInstructions());

            if (SubPuzzles == null)
            {
                AppendPuzzleTable(includeSolution, builder);
            }
            else
            {
                foreach (var subPuzzle in SubPuzzles)
                {
                    subPuzzle.AppendPuzzleTable(includeSolution, builder);
                }
            }

            if (!isFragment)
            {
                _htmlGenerator.AppendHtmlFooter(builder);
            }

            return(builder.ToString());
        }
        public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false)
        {
            StringBuilder builder = new StringBuilder();

            if (!isFragment)
            {
                _htmlGenerator.AppendHtmlHeader(builder);
            }

            builder.AppendLine("<!--StartFragment-->");
            builder.AppendLine(@"Fill in the words below (one letter per box) based on the clues. ");
            builder.AppendLine("Starting in the top left box, follow the direction (e.g. three spaces to the right) to find the next letter. ");
            builder.AppendLine(@"<table border=""1"">");
            for (int row = 0; row < Size; row++)
            {
                builder.AppendLine("<tr>");
                StringBuilder wordRow = new StringBuilder();
                for (int column = 0; column < Size; column++)
                {
                    wordRow.Append(GetCellAtCoordinates(row, column).Letter);
                }

                string clueForThisRow = $@"Clue for {wordRow}";
                if (!string.IsNullOrWhiteSpace(_clues[row]))
                {
                    clueForThisRow = _clues[row];
                }
                builder.AppendLine(@"    <td width=""250"">" + clueForThisRow + @"</td>");

                for (int column = 0; column < Size; column++)
                {
                    builder.AppendLine($@"    <td width=""20""><sup>{GetCellAtCoordinates(row, column)}</sup><br/>&nbsp;</td>");
                }
                builder.AppendLine("</tr>");
            }
            builder.AppendLine("</table>");
            builder.Append("<h2>");
            builder.Append("Solution: ");
            for (var index = 0; index < _solution.Length; index++)
            {
                builder.Append("_ ");
            }
            builder.Append("</h2>");

            builder.AppendLine();
            builder.AppendLine("<!--EndFragment-->");
            if (!isFragment)
            {
                _htmlGenerator.AppendHtmlFooter(builder);
            }

            return(builder.ToString());
        }
        public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false)
        {
            var builder = new StringBuilder();

            _htmlGenerator = new HtmlGenerator();

            if (!isFragment)
            {
                _htmlGenerator.AppendHtmlHeader(builder);
            }

            builder.AppendLine(INSTRUCTIONS);
            StringBuilder tableBuilder = new StringBuilder();
            StringBuilder clueBuilder  = new StringBuilder();

            tableBuilder.AppendLine("<table>");

            clueBuilder.AppendLine("<ol>");
            for (var index = 0; index < _hiddenWords.Count; index++)
            {
                var currentWord = _hiddenWords[index];
                tableBuilder.AppendLine("<tr>");
                tableBuilder.AppendLine($@"<td class=""normal centered"" width=""30""> {index+1} </td>");
                AppendHiddenWord(tableBuilder, currentWord, includeSolution);
                clueBuilder.AppendLine($"<li>{currentWord.SentenceHidingWord}");
            }

            tableBuilder.AppendLine("</table>");
            clueBuilder.AppendLine("</ol>");
            builder.Append(clueBuilder);
            builder.AppendLine("<br />");
            builder.Append(tableBuilder);
            if (!isFragment)
            {
                _htmlGenerator.AppendHtmlFooter(builder);
            }
            return(builder.ToString());
        }