We consider prediction problems in which each of a countably infinite set of agents tries to guess his own hat color based on the colors of the hats worn by the agents he can see, where who can see whom is specified by a graph V on ω. Our interest is in the case in which 𝓤 is an ultrafilter on the set of agents, and we seek conditions on 𝓤 and V ensuring the existence of a strategy such that the set of agents guessing correctly is of 𝓤-measure one. A natural necessary condition is the absence of a set of agents in 𝓤 for which no one in the set sees anyone else in the set. A natural sufficient condition is the existence of a set of 𝓤-measure one so that everyone in the set sees a set of agents of 𝓤-measure one. We ask two questions: (1) For which ultrafilters is the natural sufficient condition always necessary? (2) For which ultrafilters is the natural necessary condition always sufficient? We show that the answers are (1) p-point ultrafilters, and (2) Ramsey ultrafilters.