  We study the famous mathematical puzzle of prisoners and hats. We introduce a
framework in which various variants of the problem can be formalized. We
examine three particular versions of the problem (each one in fact a class of
problems) and completely characterize them as to (non)existence of winning
strategies.
