Beispiel #1
0
 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, "      ", "└────┘");
     }
 }
Beispiel #2
0
 public static Game NewGame(int gridSize = 4)
 {
     var game = new Game(gridSize);
     game.Scramble(7 * game.Width * game.Height);
     game.MoveCount = 0;
     return game;
 }
Beispiel #3
0
        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();
        }