Today you will load your hand gesture model into a rock, paper, scissors game in Scratch, and play against the computer.
What might go wrong if the model is only slightly sure about a gesture?
Have your model's link ready: you will start a new project and build the game step by step, testing it as you go.
We will build the game in Stretch3, a free version of Scratch that has the extension we need.
It lets your Scratch project use a Google Teachable Machine image model.
The extension turns your camera on straight away. If the browser asks, click Allow. You should then see what the camera shows on the stage.
You can still build and play this game. Follow every step, and watch a neighbour's screen when a step needs a camera. When you reach Get Player Choice, add the three key scripts as well, so the keys 1, 2 and 3 stand in for your hand.
Add a new sprite to the project that will represent the computer's choice in the game. You can choose any sprite you like, but for this example, we'll use the 'Gobo' sprite.
Create two new variables:
playerChoice - to store the player's choice.computerChoice - to store the computer's choice.Leave the tick box beside each new variable ticked, so both show on the stage while you play. That is how you will see what the computer picked: 1 is rock, 2 is paper and 3 is scissors.
You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.