Stuck on Penney's game question Suppose we have a game that assumes we have a fair coin. Two people who are playing can pick two patterns of coin flips. The players then flip a large coin a number of times and record each of the individual flips.
After the flips, they pay attention to the record of flips and decide which pattern came first in the sequence.
Using simulations, we can find:

*

*HHT comes before THH about 1/4th of the time

*THH comes before TTH about 1/3rd of the time

*TTH comes before HTT about 1/4th of the time

*HTT comes before HHT about 1/3rd of the time

Can someone explain to me why this is and what the intuition behind this game is?

Appropriate diagrams make these results intuitive -- and they can even lead to exact calculations with little effort.

Probability flows like water (or any other conserved substance).  After observing a sequence $\omega$ of coin tosses, its probability is split into two "flow channels" according to the chance of heads, $p,$ and the chance of tails (which must be $1-p$ to conserve probability).

In technical notation, this picture describes two conditional probabilities $p = \Pr(\omega H\mid \omega)$ and $1-p = \Pr(\omega T\mid \omega).$
Because all examples in the question involve sequences of three flips, nothing interesting happens until after the first three flips.  At this point there are $2^3=8$ possible states, such as THH (tails, then heads, then heads), and because the coin is fair, all states have a chance of $1/8.$
From then on, by focusing on the most recent run of three outcomes, each flip induces a transition from the current state to another state.  For instance, a THH followed by a tails transitions to HHH.

The initial state probabilities are like pools of water, with a volume of $1/8$ in each pool.  The transitions make the water flow out of each pool into two pools.

Here is the full diagram of all transitions.  Solid red arrows are the transitions occurring when a head is observed; dashed blue arrows are the transitions occurring when a tail is observed.

By means of examples, I will show how to compute with this graph.
Example 1: THH vs. HHT
The game ends upon encountering either THH or HHT.  We can model this by removing all outflows from these pools.  Having done this, the water eventually will reach one of them and collect there.

The chance that THH is reached first equals the amount of water (probability) that accumulates in the THH basin.

Here is the preceding transition diagram with (i) the outflows from THH and HHT removed and (ii) THH outlined in black, HHT outlined in green.

Removing the outflows has disconnected the flow system.  It is visually obvious that all water (probability) originally at HHH or HHT eventually ends in HHT.  Therefore the chance HHT is reached before THH is $(2)\times(1/8) = 1/4.$  This is the first example of the question.
Example 2: THH vs. THT
Not all analyses are so simple.  Here is the pruned graph for THH vs. THT.

Some pools flow eventually into both the terminal basins.  However, there are obvious groups of pools: HHH eventually flows only into HHT.  We might as well think of this as a pool with $1/8+1/8=1/4$ of the water (probability).  HTT and TTT eventually flow into TTH.  We might as well merge them into a pool with $3/8$ of the water.  In doing these merges, we must retain all inflows and outflows.  Here is the resulting "reduced graph."

A neat way to compute how much water (probability) ends in the THH basin is to create a "flow fractions" graph.  It begins by assigning 100% of the water in THH to the THH basin and 0% of the water in THT to the THH basin.  Then it works backwards through the graph.  For instance, HTH splits its outflows between THH and THT.  Thus, only 50% (1/2) of the water in HTH winds up in THH.  The same is true for the combined HTT/TTT/TTH pool: half its water (probability) ends up in THH.  Finally, the outflow from the HHH/HHT pool is split between HTH and the HTT/TTT/TTH pools.  Since each of the latter contribute half their water to THH, the same must be true for HHH/HHT.
Here is the resulting flow fractions graph, drawn to parallel the reduced graph:

Finally, recall how much water begins in each pool: $1/8$ in THH, $1/8$ in HTH, $1/8$ in THT, $3/8$ in HTT/TTT/TTH, and $2/8$ in HHH/HHT.  Multiplying these amounts by the flow fractions gives
$$\frac{1}{8} \times 1 + \frac{1}{8} \times \frac{1}{2} + \frac{1}{8}\times 0 + \frac{3}{8}\times \frac{1}{2} + \frac{2}{8} \times \frac{1}{2} = \frac{1}{2}.$$
Thus, the chance THH is encountered first is $1/2.$
Example 3: THH vs. TTH
This is the second example of the question.
Again begin by pruning the graph to remove all outfalls from the target basins:

Collect groups of interconnected pools into the reduced graph.

It is already obvious that TTH has the advantage, because most of the pools drain wholly or partly into it.
The challenge this time is to compute the flow fractions: the water can swirl endlessly between HTH and THT.  However, half is lost forever to THH when flowing out of HTH and half is lost forever to TTH when flowing out of THT (because eventually it flows only into TTH).  This HTH-THT loop, though, seems to make it impossible to backtrack through the graph.
The solution is to leave one of the fractions as an unknown $x.$    Here, I have arbitrarily chosen to let $x$ be the flow fraction for THT.

The flow fraction for HTH is $1/2\times 1$ because of the flow into THH plus $1/2\times x$ because of the flow into THT.
Upon visiting all the nodes, we obtain two expressions for the THT flow fraction.  This yields the equation
$$x = \frac{1}{2}\times \frac{1+x}{2} + \frac{1}{2}\times 0,$$
whose (unique) solution is $x=1/3.$  Now we can just read off the remaining flow fractions: $(1+x)/2 = 2/3$ for HTH and $1/3$ for the HHH/HHT pool.  The chance of reaching THH first therefore is
$$\frac{1}{8}\times 1 + \frac{1}{8}\times \frac{2}{3} + \frac{1}{8}\times \frac{1}{3} + \frac{3}{8}\times 0 + \frac{2}{8} \times \frac{1}{3} = \frac{1}{3}.$$
Comments
These graph calculations generalize.  It is clear how they can be applied to comparing any two terminal states in this game.  But no change needs to be made when terminating the game at multiple states.  For instance, suppose you play this game against an opponent who wins if either TTH or THT is reached and you win if THH is first reached.  What are your chances of winning?
Here are the pruned graph, the reduced graph, and the flow fractions.  You can do the arithmetic.

