Esempio n. 1
0
        private bool ProcessBlockForPawn(int x, int y)
        {
            Block b = cb.GetBlockByChessPosition(new Point(x, y));

            if (b != null)
            {
                if (b.GetPiece() == null)
                {
                    return(false);
                }
                else
                {
                    if (b.GetPiece().GetPieceColor() == OrigBlock.GetPiece().GetPieceColor())
                    {
                        return(false);
                    }
                    else
                    {
                        ValidBlocks.Add(b);
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
        protected new  bool ProcessBlockInclusive(int x, int y)
        {
            Block b = cb.GetBlockByChessPosition(new Point(x, y));

            if (b != null)
            {
                ValidBlocks.Add(b);
                return(false);
            }
            return(false);
        }
Esempio n. 3
0
        private bool ProcessBlockForPawnInclusive(int x, int y)
        {
            Block b = cb.GetBlockByChessPosition(new Point(x, y));

            if (b != null)
            {
                ValidBlocks.Add(b);
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        private bool ProceedIfNoPiece(int x, int y)
        {
            Block b = cb.GetBlockByChessPosition(new Point(x, y));

            if (b != null)
            {
                if (b.GetPiece() == null)
                {
                    ValidBlocks.Add(b);
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 5
0
        protected new  bool ProcessBlock(int x, int y)
        {
            Block b = cb.GetBlockByChessPosition(new Point(x, y));

            if (b != null)
            {
                Piece piece = b.GetPiece();
                if (piece != null)
                {
                    if (piece.GetPieceColor() == OrigBlock.GetPiece().GetPieceColor())
                    {
                        return(false);
                    }
                }

                ValidBlocks.Add(b);
                return(false);
            }
            return(false);
        }
Esempio n. 6
0
        private void CastlePositions()
        {
            if (OrigBlock == null)
            {
                return;
            }

            Piece piece = OrigBlock.GetPiece();

            if (piece == null)
            {
                return;
            }

            // It must be KING
            if (piece.GetPieceType() != PieceType.KING)
            {
                return;
            }

            // Must be able to castle
            if (!piece.GetCanCastle())
            {
                return;
            }

            Point point = OrigBlock.GetChessPosition();

            bool GotPiece = false;

            if (CanCastle(new Point(0, point.Y)))
            {
                for (int i = point.X - 1; i > 0; i--)
                {
                    Block b = cb.GetBlockByChessPosition(new Point(i, point.Y));

                    if (b.GetPiece() != null)
                    {
                        GotPiece = true;
                    }
                }

                if (!GotPiece)
                {
                    ValidBlocks.Add(cb.GetBlockByChessPosition(new Point(point.X - 2, point.Y)));
                }
            }


            GotPiece = false;

            if (CanCastle(new Point(7, point.Y)))
            {
                for (int i = point.X + 1; i < 7; i++)
                {
                    Block b = cb.GetBlockByChessPosition(new Point(i, point.Y));

                    if (b.GetPiece() != null)
                    {
                        GotPiece = true;
                    }
                }

                if (!GotPiece)
                {
                    ValidBlocks.Add(cb.GetBlockByChessPosition(new Point(point.X + 2, point.Y)));
                }
            }
        }