示例#1
0
        public static void printCapturedPieces(ChessMath math)
        {
            Console.WriteLine("\nCaptured Pieces:");
            Console.Write("\nWhite:");
            printConjunto(math.CapturedPieces(Color.White));
            ConsoleColor aux = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("\nBlack:");
            printConjunto(math.CapturedPieces(Color.Black));
            Console.ForegroundColor = aux;
        }
示例#2
0
 public static void printMath(ChessMath math, bool[,] validMoves)
 {
     Console.Clear();
     printBoard(math.ChessBoard, validMoves);
     printCapturedPieces(math);
     Console.WriteLine($"\n\nTunr: {math.Turn}");
     Console.WriteLine("\n" + math.PlayerColor + " player is your turn");
     if (math.Check)
     {
         Console.WriteLine("XEQUE!");
     }
 }
示例#3
0
 public static void printMath(ChessMath math)
 {
     Console.Clear();
     printBoard(math.ChessBoard);
     printCapturedPieces(math);
     if (!math.Finish)
     {
         Console.WriteLine($"\n\nTunr: {math.Turn}");
         Console.WriteLine("\n" + math.PlayerColor + " player is your turn");
         if (math.Check)
         {
             Console.WriteLine("CHECK!");
         }
     }
     else
     {
         Console.WriteLine("CHECKMATE!");
         Console.WriteLine("\n WINS: " + math.PlayerColor);
     }
 }
示例#4
0
        static void Main(string[] args)
        {
            try
            {
                ChessMath math = new ChessMath();
                while (!math.Finish)
                {
                    try
                    {
                        Screm.printMath(math);
                        Console.Write("Origin:");
                        Position origin = Screm.ReadPositon().toPosition();
                        Console.WriteLine();
                        math.ValidateOriginPosition(origin);

                        bool[,] validMove = math.ChessBoard.Piece(origin).ValidMoves();
                        Screm.printMath(math, validMove);

                        Console.Write("\nDestiny:");
                        Position destiny = Screm.ReadPositon().toPosition();
                        math.ValidateDestinyPosition(origin, destiny);

                        math.MakePlay(origin, destiny);
                    }
                    catch (BoardException e)
                    {
                        Console.WriteLine(e.Message);
                        Console.ReadLine();
                    }
                }
                Screm.printMath(math);
            }
            catch (BoardException e)
            {
                Console.WriteLine(e.Message);
            }
        }