6. Students $A$ and $B$ each have 3 cards. They play a game by tossing a fair coin. When the coin lands heads up, $A$ wins a card from $B$, otherwise, $B$ wins a card from $A$. If one person wins all the cards, the game ends. What is the probability that the game ends exactly after 5 coin tosses? ( )
(A) $\frac{1}{16}$
(B) $\frac{1}{32}$
(C) $\frac{1}{8}$
(D) $\frac{3}{16}$
6.D.

Toss a coin 5 times. If $A$ wins, then there is exactly 1 tail in the first 3 tosses, and the remaining 4 tosses are all heads; if $B$ wins, then there is exactly 1 head in the first 3 tosses, and the remaining 4 tosses are all tails.
Thus, the required probability is $P=\frac{3+3}{2^{5}}=\frac{3}{16}$.