Exemple #1
0
        public override bool isLegalMove(int x, int y)
        {
            //the movement is of a queen is basically the momevement of the rook and bishop combined
            var bishop = new Bishop(XPos, YPos, color, directionDown, board);
            var rook   = new Rook(XPos, YPos, color, directionDown, board);
            var legal  = bishop.isLegalMove(x, y) || rook.isLegalMove(x, y);

            //if it is legal for either rook or bishop it should be fine
            return(legal);
        }
Exemple #2
0
        private void initNonPawns(bool topBoard = true)
        {
            int  yPos  = 0;
            char color = BaseEntity.COLOR_FOR_TOP_PLAYER;

            if (!topBoard)
            {
                color = BaseEntity.COLOR_FOR_BOTTOM_PLAYER;
                yPos  = HEIGHT - 1;
            }

            //ROOKS
            grid[yPos, 0]         = new Rook(0, yPos, color, topBoard, this);
            grid[yPos, WIDTH - 1] = new Rook(WIDTH - 1, yPos, color, topBoard, this);

            //KNIGHTS
            grid[yPos, 1]         = new Knight(1, yPos, color, topBoard, this);
            grid[yPos, WIDTH - 2] = new Knight(WIDTH - 2, yPos, color, topBoard, this);

            //BISHOPS
            grid[yPos, 2]         = new Bishop(2, yPos, color, topBoard, this);
            grid[yPos, WIDTH - 3] = new Bishop(WIDTH - 3, yPos, color, topBoard, this);

            //KING AND QUEEN
            grid[yPos, 4] = new King(4, yPos, color, topBoard, this);

            if (color == BaseEntity.COLOR_FOR_TOP_PLAYER)
            {
                blackKing = (King)grid[yPos, 4];
            }
            else
            {
                whiteKing = (King)grid[yPos, 4];
            }

            grid[yPos, 3] = new Queen(3, yPos, color, topBoard, this);
        }