Exemplo n.º 1
0
        public override bool canMove(int CurrentX, int CurrentY, int NewX, int NewY, bool white)//this is the pawn canmove
        {
            Pawn pawn = new Pawn();

            if (ChessBoard.Attack)// if the piece is set to attack it checks if the pawn can you its diagonal move
            {
                if (pawn.diagonalMove(CurrentX, CurrentY, NewX, NewY, white))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else//if the pawn is not set to attack it just checks if the pawn can do the forward move
            {
                if (pawn.forwardMove(CurrentX, CurrentY, NewX, NewY, white))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }