コード例 #1
0
        public static void PrintBoard(Board.Board board, bool[,] possiblePositions)
        {
            var originalBackground = Console.BackgroundColor;
            var alteredBackground  = ConsoleColor.DarkGray;

            Console.WriteLine("  a b c d e f g h");
            for (int i = 0; i < board.Rows; i++)
            {
                Console.Write(8 - i + " ");
                for (int j = 0; j < board.Columns; j++)
                {
                    if (possiblePositions[i, j])
                    {
                        Console.BackgroundColor = alteredBackground;
                    }
                    else
                    {
                        Console.BackgroundColor = originalBackground;
                    }

                    PrintPiece(board.Piece(i, j));
                    Console.BackgroundColor = originalBackground;
                }
                Console.Write(8 - i + " ");
                Console.WriteLine();
            }
            Console.WriteLine("  a b c d e f g h");
            Console.BackgroundColor = originalBackground;
        }
コード例 #2
0
 public static void PrintBoard(Board.Board board)
 {
     Console.WriteLine("  a b c d e f g h");
     for (int i = 0; i < board.Rows; i++)
     {
         Console.Write(8 - i + " ");
         for (int j = 0; j < board.Columns; j++)
         {
             PrintPiece(board.Piece(i, j));
         }
         Console.Write(8 - i + " ");
         Console.WriteLine();
     }
     Console.WriteLine("  a b c d e f g h");
 }