Sequence waiting time, computing the mean of a stopping time using martingales

This is a question about Example 14.1.13 from "A First Look at Rigorous Probability Theory" by Jeffrey Rosenthal, 2nd Edition. The example concerns an infinite fair coin tossing experiment, $\left \{r_n \right \}_{n \ge 1}$, with the $r_n$ having values 1 for heads and 0 for tails.

$\tau = \inf \left \{ n \ge 3: r_{n-2} = 1, r_{n-1} = 0, r_n = 1 \right \}$ is the first time the sequence heads, tails, heads appears.

The purpose of the example is to show how $E[\tau]$ can be computed using martingales. This is done as follows:

At each time $n$ a new player appears and bets \$1 on heads, if they win they bet \$2 on tails and if they win again they bet \$4 on heads. They stop betting if they either lose once or win three bets in a row. Let$S_n$be they total amount won by all betters by time$n$. Then by construction$S_n$is a martingale with stopping time$\tau$. Once$S_n$is shown to be a martingale the rest of the example is straightforward. However, I must be missing something obvious because I don't follow how$S_n$as constructed is necessarily a martingale. I'm sure it's easy to see this and I've just missed/misunderstood something in how$S_n$is constructed. Any pointers would be appreciated. 1 Answer ...and the answer is simple. With$\mathcal{F}_n$as a series of increasing$\sigma$-fields write (as usual): $$S_n = S_{n-1} + W_n$$ where$W_n$are the winnings at time$n$, then $$E[S_n | \mathcal{F}_{n-1}] = S_{n-1} + E[W_n | \mathcal{F}_{n-1}]$$$W_n$only depends on the last 3 tosses of the coin so only players who joined at$n-2$,$n-1$and$n$contribute. For the player joining at$n-2$only 2 possible combinations contribute to winnings at time$n$: $$r_{n-2} = 1, r_{n-1} = 0, r_n = 1$$ winning \$4, and
$$r_{n-2} = 1, r_{n-1} = 0, r_n = 0$$ winning -\$4. (The mistake I had made was thinking that$ r_{n-2} = 1, r_{n-1} = 0, r_n = 1$gave winnings of \$7 at time $n$ and $r_{n-2} = 1, r_{n-1} = 0, r_n = 0$ winnings of -\$1 at time$n$.) So the expected winnings for player$n-2$at time$n$, given$\mathcal{F}_{n-1}$(as$r_{n-2}, r_{n-1} \in \mathcal{F}_{n-1}$), are 0 (all combinations have equal probability of occurring). Similar holds for the players who joined at$n-1$and$n$. Therefore $$E[W_n | \mathcal{F}_{n-1}] = 0$$ and $$E[S_n | \mathcal{F}_{n-1}] = S_{n-1}$$ Therefore$S_n\$ is a martingale.