I am working on this problem and was wondering if I could get some feedback on my attempt at the proof. My gut tells me that I need a stronger argument as why my covering is actually a cover. I also wouldn't mind hearing suggestions for alternative approaches. It seems that assuming that $f$ is not constant would lead to an easy contradiction of the connectedness of $X$, but I wasn't able to come up with a nice write-up that way. I also imagine that there are cleaner ways of doing a direct proof. Thanks!
[Wade, 10.5.6] $X$, $Y$ are metric spaces, $f: X \to Y$. If $X$ is compact, connected, and if to every $x \in X$ there corresponds an open ball $B_x$ such that $x \in B_x$, and $f(y) = f(x)$ for all $y \in B_x$, prove that $f$ is constant on $X$.
Proof.
Start with any $x_0 \in X$, and it's corresponding open $B_{x_0}$ and suppose $f(x_0) = f(B_{x_0}) = a$ for some $a \in Y$. Next choose $x_1 \in \partial B_{x_0}$, and note that $B_{x_1} \cap B_{x_0} \neq \emptyset$ implying that $f(B_{x_0}) = f(B_{x_1}) = a$. $X$ connected implies that we can continue in this manner (choosing $x_j \in \partial B_{x_{j-1}}$ with $B_{x_j} \cap B_{x_{j-1}} \neq \emptyset$) until $\bigcup_{j \in \textbf{Z}} B_{x_j}$ covers $X$. Further, $X$ compact implies that $\exists$ a set $\{0,1, ..., N\}$ s.t. $\bigcup_{j = 0}^N B_{x_j}$ covers $X$ and $f(B_{x_0}) = f(B_{x_1}) = ... = f(B_{x_N}) = a$ implies $f(X) = a$, thus $f$ is constant on $X$.