Press any button. The machine has already written down which.
Before every press, this page writes down what you will choose. Make it wrong.
You against the machine
The buttons or the ← → keys.
The paper test
The machine needs JavaScript, but you can test yourself on paper.
Write 50 letters, L or R, as randomly as you can. Do not flip a coin.
Count how many times the letter changed. A coin averages 24 or 25 changes out of 49 possible.
Find your longest run of one letter. In 50 coin flips a run of 5 or longer turns up 82% of the time.
If you have clearly more changes and no long runs, the machine would have something to hold on to.
Spoilers from here on
Everything below explains the trick and makes it harder to play honestly. Finish the first attempt before you read on. All three would be better.
It does not read minds
A memo about this trick has an odd title: "A Mind-Reading (?) Machine". Claude Shannon put that question mark there himself, in March 1953.
This page does not read anything either. There is no camera, it does not time your presses, and it sends your answers nowhere. All it has is a list: what you pressed, whether it guessed right, and what you pressed right after. Before each move it looks up similar situations in that list and writes down its answer before you touch a button.
Against real randomness, the trick is powerless. We ran it on a million simulated coin flips and it guessed 50.0%. So over many games, whatever it scores above half, it takes from you.
You were impersonating a coin
Scott Aaronson wrote a similar program for a class he taught at Berkeley and explained its success in a line: most people do not know how to type randomly, and they have too many alternations.
A coin is cruder than we are. In 50 flips, a streak of five or more of the same side turns up 82% of the time. To a person, a fifth press in a row feels suspicious, so they switch. Look at your longest streak in the result of your first attempt.
You were trying to look random. Random does not look like that.
The boy who won all the marbles
Edgar Allan Poe turns up in the first paragraph of Shannon's memo. In Poe's "The Purloined Letter", the detective Dupin recalls an eight-year-old who played even and odd and won all the marbles in his school. He studied his opponents: a simpleton who had even will switch to odd, while a slightly cleverer one will think again and keep it even.
The game also has a rival theory, from von Neumann and Morgenstern. Shannon mentions both and writes that, oddly enough, his machine is aimed more nearly at Poe's method than von Neumann's.
The boring machine and two rows of lights
The first such machine was built by Shannon's Bell Labs colleague David Hagelbarger. People found it boring. So he added two rows of 25 lights across the top: red when the machine won, green when the human did. In that form it became an office hit.
Shannon built a simplified version. The argument about whose was better ended the way engineers end arguments: they built a third machine as umpire, connected the other two, and let them play several thousand games. The small one won about 55 to 45. In 2020, researchers in Sibiu rebuilt both in software: over ten games of 100 plays each, the simpler machine averaged 55.8 points to 44.2.
Shannon's machine kept an overall score against everyone who sat down with it. The writer William Poundstone saw it in the storage facility of the MIT Museum. The final score was still on it: player 3507, machine 5010.
Its maker knew how to beat it
Shannon worked out the weak spot himself: with the best possible play, the machine can be beaten in the ratio 3:1. You have to track all of its memory, repeat a pattern twice, wait until it is ready for you, then change the pattern. He added right away that this is extremely difficult to do in your head.
Half a century later, Aaronson admitted the same thing: he could not beat his own program, even knowing exactly how it worked. On the people he challenged, it reached prediction rates between 70% and 80%.
The score may work for the machine
Poundstone reasoned that the feedback was useless if the goal is to play randomly, and tested it on software versions of the machine. He did better when he tried to ignore the feedback, and better still when he could not see it at all, and he says he could then beat the machine much of the time. He also tried on purpose to stay on one choice longer than felt natural, and he does not claim he became random. He called the scoring "trash talk": it nudges you to think about what worked last time. That is exactly what Shannon's machine feeds on. Its eight situations are made of whether you won and whether you changed your choice.
This is one person's experience, not an experiment. Rainer Glaschick, who built replicas of Shannon's machine, objects: truly random input can only average 50%, so it cannot beat the machine. On truly random input he is right. But 50% is still better than the 41% players were left with on Shannon's counters.
Now you know why this game talks. "When I get you right, you switch" is not an observation. It is an invitation to change something else and hand over new material. That is why it goes quiet in the second attempt. One game proves nothing: a gap under 20 points is easily explained by chance, and in the second attempt it also has a head start, because it remembers the first. Play a few.
Shannon's Bell Labs colleague David Slepian said Shannon would have been the world's best con man.
Who gets paid for this
For some people this game is a job. The economist Ignacio Palacios-Huerta studied penalty kicks in professional soccer and reported in 2003 that players' choices were serially independent: they did not depend on earlier kicks.
Others, in another large study, did not manage it even at high stakes. Kenneth Kovash and Steven Levitt looked at more than three million pitches in baseball and 125,000 plays in American football. In both sports they found a familiar habit: negative serial correlation in play calling, meaning teams switch away from their last call too readily. Pitchers also appear to throw too many fastballs, and football teams pass less than they should. By their rough estimate, correcting all these errors could be worth as many as two extra wins a year to a baseball club.
The one easy way not to lose
The third attempt may have pleased you: up to 20 out of 20. But you won by looking at its prediction and pressing the other button. It was still the reason for every press.
Take a real coin: heads for left, tails for right. Over many games the machine falls back to half, and that is the limit. You cannot get ahead of it that way, only draw. And look at the price: to become impossible to predict, you had to stop choosing.
Aaronson did find one student the program predicted exactly 50% of the time. He asked him what his secret was. The student said he just used his free will.
Go back to the top and try it.
Sources & further reading
- Claude Shannon. A Mind-Reading (?) Machine, Bell Laboratories Memorandum, 18 March 1953
- William Poundstone. How I Beat the Mind-Reading Machine
- Breazu et al. On Hagelbarger’s and Shannon’s matching pennies playing machines, 2020
- Scott Aaronson. PHYS771 Lecture 18: Free Will
- Rainer Glaschick. Shannon´s "Mind-Reading Machine", 2024
- Edgar Allan Poe. The Purloined Letter, Project Gutenberg
- Palacios-Huerta. Professionals Play Minimax, Review of Economic Studies, 2003
- Kovash, Levitt. Professionals Do Not Play Minimax, NBER, 2009