ChessDotNet.Variants.Horde.Pieces.HordePawn.IsValidMove C# (CSharp) Method

IsValidMove() public method

public IsValidMove ( Move move, ChessGame game ) : bool
move Move
game ChessGame
return bool
        public override bool IsValidMove(Move move, ChessGame game)
        {
            bool validByStandardRules = base.IsValidMove(move, game);
            if (validByStandardRules) return true;
            if (move.OriginalPosition.Rank == 1 &&
                move.NewPosition.Rank == 3 &&
                move.OriginalPosition.File == move.NewPosition.File &&
                game.GetPieceAt(move.NewPosition) == null &&
                game.GetPieceAt(new Position(move.OriginalPosition.File, move.OriginalPosition.Rank + 1)) == null)
                // Horde pawns at the first rank can also move two squares on their first move. However, these can't be en-passant captured.
            {
                return true;
            }

            return false;
        }
    }