private static void PrintGrid(Game game) { for (int y = 0; y < game.Height; y++) { PrintRow(game, y, " ", "┌────┐"); PrintRow(game, y, " ", "│ {0,2} │"); PrintRow(game, y, " ", "└────┘"); } }
public static Game NewGame(int gridSize = 4) { var game = new Game(gridSize); game.Scramble(7 * game.Width * game.Height); game.MoveCount = 0; return game; }
private static void PrintRow(Game game, int y, string blankFormat, string numberFormat) { for (int x = 0; x < game.Width; x++) { var n = game[x, y].ToString(); var correct = game.IsPositionCorrect(x, y); using (new ConsoleColorSetter(correct ? ConsoleColor.Green : ConsoleColor.White)) { if (n == "-1") { Console.Write(blankFormat); } else { Console.Write(numberFormat, n); } } } Console.WriteLine(); }