One hundred prisoners are lined up in a single-file row, all facing the same direction. A warden places a hat—either black or white—on each prisoner's head at random. The rules of the game are:
Each prisoner can see the colors of all the hats in front of them, but they cannot see their own hat or any of the hats behind them.
Starting from the back of the line (the 100th prisoner), the warden asks each person to guess their own hat color.
A prisoner can only say the word "Black" or "White". If they guess correctly, they are set free; if they are wrong, they are executed silently.
Every prisoner can hear the guesses made by those behind them, but they do not know if those guesses were right or wrong (no feedback from the warden until the end).
Before the game begins, the prisoners are allowed to huddle and agree on a strategy.
What strategy can the prisoners use to guarantee that at least 99 of them survive