예제 #1
0
    static void imprimirTabuleiro(Peca[,] pecas, bool[,] matrizMov, bool flip)
    {
        ConsoleColor back = Console.BackgroundColor, alt = Tela.BCK_COR_MOV;

        if (flip)
        {
            // Orientação do tabuleiro: pretas em cima
            for (int j = 0; j < pecas.GetLength(1); j++)
            {
                Console.ForegroundColor = Tela.FRG_COR_COORD;
                if (matrizMov != null)
                {
                    Console.BackgroundColor = back;
                }
                Console.Write((j + 1) + " "); // linhas
                Console.ResetColor();
                for (int i = pecas.GetLength(0) - 1; i >= 0; i--)
                {
                    imprimirCasa(alt, back, matrizMov, pecas, i, j);
                }
                Console.WriteLine();
            }
            Console.ForegroundColor = Tela.FRG_COR_COORD;
            if (matrizMov != null)
            {
                Console.BackgroundColor = back;
            }
            Console.WriteLine("  h g f e d c b a"); // colunas
        }
        else
        {
            // Orientação do tabuleiro: brancas em cima
            for (int j = pecas.GetLength(1) - 1; j >= 0; j--)
            {
                Console.ForegroundColor = Tela.FRG_COR_COORD;
                if (matrizMov != null)
                {
                    Console.BackgroundColor = back;
                }
                Console.Write((j + 1) + " "); // linhas
                Console.ResetColor();
                for (int i = 0; i < pecas.GetLength(0); i++)
                {
                    imprimirCasa(alt, back, matrizMov, pecas, i, j);
                }
                Console.WriteLine();
            }
            Console.ForegroundColor = Tela.FRG_COR_COORD;
            if (matrizMov != null)
            {
                Console.BackgroundColor = back;
            }
            Console.WriteLine("  a b c d e f g h"); // colunas
        }
        Console.ResetColor();
    }
예제 #2
0
 public bool posicaoExiste(Posicao pos)
 {
     if (pos.x - 97 < 0 || pos.x - 97 >= pecas.GetLength(0) || pos.y - 1 < 0 || pos.y - 1 >= pecas.GetLength(1))
     {
         return(false);
     }
     return(true);
 }