Get Out Of Jail Pass
In order to guess your correct hat color, you have to think of what your inmates would guess. Albert is unsure about the color of his hat, however, had there been two white hats in front of him, he would know that his is black.

Barry also can’t guess unless he knew for sure that you had a white hat. Since neither Albert not Barry can guess, it means that you must have a black hat on your head. Well done! You freed your inmates and got a get out of jail pass. That was not easy but with some cunning thinking you are now a true hero!