Given two barrels of water, $A,B$, with 1 liter each. We pour an $X\sim U[0,1]$ amount of water from $A$ to $B$ and then $Y$ amount of water randomly from $B$ to $A$ $(Y|X=x\sim U[0,1+x])$.
Calculate the CDF of $Z$ - the amount of water in barrel A after both transfers.
My try:
Obviously $Z=1-X+Y$, so for $t\in[0,2]$, we calculate (using law of total probability):
$F_Z(t)=\mathbb{P}(Z\le t)=\mathbb{P}(1-X+Y\le t)=\int_0^1\mathbb{P}(Y\le t+x-1|X=x)f_X(x)=\int_0^1\mathbb{P}(Y\le t+x-1|X=x)$
How can I determine the limits of integration given different values of $t$?
Any help would be appreciated