コード例 #1
0
ファイル: ChessBoard.cs プロジェクト: ABarroso647/Chess-AI
        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);
                }
            }
        }