def array_swap_transform_next_index_to_current_index(position, move):
    """Transforms the position depending on the move.

    Works with the array_swap move type.
    This function transforms the position so that it can be used as the indice
    in the unaltered array, yet return the value it would have had if the move
    was actually performed and the position was used as indice.

    Parameters
    ----------
    position : int
        The index that one wants to use in the array if the move was performed.
    move : tuple of int
        A tuple with that represents a single, unique move.

    Returns
    -------
    int
        The index in the unaltered array that has the same value as the
        location in an array where the move was performed.

    Examples
    --------
    Some simple examples, the move remains the same, but the position changes:

    .. doctest::

        >>> from lclpy.evaluation.deltaeval.delta_qap \\
        ...     import array_swap_transform_next_index_to_current_index \\
        ...         as transform_next_index_to_current_index
        ... # tests
        >>> transform_next_index_to_current_index(0, (1, 3))
        0
        >>> transform_next_index_to_current_index(1, (1, 3))
        3
        >>> transform_next_index_to_current_index(2, (1, 3))
        2
        >>> transform_next_index_to_current_index(3, (1, 3))
        1
        >>> transform_next_index_to_current_index(4, (1, 3))
        4

    """

    # transform frm so it returns the value that from would have if the
    # move was performed.
    if position == move[0]:
        position = move[1]
    elif position == move[1]:
        position = move[0]

    return position