Exemplo n.º 1
0
        public ChessMoveInfo WithExtraStep(ChessMoveStepInfo extraStep)
        {
            var newMoveSteps = MoveSteps.ToList();

            newMoveSteps.Add(extraStep);
            return(new ChessMoveInfo(Player, newMoveSteps, WouldCaptureKing, IsCastling));
        }
        internal ChessMoveInfo CreateSimpleMove(Piece pieceToMove, PiecePosition pieceDestination, Piece pieceToCapture = null)
        {
            pieceToCapture ??= GetPiece(pieceDestination);
            pieceToCapture = !pieceToCapture.IsNone() && pieceToCapture.Player != pieceToMove.Player ? pieceToCapture : null;
            var singleMoveStep = new ChessMoveStepInfo(pieceToMove.Position, pieceDestination, pieceToMove, pieceToCapture);

            return(CreateMove(singleMoveStep));
        }