9. Two people, A and B, play a number guessing game. First, A thinks of a number, denoted as $a$, then B guesses the number A just thought of, and the number B guesses is denoted as $b$, where $a, b \in \{1,2, \cdots, 6\}$. If $|a-b| \leqslant 1$, then A and B are said to have "close hearts." If two people are randomly chosen to play this game, the probability that they have close hearts is ( ).
(A) $\frac{4}{9}$
(B) $\frac{2}{9}$
(C) $\frac{7}{18}$
(D) $\frac{5}{18}$
9. A.

By the classical probability model, we know there are a total of $6 \times 6=36$ basic events, and those that satisfy $|a-b| \leqslant 1$ are
$$
\begin{array}{l}
(1,1),(1,2),(2,1),(2,2),(2,3), \\
(3,2),(3,3),(3,4),(4,3),(4,4), \\
(4,5),(5,4),(5,5),(5,6),(6,5), \\
(6,6),
\end{array}
$$

There are a total of 16.
Thus, the required probability is $\frac{16}{36}=\frac{4}{9}$.