Esempio n. 1
0
        /// <inheritdoc />
        public override void Apply(IMarkingsProvider markings, Path path)
        {
            if (path.Squares.Any())
            {
                var pin = markings.GetMarkers <SimpleMarker>(path.Start, MarkerType.Pin).FirstOrDefault();

                if (pin != default)
                {
                    if (path.Direction != pin.Direction && path.Direction != pin.Direction.Opposite())
                    {
                        return;
                    }
                }
            }
            base.Apply(markings, path);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public override void Apply(IMarkingsProvider markings, Path path)
        {
            if (path.AllowTake && path.Piece.Type == PieceType.Pawn && path.Squares.Any())
            {
                var(target, _) = path.Squares.First();

                SimpleMarker marker;
                if ((marker = markings.GetMarkers <SimpleMarker>(target, MarkerType.EnPassant).FirstOrDefault()) != null &&
                    path.Piece.Color != marker.Piece.Color)
                {
                    markings.Mark(path.Start, new MoveMarker(new EnPassantTakeMove(path.Start, target, marker.Source), path.Direction));

                    return;
                }
            }
            base.Apply(markings, path);
        }