Solution:
Note that we desire to compute the number of times James moves to the right before moving down to the line y=0. Note also that we can describe James's current state based on whether his y-coordinate is 0 or 1 and whether or not the other vertically adjacent point has been visited. Let E(1,N) be the expected number of times James will go right before stopping if he starts at a point with y-coordinate 1 and the other available point with the same x-coordinate has not been visited. Define E(1,Y), E(2,N), and E(2,Y) similarly. Then we can construct equations relating the four variables:
E(1,N)=31E(2,Y)+31(E(1,N)+1)
as James can either go up, right, or down with probability 1/3 each if he starts in the state (1,N). Similarly, we have
E(2,N)=21E(1,Y)+21(E(2,N)+1),E(1,Y)=21(E(1,N)+1)
and E(2,Y)=E(2,N)+1. Solving these equations, we get E(1,N)=37, which is our answer, as James starts in that state having gone left 0 times.