Question from an old exam:
The King of Squares sets out to patrol the City of Squares. The City of Squares is an infinite ladder, i.e., a graph $(V, E)$ where $V = \mathbb{N} \times \{0,1\}$ and the vertex $(x, y)$ is connected to $(x-1, y)$ for $x>0,(x+1, y)$ and $(x, 1-y)$. Unfortunately, due to the revolt, some parts of the streets are blocked. Each edge independently becomes blocked with probability $\frac{1}{2}$. The king leaves his palace at the point $(0,0)$. Let $X$ be the largest value of the coordinate $x$ that the King can reach without passing through the blocked streets.
The king can look ahead, so he will choose the best route before he sets off.
In the situation in the image below $X=5$.(a) Find EX.
(b) Find the probability that both points $(X, 0)$ and $(X, 1)$ are reachable.
My attempt at (a):
Let
$$
X_i = \begin{cases}
i, & \text{if it's possible to reach $(i, 0)$ or $(i,1)$} \\
0, & \text{otherwise}.
\end{cases}
$$
Now we need to find the probability $p(i)$ that it is possible to reach the point $(i, 0)$ or $(i,1)$.
I have calculated that $p(i) = \frac{5}{8} p(i-1)$, where $p(1) = \frac{5}{8}$.
This is derived from the idea that the probability of going from coordinate$ (x, 0)$, to $(x+1, 0)$ or $(x+1, 1)$ is $\frac{5}{8}$.
Then $E[X]=\sum_{i=1}^{\infty}E[X_i]=\sum_{i=1}^{\infty}i\cdot(\frac{5}{8})^i = \frac{40}{9} \approx 4.44$.
Is this correct? How to do (b), because I don't know where to start?

Let $X$ denote the furthest horizontal coordinate that the king can visit.
The pmf of $X$ is given by
$$\color{blue}{\mathbb P(X=n)=\frac{1}{2^{3n+4}}\left [\left(3 + \sqrt{5} \right)^{n+1} + \left(3 - \sqrt{5} \right)^{n+1}\right]}$$
for $n=0,1,2,\dots \, $.
This gives the expectation
$$\color{blue}{\mathbb E(X)=\frac{9}{5}}.$$
How to obtain the probabilities
Here, we present two methods. The second is easier, but the first provides deeper analysis as it allows us to solve other problems imposing other conditions on a reachable point (e.g., analyzing part b in the OP for any fixed number of steps).
First method:
The probability is computed by counting subgraphs of a ladder graph with $n$ layers in which there is a path from (0,1) to only $(n,0)$, there is a path from (0,1) to only $(n,1)$, and there are paths from (0,1) to both $(n,0)$, $(n,1)$; denoted by $f_0(n)$, $f_1(n)$, and $f_{01}(n)$, respectively.
The following recurrences are used to determine $f_0(n)$, $f_1(n)$, and $f_{01}(n)$:
$$f_0(n)=2f_0(n-1)+f_{01}(n-1)$$ $$f_1(n)=2f_1(n-1)+f_{01}(n-1)$$ $$f_{01}(n)=4f_{01}(n-1)+2f_0(n-1)+2f_1(n-1)$$
with $f_0(0)=0, f_1(0)=1, f_{01}(0)=1$.
This gives
$$\color{blue}{\mathbb P(X=n)=\frac{f_0(n)+f_1(n)}{2^{3n+1}}\times \frac{1}{2}+\frac{f_{01}(n)}{2^{3n+1}}\times \frac{1}{4}}=\frac{1}{2^{3n+1}}\left [ \frac{1}{2}\left ( \frac{ (3 + \sqrt{5})^n (5 + \sqrt{5})- (3 - \sqrt{5})^n (-5 + \sqrt{5}) }{10} \right ) + \\ \frac{1}{4}\left( \left(3 + \sqrt{5} \right)^n \left (\frac{1}{2} + \frac{3}{2\sqrt{5}} \right)+ \left (3 - \sqrt{5} \right )^n \left (\frac{1}{2} - \frac{3}{2\sqrt{5}} \right) \right ) \right]=\frac{1}{2^{3n+4}}\left [\left(3 + \sqrt{5} \right)^{n+1} + \left(3 - \sqrt{5} \right)^{n+1}\right]$$
Second method:
Alternatively, the probability can be obtained based on the number of subgraphs of a ladder graph with $n+1$ layers in which there is a path from (0,1) to one of $(n,0)$ or $(n,1)$, but there is no path to any of $(n+1,0)$ and $(n+1,1)$, which satisfies the following recurrence:
$$g(n)=6g(n-1)-4g(n-2)$$
with $g(0)=6, g(1)=28$. In this case, we have
$$\color{blue}{P(X=n)=\frac{g(n)}{2^{3(n+1)+1}}}$$
where
$$g(n)=\left(3 + \sqrt{5} \right)^{n+1} + \left(3 - \sqrt{5} \right)^{n+1}.$$
How to derive the recurrences
Here I explain how I derived the first recurrence in the first method. The other recurrences in the first or second methods can be obtained similarly.
To see how the first recurrence $f_0(n)=2f_0(n-1)+f_{01}(n-1)$ is derived, see the figure below:
$\hskip 2.2 in$
This shows how different subgraphs of a ladder graph with $n$ layers in which there is a path from $(0,1)$ to only $(n,0)$ (referred to as $0$ type in the sequel) can be generated from all subgraphs of a ladder graph with $n-1$ layers in which there is a path from $(0,1)$ to $(n-1,0)$ or $(n-1,1)$.
You can see that we can generate $\color{blue}{\text{no subgraph}}$ of $0$ type from a subgraph of a ladder graph with $n-1$ layers in which there is a path from $(0,1)$ to only $(n-1,1)$ (note that we can only change the lower, upper, and right edges in the $n$th cell).
Based on each subgraph of a ladder graph with $n-1$ layers in which there is a path from $(0,1)$ to only $(n-1,0)$, we can construct $\color{blue}{\text{two subgraphs}}$ of $0$ type by adding either the lower edge or both lower and upper edges.
Based on each subgraph of a ladder graph with $n-1$ layers in which there are paths from $(0,1)$ to both $(n-1,0)$ and $(n-1,1)$, we can construct only $\color{blue}{\text{one subgraph}}$ of $0$ type by adding the lower edge. Note that adding both lower and upper edges results in a subgraph in which there are paths from $(0,1)$ to both $(n,0)$ and $(n,1)$, while here we want there is a path to only $(n,0)$.
The above observations together yield the following recurrence:
$$f_0(n)=2f_0(n-1)+f_{01}(n-1).$$
As I assumed the start point is $(0,1)$, as shown in the OP's figure, $f_0(0)=0$; note that this assumption does affect the final answer because of the symmetry.
How to solve the recurrences
The single recurrence appearing in the second method can be solved easily.
Let me explain how to solve the system of recurrences appearing in the first method:
$$f_0(n)=2f_0(n-1)+f_{01}(n-1)$$ $$f_1(n)=2f_1(n-1)+f_{01}(n-1)$$ $$f_{01}(n)=4f_{01}(n-1)+2f_0(n-1)+2f_1(n-1)$$
with $f_0(0)=0, f_1(0)=1, f_{01}(0)=1$.
Let us define $s(n)=f_0(n)+f_1(n)$, and sum the first two recurrences to get
$$s(n)=2s(n-1)+2f_{01}(n-1).$$
and rewrite the third for $n$ and $n+1$ as follows:
$$f_{01}(n)=4f_{01}(n-1)+2s(n-1)$$ $$f_{01}(n+1)=4f_{01}(n)+2s(n).$$
Now multiply both sides of the above equations by $-1$ and $\frac{1}{2}$, respectively, sum the resulting equations, and use $s(n)-2s(n-1)=2f_{01}(n-1)$ to get the following second-order recurrence for $f_{01}$:
$$f_{01}(n+1)=6f_{01}(n)-4f_{01}(n)$$
with $f_{01}(0)=1$ and $f_{01}(1)=6$. This yields:
$$f_{01}(n)=\left(3 + \sqrt{5} \right)^n \left (\frac{1}{2} + \frac{3}{2\sqrt{5}} \right)+ \left (3 - \sqrt{5} \right )^n \left (\frac{1}{2} - \frac{3}{2\sqrt{5}} \right).$$
This enables us to get $s(n)$ from $s(n)=2s(n-1)+2f_{01}(n-1)$ with $s(0)=0+1=1$, as follows:
$$s(n)=\frac{ (3 + \sqrt{5})^n (5 + \sqrt{5})- (3 - \sqrt{5})^n (-5 + \sqrt{5}) }{10}.$$
Note that from $f_0(n)=2f_0(n-1)+f_{01}(n-1)$ and $f_1(n)=2f_1(n-1)+f_{01}(n-1)$, both functions $f_0(n)$ and $f_0(n)$ can be found similarly, but deriving $s(n)$ is enough for the first method.
Note that the probability requested in the part b of the OP is given by
$$\sum_{n=0}^{\infty}\frac{f_{01}(n)}{2^{3n+1}}\times \frac{1}{4}=\color{blue}{\frac{2}{5}}.$$
The probabilities of other events can be obtained based on $f_0(n)$, $f_1(n)$, $s(n)$, and $f_{01}(n).$
Major update: $ \color{red}{\text{Quick and elementary solution method:}}$
Inspired from my first method, we can design a quick and elementary solution method that directly computes the expectation and the probability in part b, without the need of having the pmf or counting all the cases.
Let us define the following three related problems and solve them simultaneously:
Let $E_0$, $E_0$, and $E_{01}$ denote the expectation of furthest horizontal coordinate in the above problems, respectively. Then, by conditioning on the 8 combined situations of the lower, upper, and left edges of the first cell of the ladder graph, the following relations can be obtained:
$$E_0=\frac{3}{8}(1+E_0)+\frac{1}{8}(1+E_{1})+\frac{1}{8}(1+E_{01})$$ $$E_1=\frac{1}{8}(1+E_0)+\frac{3}{8}(1+E_{1})+\frac{1}{8}(1+E_{01})$$ $$E_{01}=\frac{2}{8}(1+E_0)+\frac{2}{8}(1+E_{1})+\frac{2}{8}(1+E_{01}).$$
Now by solving the above system, we simultaneously obtain all the three expectations: $$\color{blue}{E_0=E_1=\frac{9}{5}, E_{01}=\frac{11}{5}}.$$
The same can be done to get the probability in part b. Similarly, define $P_0$, $P_0$, and $P_{01}$ as the probability that the king needs to stop at some coordinate $i$ while he has paths to both $(i,0)$ and $(i,1)$. Then, by solving the following system:
$$P_0=\frac{1}{8}\times 1+\frac{3}{8}P_0+\frac{1}{8}P_{1}+\frac{1}{8}P_{01}$$ $$P_1=\frac{1}{8}\times 1+\frac{1}{8}P_0+\frac{3}{8}P_{1}+\frac{1}{8}P_{01}$$ $$P_{01}=\frac{2}{8}\times 1 +\frac{2}{8}P_0+\frac{2}{8}P_{1}+\frac{2}{8}P_{01},$$
we obtain the probability in part b for each of the three problems as follows:
$$\color{blue}{P_0=P_1=\frac{2}{5}, P_{01}=\frac{3}{5}}.$$