The warden places on the head of each prisoner a red hat or a black hat.
Heh. This is the easy version of the puzzle then. Hard version: The hats have arbitrary colours (suppose they are specified by infinite precision RGB values).
If it's worth saying, but not worth its own post (even in Discussion), then it goes here.