private static void DisplayWord(BoggleSolution word, char[,] field) { for (int y = 0; y < field.GetLength(1); y++) { for (int x = 0; x < field.GetLength(0); x++) { var thispoint = new Point { X = x, Y = y }; // Mark the letter in the word if (word.Path.Contains(thispoint)) Console.BackgroundColor = ConsoleColor.DarkGreen; Console.Write(field[x, y].ToString().ToUpper()); Console.BackgroundColor = ConsoleColor.Black; // mark the whitespace between letters if (word.PathContains(thispoint, new Point { X = x + 1, Y = y })) Console.BackgroundColor = ConsoleColor.DarkGreen; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Black; } Console.WriteLine(); for (int x = 0; x < field.GetLength(0); x++) { var thispoint = new Point { X = x, Y = y }; // mark the whitespace between lines if (word.PathContains(thispoint, new Point { X = x, Y = y + 1 })) Console.BackgroundColor = ConsoleColor.DarkGreen; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Black; // whitespace for pretty-printing Console.Write(" "); } Console.WriteLine(); } }
private static void DisplayWord(BoggleSolution word, char[,] field) { for (int y = 0; y < field.GetLength(1); y++) { for (int x = 0; x < field.GetLength(0); x++) { var thispoint = new Point { X = x, Y = y }; // Mark the letter in the word if (word.Path.Contains(thispoint)) { Console.BackgroundColor = ConsoleColor.DarkGreen; } Console.Write(field[x, y].ToString().ToUpper()); Console.BackgroundColor = ConsoleColor.Black; // mark the whitespace between letters if (word.PathContains(thispoint, new Point { X = x + 1, Y = y })) { Console.BackgroundColor = ConsoleColor.DarkGreen; } Console.Write(" "); Console.BackgroundColor = ConsoleColor.Black; } Console.WriteLine(); for (int x = 0; x < field.GetLength(0); x++) { var thispoint = new Point { X = x, Y = y }; // mark the whitespace between lines if (word.PathContains(thispoint, new Point { X = x, Y = y + 1 })) { Console.BackgroundColor = ConsoleColor.DarkGreen; } Console.Write(" "); Console.BackgroundColor = ConsoleColor.Black; // whitespace for pretty-printing Console.Write(" "); } Console.WriteLine(); } }