Robin is playing notes on an 88-key piano. He starts by playing middle C, which is actually the 40th lowest note on the piano (i.e. there are 39 notes lower than middle C). After playing a note, Robin plays with probability $\tfrac12$ the lowest note that is higher than the note he just played, and with probability $\tfrac12$ the highest note that is lower than the note he just played. What is the probability that he plays the highest note on the piano before playing the lowest note?

1. **Define the problem in terms of a Markov process:**
   - Let \( X_n \) be the note Robin plays at step \( n \).
   - Robin starts at middle C, which is the 40th note on the piano.
   - The process has absorbing states at the lowest note (note 1) and the highest note (note 88).

2. **Set up the transition probabilities:**
   - From any note \( k \) (where \( 2 \leq k \leq 87 \)), Robin moves to \( k-1 \) with probability \( \frac{1}{2} \) and to \( k+1 \) with probability \( \frac{1}{2} \).

3. **Define the probability of reaching the highest note before the lowest note:**
   - Let \( p_k \) be the probability that starting from note \( k \), Robin reaches the highest note (note 88) before the lowest note (note 1).

4. **Set up the boundary conditions:**
   - \( p_1 = 0 \) (if Robin starts at the lowest note, he cannot reach the highest note first).
   - \( p_{88} = 1 \) (if Robin starts at the highest note, he has already reached it).

5. **Set up the recurrence relation:**
   - For \( 2 \leq k \leq 87 \), the probability \( p_k \) satisfies:
     \[
     p_k = \frac{1}{2} p_{k-1} + \frac{1}{2} p_{k+1}
     \]

6. **Solve the recurrence relation:**
   - This is a second-order linear homogeneous recurrence relation. To solve it, we assume a solution of the form \( p_k = A + Bk \).
   - Substituting \( p_k = A + Bk \) into the recurrence relation:
     \[
     A + Bk = \frac{1}{2} (A + B(k-1)) + \frac{1}{2} (A + B(k+1))
     \]
     Simplifying, we get:
     \[
     A + Bk = \frac{1}{2} (A + Bk - B) + \frac{1}{2} (A + Bk + B)
     \]
     \[
     A + Bk = \frac{1}{2} (2A + 2Bk)
     \]
     \[
     A + Bk = A + Bk
     \]
     This confirms that \( p_k = A + Bk \) is a valid form.

7. **Determine the constants \( A \) and \( B \) using boundary conditions:**
   - Using \( p_1 = 0 \):
     \[
     A + B \cdot 1 = 0 \implies A = -B
     \]
   - Using \( p_{88} = 1 \):
     \[
     A + B \cdot 88 = 1 \implies -B + 88B = 1 \implies 87B = 1 \implies B = \frac{1}{87}
     \]
     \[
     A = -\frac{1}{87}
     \]

8. **Find the probability starting from middle C (note 40):**
   - \( p_{40} = A + B \cdot 40 \)
     \[
     p_{40} = -\frac{1}{87} + \frac{40}{87} = \frac{39}{87} = \frac{13}{29}
     \]

The final answer is \(\boxed{\frac{13}{29}}\).