Rock, Paper, Mind Reader
Let's play rock, paper, scissors! I always lock in my move before you choose, so I can't cheat. My only trick is spotting your habits. Press R, P or S to start!
How often Robo wins
The pattern table Robo learned
Checkpoints — Robo's brain saved along the way. Tap one to see how that younger Robo would do today.
How it works
Remember
Robo writes down every round: what you played, what it played, and who won.
Five spotters
Each spotter looks for one kind of habit: a favourite move, what you play after a move, after two moves, after winning or losing, and whether you copy Robo.
Trust who's right
Spotters that guessed right lately are trusted more. Robo mixes their guesses into one.
Lock in
Robo locks in the move that beats its best guess, before you choose. Old rounds slowly fade, so new habits get noticed.
What just happened?
- At first Robo knew nothing, so it won about 1 round in 3, just like guessing.
- As soon as you (or a robot player) had a habit, one of its spotters saw it, Robo trusted that spotter, and its wins shot up.
- When the habit changed, Robo lost for a few rounds, then adapted: another spotter took over.
- Against truly random play Robo stays near 33%. That's not Robo being silly: no one can predict a fair dice. Being random is the best defence, and it's surprisingly hard for people!
- Phone keyboards, video sites and shops use the same idea: they look at what you did before to guess what you'll do next.
For grown-ups: what's really going on
This is online sequence prediction with a mixture of experts. Every round Robo predicts a distribution over the opponent's next move, plays the best response to the most likely move, then updates.
- Experts (5): frequency counts over moves (order-0); an order-1 Markov model conditioned on the opponent's last move; an order-2 Markov model conditioned on their last two moves; a win-stay / lose-shift detector that counts the opponent's move relative to their own last move (same / the move that beats it / the move it beats), conditioned on the last result; and a "copies Robo" detector that counts their move relative to Robo's last move.
- Counts: per context, with exponential forgetting: before each update the context's counts are multiplied by the memory
γ(slider, default 0.9, an effective window of about 1/(1−γ) = 10 visits). Predictions use add-0.2 smoothing:p = (c + 0.2) / (n + 0.6). - Gating by recent accuracy: each expert keeps an exponentially weighted hit rate
a ← 0.85·a + 0.15·hit(hit = 1 if its argmax was right, split on ties). Mixing weights are a softmaxwe ∝ exp(10·ae), and the prediction isΣ we pe. This is a simple cousin of the Hedge / multiplicative-weights algorithm. - Decision: Robo commits
beats(argmax p)before seeing the opponent's move (ties broken at random), so it never sees the move it is answering. - Measured in Node (seeded, 200 rounds each): against Always-rock, Cycler, Copycat and Sore loser, Robo won 100% of the last 50 rounds; it first hit 80% over a 20-round window right at round 20. Against Truly random, Robo averaged about 33% (32–34% depending on the seed) over 40 runs of 300 rounds. A simulated "human-style" player who avoids repeating a move 85% of the time lost about 39% of rounds.
- Game theory: the Nash equilibrium of rock-paper-scissors is the uniform mixed strategy. Against it, every strategy, however clever, has expected win rate 1/3. Any detectable bias, even a subtle one like avoiding repeats, is exploitable, which is why RPS bots in online competitions use ensembles of exactly these kinds of predictors.
- Peeking shows Robo's committed move. Knowing a model's prediction lets you exploit it, a small taste of adversarial attacks on predictors.