Expected values of a dice game with a 30-sided die and a 20-sided die. 
Two people, $A$ and $B$, have a $30$-sided and $20$-sided die, respectively. Each rolls their die, and the person with the highest roll wins. ($B$ also wins in the event of a tie.) The loser pays the winner the value on the winner's die.

Question:


*

*What is expected value for player $A$?

*How does the expected value of the game for player $A$ change when player $B$ can re-roll?

*How much is it worth for player $A$ to get a re-roll in this scenario, where player $B$ can have the re-roll? 

*If you remove player $A$ re-roll. How many re-rolls does player $B$ need in order for him to be a favorite in the game?


I took the average score for player $A$ to be $15.5$ and for player $B$ to be $10.5$. I am assuming this to be expected return for player $A$ so $15.5 - 10.5 = 5$. We also need to take into account when $X = Y$ when $A$ loses to $B$ on draw so $5 - (7/20) = 4.65$.
What I do not understand is how to factor in for when player $B$ can re-roll. I understand that $B$ would re-roll if he gets a value $< 10.5$ which happens $\frac 12$ of the time. Nor can I seem to grasp how to set up the  follow-up questions.
 A: 1. What is the expected value for player $A$?
Let $A, B$ be the players' rolls and $W$ be player $A$'s winnings. Then
$$
\begin{align}
\tag{1}
\mathbb{E}W &=
\mathbb{E}[W|A \leq 20]\cdot\mathbb{P}\{A \leq 20\} 
\ +\ 
\mathbb{E}[W|A > 20]\cdot\mathbb{P}\{A > 20\}
\end{align}
$$
just by simply conditioning on the event $\{A \leq 20\}$ so far.


*

*Now $\mathbb{E}[W|A \leq 20]$ would be zero if not for the fact that ties are settled in player $B$'s favor:
$$
   \mathbb{E}[W|A \leq 20]
   = -\frac{1+20}{2}\cdot\frac{1}{20}
   $$
as ties happen with probability $\frac{1}{20}$ and player $B$ wins $\frac{1+20}{2}$ per tie, on average.

*When $A > 20$, player $A$ always wins, and wins
$$
   \mathbb{E}[W|A > 20]
   = \frac{21+30}{2}
   $$
on average.


Putting it all together,
$$
\begin{align}
\mathbb{E}W
&= -\frac{21}{40}\frac{2}{3} + \frac{51}{2}\frac{1}{3} \\
&= \frac{163}{20}\\
&= 8.15
\end{align}
$$
as was derived in previous answers. So far so good.
2. How does the expected value of the game for player $A$ change when player $B$ can re-roll?
Here the wording becomes rather more vague. Nonetheless I believe both previous answers misinterpret the problem statement. Allowing player $B$ a re-roll does not mean $B$ chooses the maximum of two rolls: that would be worded as "player $B$ is allowed the greater of two rolls". Allowing player $B$ a re-roll means that if player $B$ is unhappy with her first roll she may substitute it with a second roll, which may turn out to be less than her first. The ambiguity is in whether the re-roll is offered before or after player $B$ has seen player $A$'s roll. I consider only the first case, as it permits us to offer numbers instead of functions (of  player $A$'s roll) as answers to this question, and to question 4.
Clearly, player $B$ will re-roll after rolling $b$ or less iff
$$
\tag{2}
\mathbb{E}[W|B=b] > \mathbb{E}[W] = 8.15
$$
as she wishes to minimize $W$.
At this point we may as well calculate:
$$
\begin{align}
\mathbb{E}[W|B=b] &=
\mathbb{E}[W|B=b, A \leq b]\cdot\mathbb{P}\{A \leq b\} 
\ +\ 
\mathbb{E}[W|B=b, A > b]\cdot\mathbb{P}\{A > b\} \\
&=-b\frac{b}{30}+\frac{(b+1)+30}{2}\frac{30-b}{30} \\
&= \frac{-3b^2-b+930}{60}.
\end{align}
$$
Let $b^*$ be the maximum $b$ such that inequality $(2)$ holds.
(I found $b^* = 11$. Is there a faster, less error-prone method of calculating this part?)
Let $W_1$ be the value of the game when player $B$ can re-roll. Then
\begin{align}
\mathbb{E}[W_1] &=
\mathbb{E}W + \frac{b^*}{20}\big(\mathbb{E}W - \mathbb{E}[W|B \leq b^*]\big)\\
\end{align}
as we modify the old $\mathbb{E}W$ by adding the effect of the re-roll. I express it in this way because
$$\mathbb{E}[W|B \leq b^*]$$
is easy to calculate quickly as it expands just like equation $(1)$ does, by pretending player $B$ is rolling a $b^*$-sided die.
A: Letting $D_k$ be the random value of a fair $k$-sided dice roll, the probability that $A$ will win is: 
$$\begin{align}
\mathsf P(D_{30}>D_{20}) & = \sum_{b=1}^{20} \mathsf P(D_{20}=b)\; \mathsf P(D_{30}>b)
\\ & = \frac{1}{20}\sum_{b=1}^{20}\left(1- \frac{b}{30}\right)
\\ & =\frac{13}{20}
\end{align}$$
Allowing a reroll effectively means taking the maximum result of two rolls ($D_{20,1}, D_{20,2}$), so then the probability of A winning is:
$$\begin{align}
\mathsf P(D_{30}>\max(D_{20,1}, D_{20,2})) & =\frac{10}{30} + \sum_{a=1}^{20} \mathsf P(D_{30}=a)\;\mathsf P(D_{20,1}< a)\;\mathsf P(D_{20,2}< a)
\\ & = \frac{10}{30} + \frac{1}{30}\sum_{a=1}^{20} \left(\frac {a-1} {20}\right)^2
\\ & = \frac{647}{1200}
\end{align}$$
From these probabilities you can chocolate the expected returns.
Can you complete the rest?
A: The expected return for $A$ is the following sum, where $X_a$ is the roll for $A$ and $X_b$ is the roll for $B$:$$\sum_{h=1}^{30} \left(hP(X_a=h)P(X_b<h) - hP(X_a\leq h)P(X_b=h)\right)\tag{1}$$
This is: $$\sum_{h=1}^{20} h\left(\frac{1}{30}\frac{h-1}{20} -\frac{h}{30}\frac{1}{20}\right) + \sum_{h=21}^{30}\frac{h}{30}$$
(I used $h$ because it is the highest value rolled.)
I get $8.15$ as the result, but I could have failed in the algebra somewhere.
The formula is the same as (1) when $B$ getting two rolls, but the variable $X_b$ is different - it is the maximum value of two rolls. This is going to be more complicated. Let $X_{b,2}$ be the value of the maximum of two rolls of the $20$-sided die. Then $P(X_{b,2}=h)=\frac{2h+1}{20^2}$ for $h\leq 20$ and zero otherwise, and $P(X_{b,2}<h)=\frac{(h-1)^2}{20^2}$ for $h\leq 20$ and $1$ for $h>20$. Lots of ugly algebra.
In general, if $X_{b,k}$ is the maximum when rolling the die $k$ times, then $$P(X_{b,k}<h) = \begin{cases}\frac{(h-1)^k}{20^k}&h\leq 20\\
1&h>20
\end{cases} $$
and:
$$P(X_{b,k}=h)=\begin{cases}
\frac{h^k-(h-1)^k}{20^k}&h\leq 20\\
0&h>20\end{cases}$$
