Ejemplo n.º 1
0
        public static List <ChessBoard> GetReversedPossibleWhitePositions(ChessBoard board, char file, sbyte rank, sbyte piece)
        {
            ChessBoard tempboard = board.ShallowCopy();

            tempboard.ReverseSides();
            Square tempsquare = new Square(file, rank);

            tempsquare.Reverse();
            char piecechar = FIDEnotation.GetLetter(piece);

            FIDEnotation.GetPiecePositionsType function = FIDEnotation.GetWhitePiecePositionsType(piecechar);
            List <ChessBoard> result = function(tempboard, tempsquare.file, tempsquare.rank);

            foreach (ChessBoard temp in result)
            {
                temp.ReverseSides();
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static void DrawRevertedChessBoard(ChessBoard board)
        {
            // Code Review: Назва локальної змінної повинна починатися з малої літери.
            bool IsWhite = true;

            //Console.WriteLine();
            Console.Write("   ");
            for (char tfile = 'h'; tfile >= 'a'; tfile--)
            {
                Console.Write(" " + tfile + " ");
            }
            //Console.WriteLine();
            for (int trank = 1; trank <= 8; trank++)
            {
                Console.SetCursorPosition(32, trank);
                //Console.ForegroundColor = ConsoleColor.White;
                Console.Write(" " + trank + " ");
                for (char tfile = 'h'; tfile >= 'a'; tfile--)
                {
                    //Console.WriteLine(tfile + " ");
                    //Console.Write(trank + " ");
                    if (IsWhite)
                    {
                        Console.BackgroundColor = ConsoleColor.DarkGray;
                        //Console.ForegroundColor = ConsoleColor.Black;
                    }
                    else
                    {
                        Console.BackgroundColor = ConsoleColor.DarkGreen;
                        //Console.ForegroundColor = ConsoleColor.Black;
                    }
                    //Console.WriteLine(tfile + " " + trank);
                    if (board[tfile, trank] < 0)
                    {
                        //Console.Write(board[tfile, trank] + " ");
                        Console.ForegroundColor = ConsoleColor.Black;
                    }
                    else if (board[tfile, trank] > 0)
                    {
                        //Console.Write("+" + board[tfile, trank] + " ");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    Console.Write(" " + FIDEnotation.GetLetter(board[tfile, trank]) + " ");
                    //else
                    //{
                    //    Console.Write("   ");
                    //}
                    IsWhite = !IsWhite;
                }
                IsWhite = !IsWhite;
                Console.ResetColor();
                Console.Write(" " + trank + " ");
            }
            Console.SetCursorPosition(32, 9);
            Console.Write("   ");
            for (char tfile = 'h'; tfile >= 'a'; tfile--)
            {
                Console.Write(" " + tfile + " ");
            }
            Console.SetCursorPosition(32, 0);
        }