Rock, Paper, Scissors
By Lucy Hattersley. Posted
Rock, paper, scissors for the modern day? Nicola King investigates a very contemporary twist on an old favourite
Take back control of your online data, with Raspberry Pi.
The traditional game of rock, paper, scissors has been given a very modern slant by Canadian aerospace engineer Julien de la Bruère-Terreault.
He has developed a computer-vision and machine-learning-driven version, pitting one player against a computer.
“The idea for the project actually comes from my son,” reveals Julien. After coding a text-based rock, paper, scissors game in Python, Julien was experimenting with basic computer vision on his Raspberry Pi when his son asked if he could make a version of the game that uses the camera to detect the hand gestures. “Knowing it was feasible, I accepted the challenge, seeing this as an opportunity to learn a lot in the process.”
Over the course of a year, Julien developed his skills around machine learning and computer vision. “The challenge for me in this project is that I had to learn almost everything required to make it work,” he says. “Developing and testing the machine-learning algorithm was the most difficult part.” This algorithm, or ‘classifier’, teaches the computer to recognise a set of hand gestures: “[It] has been previously ‘trained’ on a bank of labelled images corresponding to the rock, paper, and scissors hand gestures.”
Training AI to play Rock, Paper, Scissors
Julien began the project by designing the 3D-printed fixture to hold the camera and LED lighting strips. He then developed a simple application to capture training images to develop the machine-learning algorithm.
“I started with an initial set of approximately 150 labelled images.” As this was quite a low number, “I had to select a relatively simple algorithm with few parameters to tune and perform dimensionality reduction on the images.”
Once happy with the algorithm, Julien began work on enabling the game to be played in real-time, adding the logic and graphical interface.
He says the Raspberry Pi was an integral part of the build: “With its Camera Module and great Picamera library, its portable size and sufficient computing power, the Pi was the ideal platform to develop this project.”
Lucy is Editor of Raspberry Pi Official Magazine.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Paper console
Look at those physical controls! This device is built to be beautiful: it’s made out of walnut and brass.
Read more →
Take Back Your Cloud in Raspberry Pi Official Magazine 165
We’re all-too accustomed to the feling of being watched on the internet. A search for any product leads to adverts, emails, and goodness knows how many bots tracking you. It feels weird and intrusive, and we aren’t being paranoid – they really are watching us. Luckily you don’t have to reply on online services that […]
Read more →
Win one of three Raspberry Pi 4 with 3GB RAM!
Raspberry Pi 4 is still a powerful piece of kit, and this new 3GB version is great for projects and builds that need slightly more than 2GB of RAM but don’t quite need 4GB. We have three to give away and you can enter below. Win 1 of 3 Raspberry Pi 4 3GB
Read more →

