In a variant of this puzzle, the prisoners know that there are 3 hats of one color and only 1 hat of another (e.g. 3 black and 1 white ) , and the 3 prisoners can see each other i.e. D sees B & C, B sees D & C, and C sees D & B. (A again cannot be seen and is only there to wear the last hat.) 
In a variant of this puzzle, the prisoners know that there are 3 black hats and 1 white hat , and the 3 prisoners can see each other i.e. D sees B & C, B sees D & C, and C sees D & B. (A again cannot be seen and is only there to wear the last hat.) How can they deduce the colours of all of them without communicating?
R
hats of one color and only
black hats and
R
hat of another (e.g. 3 black and 1 white )
white hat
A
How can they deduce the colours of all of them without communicating?