Model Card for ESP32 Rock, Paper, Scissors: human habits
A tiny fixed network (499 parameters, 2.4 KB) that predicts a person's next rock, paper, scissors throw from the last three rounds. It is trained on 102,000 recorded rounds of people playing, and it is one member of a team of learners that plays rock, paper, scissors on an ESP32-S3 (M5Stack CoreS3), learning the player as the game goes.
Model Details
Model Description
Input: the last three rounds, each one-hot as the player's throw, the opponent's throw and the outcome (27 values; zeros for rounds not yet played). Then 16 tanh units, then 3 outputs, a softmax over the player's next throw (rock, paper, scissors).
On the device it never trains. The rest of the team (an online network of the same shape that trains after every round, and counting learners over the player's recent throws) learn the player as they play; each member is scored on how well it has predicted the player lately, and the team leans on the best. This network starts each game with a head start, so the first rounds are not guesses. The device locks in its own move before the player chooses, so it can only win by predicting.
- Developed by: Justin McLean
- Model type: multilayer perceptron, 27 β 16 (tanh) β 3
- License: MIT
Model Sources
Uses
Direct Use
The fixed prior for the learner in the repository's firmware/src/rps_model.h, which
compiles it in from rps_pretrained.h. Rock, paper, scissors on an ESP32-S3, on a computer
(host/rps.c), for fun, demos and teaching how a machine can learn a person's habits.
Out-of-Scope Use
Anything about real people beyond a game: it knows only throws in rock, paper, scissors.
Bias, Risks, and Limitations
- Trained on people recorded in online experiments at UC San Diego, mostly university students playing for course credit. Other players may open and react differently.
- It knows people in general, not the player in front of it. It lifts the team's early predictions from 37% to 44% (chance is 33%), and is meant to be overtaken by the learners that learn the player.
Training Details
Training Data
Rock, paper, scissors games recorded by Erik Brockbank and Edward Vul: 345 players and 102,318 rounds.
| Games | Players |
|---|---|
| People against people, 300 rounds (rps; Brockbank & Vul, Games, 2021) | 86 |
| People against fixed-pattern bots (rps-bot-manuscript-public, CC0 1.0; Brockbank & Vul, Cognitive Psychology, 2024) | 130 |
| People against learning bots (same) | 129 |
Only the throws are used: no ids, timings or other details.
Training Procedure
training/pretrain.py: one example per round (the three rounds before it and the throw the
player made), cross-entropy loss, Adam (learning rate 0.003, weight decay 0.0001), early
stopping on 10% of players. Under a minute on a laptop.
Evaluation
training/crossval.py: five-fold cross-validation by player. For each fifth, a fresh
network is trained on the other players, and the full device learner plays the held-out
players' real games round by round, with and without it. How often the team predicts the
next throw:
| Held-out players | Rounds 1 to 5 | 6 to 20 | 21 to 60 | 61 on |
|---|---|---|---|---|
| People against people | 37% β 44% | 38% β 44% | 44% β 46% | 49% β 49% |
| People against learning bots | 37% β 47% | 38% β 44% | 42% β 47% | 52% β 54% |
| People against fixed-pattern bots | 37% β 47% | 46% β 52% | 61% β 63% | 74% β 75% |
In the first 10 rounds against the people-against-people players, the learner's locked-in move wins 43% and loses 28% (a replay: those players were answering someone else).
Files
rps-human-habits.safetensors: the weights, float32:w1[16, 27],b1[16],w2[3, 16],b2[3]. Hidden layertanh(w1 Β· x + b1), outputw2 Β· h + b2.playing.png: a game on the M5Stack CoreS3.
Citation
The data:
@article{brockbank2021formalizing,
title={Formalizing opponent modeling with the rock, paper, scissors game},
author={Brockbank, Erik and Vul, Edward},
journal={Games},
volume={12},
number={3},
pages={70},
year={2021}
}
@article{brockbank2024repeated,
title={Repeated rock, paper, scissors play reveals limits in adaptive sequential behavior},
author={Brockbank, Erik and Vul, Edward},
journal={Cognitive Psychology},
volume={151},
pages={101654},
year={2024}
}
