public void ReverseSides()
        {
            ChessBoard tempboard = new ChessBoard();

            for (char tchar = 'a'; tchar <= 'h'; tchar++)
            {
                for (sbyte trank = 1; trank <= 8; trank++)
                {
                    Square tempsquare = new Square(tchar, trank);
                    Square rsquare    = tempsquare;
                    rsquare.Reverse();
                    tempboard[rsquare] = (sbyte)(-1 * this[tempsquare]);
                }
            }
            this.squares = tempboard.squares;
        }
示例#2
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);
        }
示例#3
0
        public static List <Square> GetPossibleWhiteAttackersToSquare(ChessBoard board, Square goalsquare)
        {
            ChessBoard tempboard = board.ShallowCopy();

            tempboard.DebugConsoleSimpleDraw();
            Console.WriteLine();
            tempboard.ReverseSides();
            //tempboard.DebugConsoleSimpleDraw();
            Square tempsquare = new Square(goalsquare.file, goalsquare.rank);

            tempsquare.Reverse();
            var result = WhitePiece.GetPossibleBlackAttackersToSquare(tempboard, tempsquare);

            for (int i = 0; i < result.Count; i++)
            {
                Square temp = result[i];
                temp.Reverse();
                result[i] = temp;
            }
            return(result);
        }