How to Play the Hat Game