Project 6Music and games30 min
π² Let's Play! - Rock, Paper, Scissors
Make your own rock, paper, scissors game to take everywhere.
Workshop projects (6 of 6)
Let's make the most famous game in the world on your micro:bit! You'll be able to play with your friends anywhere.
How does the game work?
The micro:bit will randomly choose between:
- πΏ Rock: beats scissors, loses to paper
- π Paper: beats rock, loses to scissors
- βοΈ Scissors: beats paper, loses to rock
How to play?
- You and your friend shake your micro:bits at the same time
- A result appears on each micro:bit
- Compare them to see who wins!
Step 1: Create the project
- Create a new project called "Rock Paper Scissors"
- At the start, let's show a welcome message
In "on start", add:
- A "show string" block with "SHAKE TO PLAY!"

Step 2: Program the game
Now comes the fun part! Let's make a random choice appear when you shake it.
- Drag an "on shake" block to the workspace
- We'll need a variable to remember the choice
Make a variable:
- Go to the "Variables" category
- Click "Make a Variable..."
- Call it "choice"

Program the logic:
Inside the "on shake" block:
-
Give it a random number:
- Drag "set choice to"
- Go to "Math" and find "pick random 1 to 3"
-
Decide what to show:
- Go to "Logic" and drag an "if... then... else" block
- Click the plus sign β to add more conditions (you need 3 in total)
It will look like this:
if choice = 1 then
show leds (rock)
else if choice = 2 then
show leds (paper)
else
show leds (scissors)

Step 3: Try your game!
- In the simulator, click "SHAKE"
- Does one of the three options appear?
- Try several times to see it change

Fun improvements
Add sound
Give each option its own sound:
- Go to "Music"
- Add different tones after each "show leds":
- Rock: low tone (262 Hz)
- Paper: middle tone (523 Hz)
- Scissors: high tone (1047 Hz)
Add a countdown
Make the game more exciting with a countdown!
Change the "on shake" block so it first does:
- Show "3"
- Pause for 1 second
- Show "2"
- Pause for 1 second
- Show "1"
- Pause for 1 second
- Show the result!
Advanced version: Multiplayer
Want to make the game even cooler? Let's add a scoreboard!
Add buttons to compare
- Button A: "I won!"
- Button B: "I lost!"
Make score variables
- Make a variable called "my_points"
- Make another one called "rival_points"
Program the buttons
In "on button A pressed":
- Change "my_points" by 1
- Show "my_points"
In "on button B pressed":
- Change "rival_points" by 1
- Show "rival_points"
What have you learned?
- β How to use random numbers
- β What variables are and how to use them
- β How to use conditions (if... then...)
- β How to make a whole game
- β How to add sounds and effects
Common problems
π€ It always shows the same thing?
- Check that you're using "pick random 1 to 3"
- Make sure the variable changes every time you shake it
π€ Nothing appears when you shake it?
- Check that the "set choice" block is inside "on shake"
- Check that the conditions are "choice = 1", "choice = 2", etc.
π€ The drawings don't look right?
- Check that you clicked the right LEDs in each "show leds"
Extra challenges
- Add "Lizard" and "Spock" (like in "The Big Bang Theory")
- Make a tournament: The first to reach 5 points wins
- Hard mode: Make the result appear faster
- Statistics: Count how many times each option comes up
Congratulations!
You've finished all the projects in the workshop! Now you have a micro:bit that can:
- Show messages
- React to buttons
- Notice movement
- And even play with you!
What can you do now?
- Show your programs to your friends and family
- Experiment by mixing ideas from all the projects
- Find out what other sensors the micro:bit has
- Invent your own games and programs!
Next steps
If you enjoyed programming, you can:
- Learn other programming languages
- Explore Arduino or Raspberry Pi
- Join a robotics club
- Keep making amazing things!