Example #1
0
        public void Init()
        {
            chessBoard = new ChessPiece[8, 8];

            for (int x = 0; x < chessBoard.GetLength(0); x++)
            {
                for (int y = 0; y < chessBoard.GetLength(1); y++)
                {
                    chessBoard[x, y] = null;
                }
            }

            ChessPieceHelper.InitChessPieces(ref chessBoard);

            whoIsActive = ChessPieceColor.White;
            winner      = ChessPieceColor.None;
        }
Example #2
0
        public void Display()
        {
            Console.Clear();
            Console.WriteLine("   A  B  C  D  E  F  G  H");

            for (int x = 0; x < chessBoard.GetLength(0); x++)
            {
                Console.Write($"{x + 1} ");

                for (int y = 0; y < chessBoard.GetLength(1); y++)
                {
                    Console.BackgroundColor = ((x + y) % 2 == 0) ? ConsoleColor.DarkCyan : ConsoleColor.DarkGray;
                    ChessPieceHelper.DisplayChessPiece(chessBoard[x, y]);
                }

                Console.WriteLine();
                Console.ResetColor();
            }
        }