The Puzzle of Black and White Hats

Here is the puzzle of Black and White Hats, a really addictive logic problem that will require all your efforts!