Пример #1
0
        public static void ImprimirTabuleiro(Tabuleiro tabuleiro)
        {
            Console.Clear();
            Console.WriteLine("\n          XADREZ DO MIXÉU");
            string[] legenda = new string[tabuleiro.Linhas];
            PreencherLegenda(legenda, tabuleiro.Linhas);
            Console.WriteLine();
            for (int i = 0; i < tabuleiro.Linhas; i++)
            {
                Console.Write("   ");
                for (int j = 0; j < tabuleiro.Colunas; j++)
                {
                    ImprimirPeca(tabuleiro.ObterPeca(i, j), i, j);
                }
                Console.Write(" " + (tabuleiro.Linhas - i) + "  ");
                Console.WriteLine("\t\t\t" + legenda[i]);
            }
            Console.Write("   ");
            char aux = 'a';

            for (int i = 0; i < tabuleiro.Colunas; i++)
            {
                Console.Write(" " + aux + " ");
                aux = Convert.ToChar(aux + 1);
            }
            Console.WriteLine();
        }
Пример #2
0
        public static void ImprimirTabuleiro(Tabuleiro tab, bool[,] posicoesPossiveis)
        {
            ConsoleColor fundoOriginal = Console.BackgroundColor;
            ConsoleColor fundoAlterado = ConsoleColor.DarkGray;

            for (int i = 0; i < tab.linhas; i++)
            {
                Console.Write(8 - i + " ");
                for (int j = 0; j < tab.colunas; j++)
                {
                    if (posicoesPossiveis[i, j])
                    {
                        Console.BackgroundColor = fundoAlterado;
                    }
                    else
                    {
                        Console.BackgroundColor = fundoOriginal;
                    }
                    ImprimirPeca(tab.ObterPeca(i, j));
                    Console.BackgroundColor = fundoOriginal;
                }
                Console.WriteLine();
            }
            Console.WriteLine("  a b c d e f g h");
            Console.BackgroundColor = fundoAlterado;
        }
Пример #3
0
 public static void ImprimirTabuleiro(Tabuleiro tab)
 {
     for (int i = 0; i < tab.linhas; i++)
     {
         Console.Write(8 - i + " ");
         for (int j = 0; j < tab.colunas; j++)
         {
             ImprimirPeca(tab.ObterPeca(i, j));
         }
         Console.WriteLine();
     }
     Console.WriteLine("  a b c d e f g h");
 }
Пример #4
0
        public static void ImprimirTabuleiro(Tabuleiro tabuleiro, bool[,] movimentos, Posicao pecaSelecionada)
        {
            Console.Clear();
            string[] legenda = new string[tabuleiro.Linhas];
            PreencherLegenda(legenda, tabuleiro.Linhas);

            ConsoleColor fundoOriginal = Console.BackgroundColor;
            ConsoleColor novoFundo     = ConsoleColor.Yellow;

            Console.WriteLine("\n          JOGO DE XADREZ");
            Console.WriteLine();
            for (int i = 0; i < tabuleiro.Linhas; i++)
            {
                Console.Write("   ");
                for (int j = 0; j < tabuleiro.Colunas; j++)
                {
                    if (movimentos[i, j])
                    {
                        Console.BackgroundColor = novoFundo;
                    }
                    else
                    {
                        if (pecaSelecionada.Linha == i && pecaSelecionada.Coluna == j)
                        {
                            Console.BackgroundColor = ConsoleColor.Green;
                        }
                        else
                        {
                            Console.BackgroundColor = fundoOriginal;
                        }
                    }

                    ImprimirPeca(tabuleiro.ObterPeca(i, j), i, j);
                }
                Console.BackgroundColor = fundoOriginal;
                Console.Write(" " + (tabuleiro.Linhas - i));
                Console.WriteLine("\t\t" + legenda[i]);
            }
            Console.Write("   ");
            char aux = 'a';

            for (int i = 0; i < tabuleiro.Colunas; i++)
            {
                Console.Write(" " + aux + " ");
                aux = Convert.ToChar(aux + 1);
            }
            Console.WriteLine();
        }