コード例 #1
0
        public override PieceMove GetMoveTo(Position position)
        {
            var moveShift = position - Position;

            if (moveShift == this.LongMove.Shift && InnerPieceDecorator.ValidateNewMove(LongMove) && CanLongMove())
            {
                return(longMove);
            }
            return(Piece.GetMoveTo(position));
        }
コード例 #2
0
        public override bool ValidateNewMove(PieceMove move)
        {
            if (!InnerPieceDecorator.ValidateNewMove(move))
            {
                return(false);
            }

            if (move.MoveTypes.Contains(MoveType.Move) && move.Shift == LongMove.Shift)
            {
                return(CanLongMove());
            }
            return(true);
        }
コード例 #3
0
        public override bool ValidateNewMove(PieceMove move)
        {
            if (!InnerPieceDecorator.ValidateNewMove(move))
            {
                return(false);
            }
            var pieceAtDestination = Board.GetPiece(Position + move.Shift);

            var containsMove = move.MoveTypes.Contains(MoveType.Kill);

            if (pieceAtDestination != null && pieceAtDestination.Color != Color && !containsMove)
            {
                return(false);
            }
            if ((pieceAtDestination == null || pieceAtDestination.Color == Color) && containsMove)
            {
                return(false);
            }
            return(true);
        }
コード例 #4
0
 public override bool ValidateNewMove(PieceMove move)
 {
     return InnerPieceDecorator.ValidateNewMove(move) && isProtectedPieceSafeAfterMove(move);
 }