Lesson at a glance
maze.education/microbit/lessons/rock-paper-scissors
- Grades
- Grades 4 to 6
- Time
- 45 to 60 minutesThe CAPS gives Coding and Robotics 2 hours a week (Coding and Robotics CAPS, Grades 4 to 6, page 22).
- Level
- Some experienceFor classes that have used the micro:bit and MakeCode once or twice.
- Board
- Any micro:bit
- Code with
- MakeCode and Purple Mash blocks, with Python as an extension
- CAPS
- Coding and Robotics, MathematicsAligned: Grade 6, Term 2 · Where it fits
Learning intentions
Learners will learn to:
- Use if, else if and else to choose between three outcomes.
- Link each random number to a picture, the way a game links rules to actions.
- Explain why the game is fair when each choice has the same chance.
Success criteria
Each learner can say:
- I can use if, else if and else so that the program picks one of three pictures.
- I can say which number stands for rock, which for paper and which for scissors in my program.
- I can explain why each choice has a 1 in 3 chance.
Competencies
From the Coding and Robotics CAPS places this lesson cites.
- C.2Present a simple coding solution
- C.3Interpret and execute a given symbolic or written set of commands
- R.5Design a simple artefact based on a set of design instructions
Key words
- condition
- A question with a yes or no answer, such as: is hand equal to 1?
- if, else if, else
- Blocks that choose which instructions to run, depending on conditions.
- random
- Chosen by chance.
- variable
- A named box in the computer's memory that holds a value.
- flowchart
- A diagram of the steps and decisions in a process, read from the top.
What you need
- One micro:bit per learner, so pairs can play against each other
- A computer with Chrome or Edge for each learner or pair
- A score sheet for each pair
From our shop: BBC micro:bit V2 Go, BBC micro:bit V2.21 Next Gen Classroom Pack
Safety
- Shake the micro:bit with the battery holder held firmly in the same hand, so neither flies off.
- Clear a safe space first: no bags on the floor, and enough room for everyone to move without bumping into each other.
- Use the battery holder with two AAA batteries. Never mix old and new batteries, and take the batteries out before the kits are packed away.
The lesson plan
One lesson of 45 to 60 minutes in three parts: introduction, lesson development and consolidation. The CAPS gives Coding and Robotics 2 hours a week, so it fits one of the week's lessons. Times are a guide.
Introduction
5 to 10 minutesRetrieval practiceWhat does an IF…THEN statement do? (It checks a condition, and runs some steps only when the answer is yes.)
Problem statementWhen two groups both want the netball court at break, they settle it with rock, paper, scissors, and someone always says the other side threw late. Build a thrower that picks by chance when you shake it, and check that it is fair.
- Play a quick round of rock, paper, scissors with the class. Ask a learner to explain the rules, and write them as if sentences: if I show rock and you show scissors, then I win.
- Read the problem statement together. Ask: what makes a throw fair?
Lesson development
35 to 40 minutes- Unplugged first. Make three cards numbered 1, 2 and 3 and agree that 1 is rock, 2 is paper and 3 is scissors. A learner picks a card without looking, and the class says which hand to show. That is exactly what the program will do.
- Plan on paper first. Pairs draw a flowchart: a shake, a random number from 1 to 3, then the questions in order. Is it 1? Is it 2? Otherwise it must be 3.
- Predict. Ask: how many questions does the program need to ask for three choices? What will show if the random number is 3?
- Build in blocks. Pairs share one computer. The driver builds the program from the Blocks tab; the navigator follows the flowchart and checks that each question is in the right order. Swap roles halfway, at the if then else block.
- Test and debug. Shake several times in the simulator. Do all three pictures appear? If one never shows, compare the conditions with the flowchart.
- Download it, then play best of ten against a partner and keep score on the sheet. Discuss: does each player have the same chance of winning? Why?
Plan on paper: a model answer
In pairs, draw the thrower as a flowchart, from the shake to the picture.
Flowchart
- The micro:bit is shaken
- Set hand to a random number from 1 to 3
- Is hand 1?Yes: show rock (a filled square)No: ask the next question
- Is hand 2?Yes: show paper (the outline of the display)No: show scissors
- Wait for the next shake
Consolidation
5 to 10 minutes- Ask: what would happen if the random block picked 1 to 4?
- Ask: why do we only need to test two conditions for three choices?
- Back to the problem: a pair shares their final score. Was it close? Would the two groups accept the thrower as fair, and why? Learners check themselves against the success criteria.
Build it, step by step
Pairs build the program in blocks, following the numbered steps, with the same program as text beside them to check against or paste. Test in the simulator before sending it to a board.
These are the MakeCode steps. The other routes are on the lesson's web page.
Build it in MakeCode blocks
- Start a New Project and make a variable called hand in Variables.
- From Input, drag in on shake.
- From Variables, put set hand to inside it, with pick random 1 to 3 from Math.
- From Logic, drag in an if then else block. Click the plus sign to add an else if.
- In the first condition, put a 0 = 0 compare block from Logic and make it hand = 1. In the else if, make it hand = 2.
- Put a show leds from Basic in the first two parts, a filled square for rock and an outline for paper, and show icon with the scissors in the else part.
- Test with SHAKE in the simulator, then Download.
let hand = 0
input.onGesture(Gesture.Shake, function () {
hand = randint(1, 3)
if (hand == 1) {
basic.showLeds(`
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
`)
} else if (hand == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else {
basic.showIcon(IconNames.Scissors)
}
})To use the text instead: open MakeCode, start a new project, click JavaScript at the top, replace what is there with this code, then click Blocks to see it as blocks.
To send it to the board, click Download. In Chrome or Edge, MakeCode can connect to the micro:bit by USB so the program goes straight onto it. Otherwise a .hex file downloads: drag it onto the MICROBIT drive.
Purple Mash follows the UK school years, which run about one grade ahead of ours: Year 3 is roughly Grade 2 here, Year 4 roughly Grade 3 and Year 5 roughly Grade 4. 2Simple says its micro:bit lessons can be adapted for other ages, so older learners who are new to the micro:bit can use them too.
These steps are our own. 2Simple's lesson has its own plan, slides and videos, which teachers with a Purple Mash login can use alongside this one.
Our steps in Free Code micro:bit
Block names in Free Code micro:bit are not the same as MakeCode's, so these steps say what each block does. Check the exact names in Purple Mash.
- Log in to Purple Mash and open the lesson from the Computing Scheme of Work, or the micro:bit projects in the Computing area. They use Free Code micro:bit, 2Simple's block coding tool for the micro:bit (2Simple's help pages also call it 2Code micro:bit).
- Open Free Code micro:bit from the Rock, Paper, Scissors lesson.
- When the board is shaken, choose a random number from 1 to 3 and keep it in a variable.
- Use if blocks to show a different picture for 1, 2 and 3.
- Check in Purple Mash how its if block adds an else part.
- Test the program on the on-screen micro:bit (2Simple calls it the micro:bit emulator) before you send it to a board.
- Save your work, open the purple menu at the top and choose Download.Hex. Plug in the micro:bit with a USB cable that carries data and drag the .hex file onto the MICROBIT drive. On an iPad, open the file in the micro:bit app and tap Send to micro:bit.
2Simple says the micro:bit projects can also be coded in Python in Pieces, if your school has it.
Extension: text-based coding, beyond the CAPS
The same program in MicroPython, for the micro:bit Python Editor. It suits Grade 7 to 9 learners who are ready for text-based code. The CAPS itself follows a block-based approach (Coding and Robotics CAPS, Grades 7 to 9, page 24).
# Rock, paper, scissors: shake to throw.
from microbit import *
import random
rock = Image("00000:09990:09990:09990:00000")
paper = Image("99999:90009:90009:90009:99999")
while True:
if accelerometer.was_gesture("shake"):
hand = random.randint(1, 3)
if hand == 1:
display.show(rock)
elif hand == 2:
display.show(paper)
else:
display.show(Image.SCISSORS)
sleep(100)Open the Python editor, replace the code that is there with this program (or open the downloaded file), then click Send to micro:bit. MakeCode also has a Python view, which is written a little differently.
Extension or homework
Challenges for learners who finish early, or to take further in a club or as homework.
- Challenge 1
Play against a partner's board by radio: each board sends its choice, and both show who won.
- Challenge 2
Play 30 rounds and tally how often each choice comes up. Is the micro:bit fair?
- Challenge 3
Show the choice as a short animation before the final picture, so the throw feels like a real game.
Support and extension
Support
For learners who need more help
- Give out the program with the pictures already drawn, so learners only build the random number and the if blocks.
- Use three icons instead of drawing with show leds.
Extension
For learners who are ready for more
- Add a score: make a variable called wins, and press A to add one and B to show it.
- Add a fourth choice (lizard? spock?) and write the new rules.
Informal assessment
Ask these as learners work. Informal assessment happens every day and is not recorded.
- What is a condition? Give an example from the program.
- When does the else part run?
What is the chance of throwing rock on one shake?
Observation checklist
Watch pairs as they plan, build and test. Write each pair's initials under the level you see.
| Watch for | Beginning | Developing | Accomplished | Exemplary |
|---|---|---|---|---|
| Draws the decisions in the right order before building. | ||||
| Builds if, else if, else with the right number in each condition. | ||||
| Predicts what shows for each number, then tests all three. | ||||
| Explains the 1 in 3 chance in their own words. |
- Beginning:
- not yet, even with help
- Developing:
- with help
- Accomplished:
- on their own
- Exemplary:
- on their own, and explains it or takes it further
The four levels are the CAPS rubric levels (Coding and Robotics CAPS, Grades 4 to 6, page 176). The short descriptions are ours.
This lesson is not a formal task, but it is good practice for the term's practical task in Grades 4 to 6 (Coding and Robotics CAPS, Grades 4 to 6, page 170).
Common mistakes and fixes
- Scissors never appear.Check the random block says 1 to 3, not 1 to 2.
- Only one picture ever appears.Both conditions may say hand = 1. Change the second one to hand = 2.
- The pictures flash past too fast to see.Shake once, then hold still. Each shake throws again.
Where it sits in CAPS
- Coding and RoboticsAlignedGrade 6, Term 2: decisions with IF, THEN and ELSE.Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 6, Term 2, Coding, C.3 Interpret and execute a given symbolic or written set of commands, page 139:
Two variables with IF…THEN…ELSE
- Coding and RoboticsAlignedGrade 6, Term 2: a rock, paper, scissors game on the micro:bit.Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 6, Term 2, Robotics, R.5 Design a simple artefact based on a set of design instructions, page 143:
Rock-Paper-Scissors
- Coding and RoboticsFitsGrade 4, Term 2: IF…THEN to choose what happens (the CAPS teaches it with on-screen sprites in Grade 4; this lesson goes on to else if and else).Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 4, Term 2, Coding, C.2 Present a simple coding solution using symbolic or written statements representing sequences of commands, single repetition, and conditional constructs, page 67:
Introduce simple IF…THEN statement formally
- MathematicsGrades 4 to 6 Mathematics: listing the possible outcomes of a repeated event.Source: CAPS Mathematics, Grades 4 to 6, Section 2, topic 5.4 Probability (Grades 4, 5 and 6):
Perform simple repeated events and list possible outcomes
Coding and Robotics quotes come from the Department of Basic Education's final CAPS, with the page number of the 2024 printed edition (the Department's October 2025 library copies number their pages differently). Schools may teach a topic in another term: the CAPS leaves the order to each school's annual teaching plan.
micro:bit is a trade mark of the Micro:bit Educational Foundation, and BBC is a trade mark of the British Broadcasting Corporation. Maze Education is an independent reseller of genuine BBC micro:bit products. Our teacher training and our other products and services are our own, and are not endorsed by the Foundation or the BBC.

