Rock-paper-scissors with an Arduino robot hand
A high school club project controlling an InMoov robot hand and comparing theoretical probability with 100 actual rounds.
July 14, 2020
I first encountered C and Arduino in a high school club. Printing characters on a screen was exciting at first, but I soon wanted my code to make something move.
I built an InMoov robot hand, wiring the servos and circuitry and making it form rock, paper, or scissors when a button was pressed. Then I wanted to test what I had learned in probability and statistics through an actual experiment.
Making the hand move
Each finger is connected to a servo. Changing the motor angles bends or straightens the fingers to create a gesture. I connected motors and a button to Arduino, then changed the hand shape after a short delay following a button press.
At first, the circuit and code felt disconnected. A finger would move incorrectly even when the code looked right, or the button timing felt awkward. I checked wires and motors one by one and adjusted the angles. That was when I began to understand that code does not end at the screen.



Playing against the robot
The robot randomly chose one, two, or three, corresponding to rock, scissors, and paper. Two seconds after pressing the button, it formed the selected gesture. A person played against it and recorded the outcome.
If both sides independently choose each gesture with equal probability, winning, drawing, and losing each have probability 1/3. There are nine possible pairs, with three for each outcome.
| Outcome | Theoretical probability | Result over 100 rounds |
|---|---|---|
| Win | 1/3 | 31 · 0.31 |
| Draw | 1/3 | 37 · 0.37 |
| Loss | 1/3 | 32 · 0.32 |
The results did not divide perfectly into thirds. Draws were slightly more common, and wins differed from losses, but all three values were near one third. I expected more trials to bring the observed proportions closer to the theoretical probabilities.
When a formula becomes an experiment
Textbooks introduce probability through cases and equations. Here, those equations became robot movements, button inputs, and one hundred records. The imperfect results made probability feel more tangible: theory gives a reference, and an experiment shows how it appears in practice.
It was a small project, but the experience of expressing conditions in C, sending signals to Arduino, and organizing outcomes in a table stayed with me. My habit of defining a rule and checking it in practice began around then.