From fe0360ca3d7df0d8cc89a8c9a97df06706df135d Mon Sep 17 00:00:00 2001 From: Stevo Date: Wed, 13 Mar 2024 15:33:38 +0000 Subject: [PATCH] WIP --- .../Supporting Files/Styles.css | 6 +++- .../Supporting Files/Template.html | 24 ++----------- src/Sudoku.Console/TreeGenerator.cs | 34 ++++++++++++++----- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/Sudoku.Console/Supporting Files/Styles.css b/src/Sudoku.Console/Supporting Files/Styles.css index 4861ac8..c975429 100644 --- a/src/Sudoku.Console/Supporting Files/Styles.css +++ b/src/Sudoku.Console/Supporting Files/Styles.css @@ -6,13 +6,17 @@ body { background-color: #e0e0e0; - cursor: all-scroll; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; + zoom: 50%; +} + +pre { + font-family: 'Lucida Console', monospace; } .title { diff --git a/src/Sudoku.Console/Supporting Files/Template.html b/src/Sudoku.Console/Supporting Files/Template.html index 71f47e6..b1818cb 100644 --- a/src/Sudoku.Console/Supporting Files/Template.html +++ b/src/Sudoku.Console/Supporting Files/Template.html @@ -9,32 +9,12 @@ diff --git a/src/Sudoku.Console/TreeGenerator.cs b/src/Sudoku.Console/TreeGenerator.cs index 46d82fb..e8ff466 100644 --- a/src/Sudoku.Console/TreeGenerator.cs +++ b/src/Sudoku.Console/TreeGenerator.cs @@ -5,7 +5,7 @@ namespace Sudoku.Console; public class TreeGenerator { - private const string NodeTemplate = "
  • {move}
    {puzzle}
    {children}
  • "; + private const string NodeTemplate = "
  • {puzzle}
    {children}
  • "; public void Generate(int[] puzzle, string filename) { @@ -26,15 +26,33 @@ public void Generate(int[] puzzle, string filename) private static string ProcessNode(Node node) { - var type = node.Move.Type switch + var content = NodeTemplate; + + var puzzle = new StringBuilder(); + + for (var i = 0; i < 81; i++) { - MoveType.HiddenSingle => "Hidden Single", - MoveType.LastPossibleNumber => "Last Possible", - _ => "Guess" - }; + if (node[i] == 0) + { + puzzle.Append(' '); + } + else + { + puzzle.Append(node[i]); + } + + if (i % 9 == 0) + { + puzzle.Append("
    "); + } + else + { + puzzle.Append(' '); + } + } + + content = content.Replace("{puzzle}", puzzle.ToString()); - var content = NodeTemplate.Replace("{move}", type); - if (node.Children.Count == 0) { content = content.Replace("{children}", string.Empty);