The king summons the three wisest sages in the kingdom and says he will test them. Whoever wins will become his trusted advisor.

The king has a number of hats, blue and white. He will put blindfolds in all the three sages, and then put a hat on their heads. When he removes the blindfold, each sage can see each the others' hat, but not their own. The king assures them at least one of them is wearing a blue hat; there could be three blue hats, or two blue and one white, or two white and one blue, but not three white.

The winning sage will be the first to announce the colour of their own hat. However, if a sage speaks up and guesses wrong, they will die.

So, as the blindfold is removed, one of the sages observes the other two have blue hats. They all look at each other, clearly nobody coming up with an answer. Time passes, and then the sage confidently announces: "I know! My hat is..."

Blue.

The sage, let's call her A, sees that B and C have blue hats, so her own hat could be blue or white. But she also sees the other sages hesitating and not coming up with an answer.

Now, if B was seeing a blue hat on C and a white hat on A, B could reason as follows: "C sees A's white hat, and my own hat. If my hat was white, C would see two white hats and so be certain his own hat must be blue, but C is not speaking up. Therefore, my hat can't be white, it must be blue." But B says no such thing. A trusts that B would be able to think of that, since he is one of the wisest sages in the kingdom, so the most likely explanation is that B is not seeing a white hat on A. Therefore, she guesses correctly that her hat is blue.

If there was a general riddle-solving AI that got that one right, I would actually be impressed. Guessing you can talk because you talked is less impressive.